Browse Source

Fixed registration states

master
klonfish 10 years ago
parent
commit
a4aef00e55
  1. 8
      statemachinetest.py

8
statemachinetest.py

@ -42,9 +42,9 @@ class AbstractState(object):
class InitState(AbstractState): class InitState(AbstractState):
def on_registration_in_progress(self): def on_registration_in_progress(self):
print('registration in progress') print('registration in progress')
return ConnectingState return RegisteringState
class ConnectingState(AbstractState): class RegisteringState(AbstractState):
def on_registration_successful(self): def on_registration_successful(self):
print('registration successfull') print('registration successfull')
return IdleState return IdleState
@ -148,7 +148,7 @@ class TelefonapparatUserInterface(object):
class StateMachineController(object): class StateMachineController(object):
def __init__(self): def __init__(self):
self.__state = IdleState(self) self.__state = InitState(self)
self.__running = True self.__running = True
self.__evqueue = queue.Queue() self.__evqueue = queue.Queue()
@ -193,6 +193,8 @@ class StateMachineController(object):
if __name__ == '__main__': if __name__ == '__main__':
c = StateMachineController() c = StateMachineController()
c.queue_event('registration_in_progress')
c.queue_event('registration_successful')
c.queue_event('gabelschalter_up') c.queue_event('gabelschalter_up')
c.queue_event('nummernschalter_input', 4) c.queue_event('nummernschalter_input', 4)
c.queue_event('nummernschalter_input', 2) c.queue_event('nummernschalter_input', 2)

Loading…
Cancel
Save