Couple bugfixes

This commit is contained in:
Maximilien Rigaut 2021-10-12 03:38:53 +02:00
parent b0ae5c321e
commit 8d7cf3e793
2 changed files with 14 additions and 6 deletions

View File

@ -28,7 +28,7 @@ def _SYS_EXIT(system,*args):
sys.exit() sys.exit()
_VERBOSE=4 _VERBOSE=3
nopeF=lambda *x:None nopeF=lambda *x:None
def printl(label=""): def printl(label=""):
@ -167,6 +167,7 @@ _MATCHS={
"GCfra":"FREEZEALL", "GCfra":"FREEZEALL",
"GCfrl":"FREEZELAYER", "GCfrl":"FREEZELAYER",
"GCply":"DISPLAYLAYER", "GCply":"DISPLAYLAYER",
"ISsva":"DETECTED",
"E":"ERROR" "E":"ERROR"
} }
@ -174,11 +175,11 @@ _ALL_MESSAGE_TYPES=[
"CONNECT","DEVICE","VERSION","STATUS","KPALIVE","LAYERINP", "CONNECT","DEVICE","VERSION","STATUS","KPALIVE","LAYERINP",
"TAKEAVL","TAKE","TAKEALL","LOADMM","QUICKFA","QUICKF", "TAKEAVL","TAKE","TAKEALL","LOADMM","QUICKFA","QUICKF",
"SCRNUPD","FREEZE","FREEZEALL","FREEZELAYER","DISPLAYLAYER", "SCRNUPD","FREEZE","FREEZEALL","FREEZELAYER","DISPLAYLAYER",
"ERROR" "ERROR","DETECTED",
] ]
_UPDATE_MSG=[ _UPDATE_MSG=[
"LAYERINP","QUICKFA","QUICKF","TAKE","QUICKFA","QUICKF","FREEZE","FREEZEALL","DISPLAYLAYER", "LAYERINP","QUICKFA","QUICKF","TAKE","QUICKFA","QUICKF","FREEZE","FREEZEALL","DISPLAYLAYER","DETECTED",
] ]
# RELOAD_PROGRAM # RELOAD_PROGRAM
# FREEZE_SCREEN # FREEZE_SCREEN
@ -227,6 +228,10 @@ class analogController(object):
eprint('Hostname could not be resolved. Exiting') eprint('Hostname could not be resolved. Exiting')
sys.exit() sys.exit()
def addFeedbackInterface(self,feedback):
"Add the feedback interface TODO: Several feedback interfaces ?"
self.feedback=feedback
def getAttr(self,attribute,default): def getAttr(self,attribute,default):
"A custom attribute fetcher" "A custom attribute fetcher"
try: try:
@ -332,6 +337,9 @@ class analogController(object):
"Returns the layer,screen and status of the freeze" "Returns the layer,screen and status of the freeze"
return True return True
def POSTMATCH_DETECTED(self,match):
"Return the status of the input"
return True
# def POSTMATCH_TAKEAVL(self,match): # def POSTMATCH_TAKEAVL(self,match):
# "Take available answer 1" # "Take available answer 1"
# if match.group("postargs")[-1]=="1": # if match.group("postargs")[-1]=="1":

View File

@ -37,7 +37,7 @@ def parrotanswers(s,addr,seq,delay=_DELAY):
match=_MESSAGE_REGEX.match(recv.decode()) match=_MESSAGE_REGEX.match(recv.decode())
msg=match.group("msg")+match.group("preargs") msg=match.group("msg")+match.group("preargs")
print("[{}] Received : {} | Sending {}".format(addr[1],recv,msg)) print("[{}] Received : {} | Sending {}".format(addr[1],recv,msg))
s.sendall(msg.encode()) s.sendall((msg+"\r\n").encode())
except ConnectionResetError as e: except ConnectionResetError as e:
print("[{}] Has stopped the connection".format(addr[1])) print("[{}] Has stopped the connection".format(addr[1]))
print(e) print(e)
@ -71,8 +71,8 @@ if __name__ == '__main__':
("*",["VEvar13","#0","VEvar13","*1"]), ("*",["VEvar13","#0","VEvar13","*1"]),
("?",['DEV259']), ("?",['DEV259']),
("VEvar",["VEvar13"]), #Guess ("VEvar",["VEvar13"]), #Guess
("#3",["#4","PRinp0,1,7,8","PRinp0,1,1,8","#0"]), #Another guess ("#3",["ISsva4,3,1","ISsva3,3,1","ISsva1,3,1","PRinp0,1,7,8","PRinp0,1,1,8","#0"]), #Another guess
("1SYpig",["SYpig4294967294"]) #Another guess ("1SYpig",["SYpig4294967294"]) #Another guess
] ]
Main(0.5) Main(0.05)