2022-06-09 21:48:32 +02:00
|
|
|
#!/usr/bin/env python
|
2022-09-09 13:16:42 +02:00
|
|
|
from esds import RCode
|
2022-06-09 21:48:32 +02:00
|
|
|
|
|
|
|
def execute(api):
|
|
|
|
##### Simple receive
|
|
|
|
code, data=api.receive("eth0")
|
2022-09-09 13:16:42 +02:00
|
|
|
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")
|
2022-09-09 13:16:42 +02:00
|
|
|
msg="Received: "+data if code == RCode.SUCCESS else "Receive failed code="+str(code)
|
2022-06-09 21:48:32 +02:00
|
|
|
api.log(msg)
|
2022-07-01 13:05:33 +02:00
|
|
|
##### Ensure data is not receive when turned off but communication must still be ongoing
|
2022-07-01 10:03:54 +02:00
|
|
|
api.turn_off()
|
|
|
|
api.wait(1)
|
|
|
|
api.turn_on()
|
|
|
|
code, data=api.receivet("eth0",1)
|
2022-09-09 13:16:42 +02:00
|
|
|
msg="Received: "+data if code == RCode.SUCCESS else "Receive failed code="+str(code)
|
2022-07-01 10:03:54 +02:00
|
|
|
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
|
2022-07-01 18:12:28 +02:00
|
|
|
api.turn_off()
|
2022-07-01 13:05:33 +02:00
|
|
|
|
2022-07-14 14:07:52 +02:00
|
|
|
|
2022-07-01 13:05:33 +02:00
|
|
|
|