summaryrefslogtreecommitdiff
path: root/tests/api_send_eth0_1s1r/receiver.py
blob: 364c24c8c0515a90fcf5ec271c31cea1ea2ace8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/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)