Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

11 watching

Forks

Repository files navigation

Control node serial interface

Send and receive messages to the control node. Should be used with the code from the iot-lab-gateway repository. Receive measures packets and errors messages from the control node.

Interactions are done through stdin and stdout.

Measures handling

Current received measures types are deducted from commands sent before. Handles packets decoding.

Measures outputs

Each output is optional, they can be used together:

  • -c <oml_config_file>: OML files (liboml2), configured by an OML XML file

  • -j <stream>=<path>: JSON lines file of a stream, one object per measure. Repeat it for each stream: consumption, radio, event, sniffer. A measure not done (power, voltage or current) is left out of its line.

    {"timestamp_s":1712345678,"timestamp_us":42,"power":0.25,"voltage":3.25}
    
  • -s <host:port>: JSON lines sent to a TCP socket (a local Fluent Bit), with a stream key and a time key (<s>.<us>, the record time) instead of timestamp_s and timestamp_us. The socket is non blocking: lines are dropped when it can't take them, the measures and the files are not delayed, the connection is retried every second. Sniffer packets are not streamed.

    {"stream":"radio","time":"1712345678.000042","channel":21,"rssi":-42}
    
  • -p <period_ms>: downsample the streamed consumption, mean over windows of period_ms (aligned on the epoch, line time: window start). The files keep all the measures, radio and events are streamed as they come.

  • -d: print the measures on stderr

Radio sniffer

The sniffed packets (ZEP v2: header with channel, RSSI, LQI and NTP time, then the 802.15.4 frame) are sent to a TCP client on port 30000. One client at a time, as the serial redirection: while a client is connected, the other connections are refused; the port accepts again when it leaves.

The files are flushed every second, and closed on exit, SIGTERM and SIGINT included.

GPIO events

config_gpio start <gpios> (pps, gpio1, gpio2, comma separated) and config_gpio stop configure the events of the control node GPIOs. Each event gives a value (pin level, 1 for the PPS) and a name (pps, gpio1, gpio2) in the event stream.

Compiling

Install 'oml' as described in OML.md

Testing

Run make test coverage, in the development image:

docker build -t control-node-serial .
docker run --rm --ulimit nofile=1024:1024 -u $(id -u):$(id -g) \
    -v $(pwd):/shared control-node-serial make test

Valgrind refuses the default open files limit of Docker: set --ulimit.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

11 watching

Forks

Releases

Packages

Contributors

Languages