create byte command detection infra and try out fire a command

This commit is contained in:
chrys
2018-03-24 22:50:27 +01:00
parent 88c12a3331
commit 11681120ca
3 changed files with 15 additions and 2 deletions

View File

@@ -83,6 +83,10 @@ class fenrirManager():
self.environment['input']['keyForeward'] -=1
self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput')
#print('handleInput:',time.time() - startTime)
def handleByteInput(self, event):
if event['Data'] == b'':
return
self.detectByteCommand(event['Data'])
def handleExecuteCommand(self, event):
if event['Data'] == '':
return
@@ -131,7 +135,12 @@ class fenrirManager():
def handleHeartBeat(self, event):
self.environment['runtime']['commandManager'].executeDefaultTrigger('onHeartBeat',force=True)
#self.environment['runtime']['outputManager'].brailleText(flush=False)
def detectByteCommand(self, escapeSequence):
command = ''
if escapeSequence == b'a':
command = 'TIME'
self.environment['runtime']['eventManager'].putToEventQueue(fenrirEventType.ExecuteCommand, command)
def detectCommand(self):
if self.environment['input']['keyForeward'] > 0:
return