esds/tests/api_send_eth0_1s1r/receiver.py

28 lines
905 B
Python
Raw Permalink Normal View History

2022-06-09 21:48:32 +02:00
#!/usr/bin/env python
from esds import RCode
2022-06-09 21:48:32 +02:00
def execute(api):
##### Simple receive
code, data=api.receive("eth0")
msg="Received: "+data if code == RCode.SUCCESS else "Receive failed code="+str(code)
2022-06-09 21:48:32 +02:00
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 == RCode.SUCCESS else "Receive failed code="+str(code)
2022-06-09 21:48:32 +02:00
api.log(msg)
##### Ensure data is not receive when turned off but communication must still be ongoing
api.turn_off()
api.wait(1)
api.turn_on()
code, data=api.receivet("eth0",1)
msg="Received: "+data if code == RCode.SUCCESS else "Receive failed code="+str(code)
api.log(msg)
2022-07-14 14:07:52 +02:00
##### Ensure communication get aborted on turned off for the sender
api.wait(28) # Goto t=33s
api.wait(2) # Goto t=35s
api.turn_off()
2022-07-14 14:07:52 +02:00