esds/tests/api_send_eth0_1s1r/receiver.py
Loic Guegan 1eee1ac81a Change API. Indeed, currently wired communications
are aborted when receiver node turned off. This
may not be desire when implementing UDP communications.
Now user can use a boolean when using send()/sendt() to change this
behavior.
2022-07-01 10:03:54 +02:00

26 lines
913 B
Python

#!/usr/bin/env python
def execute(api):
##### Simple receive
code, data=api.receive("eth0")
msg="Received: "+data if code == 0 else "Receive failed code="+str(code)
api.log(msg)
##### Test if we still receive the data when we are not receiving
api.wait(2)
code, data=api.receive("eth0")
msg="Received: "+data if code == 0 else "Receive failed code="+str(code)
api.log(msg)
##### Ensure data is not receive when turned off
api.turn_off()
api.wait(1)
api.turn_on()
code, data=api.receivet("eth0",1)
msg="Received: "+data if code == 0 else "Receive failed code="+str(code)
api.log(msg)
##### Ensure data is not receive turned off but communication is not cancel
api.turn_off()
api.wait(1)
api.turn_on()
code, data=api.receivet("eth0",1)
msg="Received: "+data if code == 0 else "Receive failed code="+str(code)
api.log(msg)