Add callback from statemachine to update webinterface status
This commit is contained in:
parent
ccb76fd306
commit
24848c9afb
|
@ -75,6 +75,7 @@ if __name__ == '__main__':
|
|||
feap = FeApUserInterface(cfg.pinconfig)
|
||||
controller = statemachine.StateMachineController(phone, feap, cfg.dialconfig)
|
||||
webinterface = FeTapWeb({}, controller)
|
||||
controller.publish_state = webinterface.publish_status
|
||||
|
||||
# TODO: Use real events from daemon
|
||||
controller.queue_event('registration_in_progress')
|
||||
|
|
|
@ -307,6 +307,10 @@ class StateMachineController(object):
|
|||
oldstate = self.state.__class__
|
||||
print('%s -> %s' % (oldstate.__name__, newstate.__name__))
|
||||
self.state = newstate(self)
|
||||
self.publish_state()
|
||||
|
||||
def publish_state(self):
|
||||
pass
|
||||
|
||||
def queue_event(self, evname, *evargs, **evkwargs):
|
||||
if not hasattr(AbstractState, 'on_%s' % (evname)):
|
||||
|
|
Loading…
Reference in a new issue