MQTT_PublishQoS1()
Description
Function publishes data to MQTT broker (server) with certain topic.
Function first queues up messages in NVM so function is safe to use when device is offline.
Syntax
MQTT_PublishQoS1(topic, data[], len);
Parameters
Variable | Input |
|---|---|
| MQTT protocol topic name. |
| Any string data to be published. |
| Length of data array/string. |
Returns
Return value | Return explanation |
SCRIPT_OPERATION_SUCCESS | Success |
SCRIPT_OPERATION_FAILED | Failed |
SCRIPT_PARAM_INVALID | Passed parameters invalid. |
Function call example
Example of publishing data to MQTT broker (server) with certain topic.
new array1{10} = "35 degrees";
main()
{
MQTT_PublishQoS1("temperature/ff/", array1, strlen(array1));
for(;;)
{
Delay(100);
}
}