![]() |
Data Gator
Hardware and software documentation for the Data Gator project.
|
Utilities for receiving and sending MQTT commands. More...
Go to the source code of this file.
Functions | |
void | process_command (string command, string message) |
Process a command execute it. | |
void | callback (char *topic, byte *message, unsigned int length) |
Called when MQTT message is passed to the device by the broker. | |
Utilities for receiving and sending MQTT commands.
Utilities and interface for receiving MQTT messages from the broker. Also used to request data logged to the uSD card from the device.
Called when MQTT message is passed to the device by the broker.
Prints command and message to serial interface, then parses the MQTT packet and processes the command.
Commands are defined as a anything published to the datagator/cmd/#
topic tree. The #
symbol is an MQTT regex glob symbol that matches all MAC addresses. It tells the DG to subscribe to all commands published to ALL DGs.
The command is only processed in process_command(...)
if the MAC address in the topic, such as datagator/cmd/AC:45...
matches the MAC of this DG.
[in] | topic | The topic the message was published on |
[in] | message | The message in the MQTT packet |
[in] | length | The length of the message |
Process a command execute it.
Checks the command, if the command matches one of the known commands, then the message is processed. The message contains details about how the command should be carried out.
[in] | command | The command as a string. |
[in] | message | The body/message sent with the command. |