Skip to content
Snippets Groups Projects
Commit 8572da5b authored by ptangu01's avatar ptangu01
Browse files

add buildTimestamp

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/trunk@1316 b32b6428-25c9-4566-ad07-03861ab6144f
parent aaddfbcb
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,8 @@ MIXER_PADDING = 10
from xAAL.core import Engine
from xAAL.message import Message
from xAAL.message import Message,MessageFactoryParserError,buildTimestamp
import ujson as json
import sys
from xAAL import tools
......@@ -50,27 +51,27 @@ def main():
#ToDo
if not isinstance(targets,list):
targets = [targets]
if targets == '[]':
targets=[]
else:
targets = [targets]
msg.setTargets(targets)
msg.setDevtype('cli.experimental')
msg.setMsgtype('request')
msg.setAction(sys.argv[2])
if len(sys.argv)>3:
#value=list()
targets = [targets]
key = sys.argv[3]
#value.append(sys.argv[4])
value = sys.argv[4]
body = {key:value}
#body = {key:value,sys.argv[5]:sys.argv[6]}
msg.setBody(body)
msg.setSource(uuid)
msg.setCipher("")
msg.setSignature()
txt={"header":msg.getHeader(),"body":msg.getBody()}
data = json.encode(txt)
app.getNetworkConnector().send(data)
msg.setTimestamp(buildTimestamp())
data = app.getMessageFactory().encodeMSG(msg)
app.sendMSG(data)
filterADDR = [config.XAAL_BCAST_ADDR,uuid]
timeout = 0
......@@ -78,7 +79,10 @@ def main():
while 1:
data = app.getNetworkConnector().getData()
if data:
msg = app.getMessageFactory().parseMSG(data)
try:
msg = app.getMessageFactory().decodeMSG(data)
except MessageFactoryParserError as e:
print(e.message)
if msg.getSource() in targets:
if msg.getAction() != 'alive':
msg.dump()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment