mqttReceive (Functionblock) |
Top Previous Next |
This function will return a received message.
Note that the message is only valid after a "message received" event is raised; the event will be removed when this function block is called. The RTCU will buffer all valid incoming messages in an internal buffer with room for 10 messages - further messages will be lost.
Input: data : PTR Address of the buffer where the data of the message is stored in.
maxsize : INT The maximum number of bytes that can be stored in the buffer. Any message data after this limit will be lost. Please note that the firmware is only capable of handling messages with up to a device specific limit, and will truncate the data if a message is received with more data. The limit depends on the architecture of the device: oX32 architecture: 1024 bytes, oNX32 architecture: 4096 bytes. oNX32L architecture: 16384 bytes.
Output: ready : BOOL True if a message has been received.
handle : INT The handle of the MQTT connection the message is received from.
topic : STRING The topic of the received message.
size : INT The actual number of bytes stored in the buffer.
retained : BOOL If TRUE the message is not a new one, but one that has been retained by the MQTT server, if FALSE the message is a new one.
duplicate : BOOL If TRUE the message is a duplicate, if FALSE is is not a duplicate.
Declaration: FUNCTION_BLOCK mqttReceive;
Example: INCLUDE rtcu.inc |