def help_get_state(self):
self._report_new_message("Print the current state the refreshing state machine is in")
+ 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")
+
+ def do_get_state_status(self, args):
+ if args:
+ self._report_new_message("No arguments supported")
+ return
+ self._report_new_message("\n".join((
+ "Contacts:", str(self._conn.session.addressbookStateMachine)
+ )))
+ self._report_new_message("\n".join((
+ "Voicemail:", str(self._conn.session.voicemailsStateMachine)
+ )))
+ self._report_new_message("\n".join((
+ "Texts:", str(self._conn.session.textsStateMachine)
+ )))
+
+ def help_get_state_status(self):
+ self._report_new_message("Prints the current setting for the state machines")
+
def do_is_authed(self, args):
if args:
self._report_new_message("No arguments supported")
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")
-
def do_grab_log(self, args):
if args:
self._report_new_message("No arguments supported")
except IndexError:
return self._postTimeout
+ def __str__(self):
+ return "NTimesStateStrategy(timeout=%r)" % (
+ self.timeout,
+ )
+
def __repr__(self):
return "NTimesStateStrategy(timeouts=%r, postTimeout=%r)" % (
self._timeouts,
timeout = self._init + self._current
return timeout
+ def __str__(self):
+ return "GeometricStateStrategy(timeout=%r)" % (
+ self.timeout
+ )
+
def __repr__(self):
return "GeometricStateStrategy(init=%r, min=%r, max=%r)" % (
self._init, self._min, self._max
self._name = name
self._updateItems = updateItems
self._maxTime = maxTime
+ self._isRunning = False
self._state = self.STATE_ACTIVE
self._onTimeout = gobject_utils.Timeout(self._on_timeout)
)
)
+ def __str__(self):
+ return """UpdateStateMachine(
+ name=%r,
+ strategie=%s,
+ isRunning=%r,
+)""" % (self._name, self._strategy, self._onTimeout.is_running())
+
def __repr__(self):
return """UpdateStateMachine(
name=%r,
strategy.initialize_state()
if self._strategy.timeout != self.INFINITE_PERIOD:
self._onTimeout.start(seconds=0)
+ self._isRunning = True
_moduleLogger.info("%s Starting State Machine" % (self._name, ))
def stop(self):
_moduleLogger.info("%s Stopping State Machine" % (self._name, ))
+ self._isRunning = False
self._onTimeout.cancel()
def close(self):
self._reset_timers()
def _reset_timers(self, initialize=False):
- if self._onTimeout.is_running():
+ if not self._isRunning:
return # not started yet
_moduleLogger.info("%s Resetting State Machine" % (self._name, ))
self._onTimeout.cancel()