esds/tests/api_receivet_eth0_1s1r/receiver.py
2022-09-09 13:16:42 +02:00

16 lines
512 B
Python

#!/usr/bin/env python
from esds import RCode
def receivet(node,timeout):
##### Simple receive
code, data=node.receivet("eth0",timeout)
msg="Received: "+data if code == RCode.SUCCESS else "Receive failed code="+str(code)
node.log(msg)
def execute(api):
# Should works
receivet(api,2)
# Should failed
receivet(api,0.5) # At t=1.5s
# Should works (priorities says that communications should occurs before timeout)
receivet(api,0.5) # At t=2s (timeout+receive should occur)