MqttPublish – Publish MQTT message
Block SymbolLicensing group: MQTT
Function Description
This function block depends on the MQTT driver. Please read the MQTTDrv manual [22] before
use.
The MqttPublish block publishes messages to an MQTT broker through the connection established by the MQTTDrv driver.
The first parameter is the topic the block will publish the messages to. MQTT delivers Application Messages according to the Quality of Service (QoS) levels. Use the QoS parameter to set a different Quality of Service level. See the MQTT specification [23] for more details.
If the RETAIN parameter is set a RETAIN flag will be set on the outgoing PUBLISH Control Packet. See the MQTT specification [23] for more details.
The defBuffSize parameter can be used to optimize the memory usage of the block. It states the amount of the statically allocated memory for the inner buffer for the outgoing messages. If the value is unnecessarily large the memory is being wasted. On the other hand if the value of the parameter is too small it leads to frequent dynamic memory allocations which can be time consuming.
The message to be published is constructed from the value input signal. The value input signal is expected to be a string. If it is not a string it will be converted automatically. To request a message to be published in the current period set the RUN flag to on. The BUSY flag is on if the block has a pending request and waits for a response from a broker. When the response is received in the current cycle the DONE flag is set to on.
This block does not propagates the signal quality. More information can be found in the 1.4 section.
Input
value | Input signal | String |
RUN | Enable execution | Bool |
Parameter
topic | MQTT topic | String |
QoS | Quality of Service 1 | Long (I32) |
|
|
|
RETAIN | Retain last message on | Bool |
defBuffSize | Default buffer size 1 2048 | Long (I32) |
Output
BUSY | Busy flag | Bool |
DONE | Indicator of finished transaction | Bool |
errId | Error code | Error |
[Back to top] [Up] [Next]
2024 © REX Controls s.r.o., www.rexygen.com