MQTT_PublishPending example

MQTT_PublishPending example

#include <io> #include <read> #include <float> #include <string> #include <core> #include <write> #include <define> #include <socket> forward public callback (event); public callback (event) { switch(event) { case MQTT_PublishPending: { AppendSensors(); // Function will execute when GNSS sensor registration is ongoing } } return 0; } AppendSensors() // Add following sensors to record next to GNSS { MQTT_PublishSensor(SENSOR_VCC); MQTT_PublishSensor(SENSOR_VBAT); } main() { Init(MQTT_PUBLISH_PENDING); for(;;) { Delay(1000); } }

NOTE: AppendSensors() function will only be called, when GNSS sensor registration is ongoing. It is meant to synchronize publishing sensors into a single payload.