raise Exception("Unknown command number: %d" % ev)
class StateStart(State):
- def __init__(self, sm):
- State.__init__(self,sm)
def handle_pins_event(self):
thepins = self.pins()
for pin in thepins:
return StateAuf
class StateZu(State):
- def __init__(self,sm):
- State.__init__(self,sm)
def handle_pins_event(self):
pins = self.pins()
if not pins.door_locked:
class StateOpening(State):
def __init__(self,callback,sm):
- State.__init__(self,sm)
+ super().__init__(self,sm)
self.callbacks=[callback]
# FIXME: can we send "202 processing: Trying to open the door" here? Are the callbacks multi-use?
self.tries = 0
return StateZu(self.state_machine)
class AbstractStateWhereOpeningIsRedundant(State):
- def __init__ (self,sm):
- State.__init__(sm):
def handle_open_event(self, callback):
+ # FIXME contradicting original plan where open would be ignored in StateAboutToOpen?
callback("299 redundant: Space seems to be already open. Still processing your request tough.")
logger.warning("Received OPEN command in StateAboutToOpen. This should not be necessary.")
self.actor().act(Actor.CMD_OPEN)
class StateAboutToOpen(AbstractStateWhereOpeningIsRedundant):
- def __init__(self, sm):
- AbstractStateWhereOpeningIsRedundant.__init__(sm)
def handle_pins_event(self):
pins = self.pins()
if pins.door_locked:
class StateAuf(AbstractStateWhereOpeningIsRedundant):
def __init__(self,sm):
- AbstractStateWhereOpeningIsRedundant.__init__(sm)
+ super().__init__(sm)
self.last_buzzed = None
def handle_pins_event(self):
pins = self.pins()