forked from iot-lab/iot-lab-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode_example.py
71 lines (55 loc) · 2.16 KB
/
node_example.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# -*- coding:utf-8 -*-
""" Blank file for the implementation of an open-node called Nodename """
import logging
from gateway_code.config import static_path
from gateway_code.common import logger_call
from gateway_code.nodes import OpenNodeBase
LOGGER = logging.getLogger('gateway_code')
class NodeExample(OpenNodeBase):
""" Example node """
TTY = '/dev/ttyON_EXAMPLE'
# The tty as named in the udev rule
BAUDRATE = 9600
# The baudrate used to communicate with the open-node on the serial port
FW_IDLE = static_path('example_idle.elf')
# The name of the idle firmware
FW_AUTOTEST = static_path('example_autotest.elf')
# The name of the autotest firmware
ALIM = '5V'
# The tension of alimentation (will be 5V in most of the case)
AUTOTEST_AVAILABLE = ['echo']
# The list of autotest available for your node.
# As describe in the document,
# this list must contain at least 'echo'
def __init__(self):
pass
# The initialization of your class
@logger_call("Node Example : Setup of example")
def setup(self, firmware_path):
# Here you will perform all the necessary action needed
# by your node before the start of an experiment.
return 1
@logger_call("Node Example : teardown of example node")
def teardown(self):
# Here you will perform all the necessary action to
# properly terminate your node
return 1
@logger_call("Node Example : flash of example node")
def flash(self, firmware_path=None, binary=False, offset=0):
# Here you will call the flasher corresponding to your node.
# OpenOCD, EDBG, AVRdude, CC2538-bsl can be used.
return 1
@logger_call("Node Example : reset of example node")
def reset(self):
# Not implemented
return 1
def debug_start(self):
# Here you will start the debug of your node
return 1
def debug_stop(self):
# Here you will stop the debug of your node
return 1
def status(self):
# Here you will check the health of the node (for exemple with ftdi chip)
# if you are unable to check it, just return 0
return 0