From: Ed Page Date: Sat, 30 Jan 2010 04:47:57 +0000 (-0600) Subject: Adding a way to query all of the polling periods X-Git-Url: http://git.maemo.org/git/?p=theonering;a=commitdiff_plain;h=2b6cb781e1d2b011dab0eecf1008439368e7b045 Adding a way to query all of the polling periods --- diff --git a/src/channel/debug_prompt.py b/src/channel/debug_prompt.py index af04bf9..72091d0 100644 --- a/src/channel/debug_prompt.py +++ b/src/channel/debug_prompt.py @@ -220,3 +220,20 @@ class DebugPromptChannel(tp.ChannelTypeText, cmd.Cmd): def help_version(self): self._report_new_message("Prints the version (hint: %s-%s)" % (constants.__version__, constants.__build__)) + + def do_get_polling(self, args): + if args: + self._report_new_message("No arguments supported") + return + self._report_new_message("\n".join(( + "Contacts:", repr(self._conn.session.addressbookStateMachine) + ))) + self._report_new_message("\n".join(( + "Voicemail:", repr(self._conn.session.voicemailsStateMachine) + ))) + self._report_new_message("\n".join(( + "Texts:", repr(self._conn.session.textsStateMachine) + ))) + + def help_get_polling(self): + self._report_new_message("Prints the frequency each of the state machines updates") diff --git a/src/gvoice/state_machine.py b/src/gvoice/state_machine.py index ba7ce8b..6eb6af8 100644 --- a/src/gvoice/state_machine.py +++ b/src/gvoice/state_machine.py @@ -51,6 +51,9 @@ class NopStateStrategy(object): def timeout(self): return UpdateStateMachine.INFINITE_PERIOD + def __repr__(self): + return "NopStateStrategy()" + class ConstantStateStrategy(object): @@ -68,6 +71,9 @@ class ConstantStateStrategy(object): def timeout(self): return self._timeout + def __repr__(self): + return "ConstantStateStrategy(timeout=%r)" % self._timeout + class GeometricStateStrategy(object): @@ -94,6 +100,11 @@ class GeometricStateStrategy(object): timeout = self._init + self._current return timeout + def __repr__(self): + return "GeometricStateStrategy(init=%r, min=%r, max=%r)" % ( + self._init, self._min, self._max + ) + class StateMachine(object): @@ -175,6 +186,12 @@ class UpdateStateMachine(StateMachine): ) ) + def __repr__(self): + return """UpdateStateMachine( + name=%r, + strategie=%r, +)""" % (self._name, self._strategies) + def set_state_strategy(self, state, strategy): self._strategies[state] = strategy