Goal: Send a command through a serial port to a mote to make it send a 6P packet.
Requierements: You need a 6TiSCH network up and running. See Kickstart Linux to get started.
Usually, we would get this working by using the command line of OpenVisualizer:
This would send the following bytes over the serial bus towards the mote:
#!/usr/bin/env python import zmq zmq_inject_port = 60000 d = {"signal": "cmdToMote", "data": {"action": ["imageCommand", "6pAdd", "[6,7]"], "serialPort": "/dev/ttyUSB0"}, "sender": "mySender"} context = zmq.Context() publisher = context.socket(zmq.REQ) publisher.connect("tcp://localhost:%d" % zmq_inject_port) publisher.send_json(d) |
You can tell whether a given 6P request passed or failed depending on its return code. Return codes are documented there:
https://github.com/openwsn-berkeley/openwsn-fw/blob/develop/openstack/02b-MAChigh/sixtop.h