Commit 73cd08c8 authored by Constantin's avatar Constantin
Browse files

status report command introduced

checking pin states is yet to implement
parent 986e711c
......@@ -86,6 +86,7 @@ class StateMachine():
class State():
def __init__(self, state_machine, nervlist = None):
......@@ -110,6 +111,9 @@ class StateMachine():
return StateMachine.StateFallback(self.state_machine)
def handle_cmd_fallback_off_event(self,arg):
arg("412 Precondition Failed: Not in fallback mode!")
def handle_cmd_status_event(self,arg):
# TODO use a proper JSON lib
arg('200 okay: {state:\"%s\"}' % self.__class__.__name__)
def on_leave(self):
def pins(self):
......@@ -135,6 +139,8 @@ class StateMachine():
return self.handle_cmd_fallback_on_event(arg)
elif ev == StateMachine.CMD_FALLBACK_OFF:
return self.handle_cmd_fallback_off_event(arg)
elif ev == StateMachine.CMD_STATUS:
return self.handle_cmd_status_event(arg)
raise Exception("Unknown command number: %d" % ev)
......@@ -86,6 +86,7 @@ commands = alias({
'who': CmdEntry(whocmd, 'Shows the list of people, who are allowed to control this system'),
'fallback_mode_on': CmdEntry(prompt_sure(sendcmd(tuerSock, 'fallback_mode_on'),'WARNING: This action will be reported to the admins. Use this only in case of Sphinx hardware failure when you need to ignore erroneous sensor input!'), 'Sets the system in a state where it is less dependent on sensoric input. Use it only when sensors are broken.'),
'fallback_mode_off': CmdEntry(prompt_sure(sendcmd(tuerSock, 'fallback_mode_off'),'WARNING: This action will be reported to the admins. Use this only if you have fixed the sensors of the Sphinx or activated fallback mode by accident!'), 'Resets the system to the default state. Use this when you have just repaired the sensors of the Sphinx.'),
'status': CmdEntry(sendcmd(tuerSock, 'status'), 'Shows internal state and sensor information.'),
# aliases
'open': 'unlock',
......@@ -30,6 +30,7 @@ class TySocket():
b'lock': StateMachine.CMD_LOCK,
b'fallback_mode_on': StateMachine.CMD_FALLBACK_ON,
b'fallback_mode_off': StateMachine.CMD_FALLBACK_OFF,
b'status': StateMachine.CMD_STATUS,
def __init__(self, sm):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment