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
xExecute
BOOL
Rising edge: Starts defined operationFALSE
: Resets the defined operation after ready condition was reachedETrigTo
udiTimeOut
UDINT
Max. operating time for executing [µs], 0: No operating time limit
ETrigTo
Output
xDone
BOOL
Ready condition reached
ETrigTo
xBusy
BOOL
Operation is running
ETrigTo
xError
BOOL
Error condition reached
ETrigTo
Input
eQoS
QoS Level of message
xReDelivery
BOOL
TRUE: When packet got already send and now should got resend, FALSE: First time
xRetain
BOOL
TRUE: Stores the message on server
pbPayload
POINTER TO BYTE
Pointer to the message
udiPayloadSize
UDINT
Size of message
mQTTPublishProperties
REFERENCE TO MQTTPublishProperties
Optional publish properties (MQTT V5 only)
Inout
mqttClient
Function block MQTTClient
wsTopicName
WSTRING(1024)
Topic Name of message
Output
eMQTTError
MQTT Error type