Browse Source

Fixed registration states

pull/1/head
klonfish 10 years ago
parent
commit
a4aef00e55
  1. 8
      statemachinetest.py

8
statemachinetest.py

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

Loading…
Cancel
Save