MQTTPublish (FB)¶
FUNCTION_BLOCK MQTTPublish EXTENDS CBML.ETrigTo IMPLEMENTS IClientAction
Function block to publish (send) messages to a MQTT broker Use the input udiTimeout (see CBML.ETrigTo) to set the time in µs in which an acknowledgement must be received (relevant for QoS1 and QoS2). Default: 1s
- InOut:
Scope
Name
Type
Comment
Inherited from
Input
xExecuteBOOLRising edge: Starts defined operationFALSE: Resets the defined operation after ready condition was reachedETrigTo
udiTimeOutUDINTMax. operating time for executing [µs], 0: No operating time limit
ETrigTo
Output
xDoneBOOLReady condition reached
ETrigTo
xBusyBOOLOperation is running
ETrigTo
xErrorBOOLError condition reached
ETrigTo
Input
eQoSQoS Level of message
xReDeliveryBOOLTRUE: When packet got already send and now should got resend, FALSE: First time
xRetainBOOLTRUE: Stores the message on server
pbPayloadPOINTER TO BYTE
Pointer to the message
udiPayloadSizeUDINTSize of message
mQTTPublishPropertiesREFERENCE TO MQTTPublishProperties
Optional publish properties (MQTT V5 only)
Inout
mqttClientFunction block MQTTClient
wsTopicNameWSTRING(1024)Topic Name of message
Output
eMQTTErrorMQTT Error type