SendMQTTMessage (FB)

FUNCTION_BLOCK SendMQTTMessage

Function block for sending D2C messages via MQTT to Azure IoT Hub.

InOut:

Scope

Name

Type

Comment

Input

xExecute

BOOL

Rising edge will send the message |pbPayload|

udiTimeOut

UDINT

Time out in µs, 0: no time out

pbPayload

POINTER TO BYTE

Pointer to the message

udiPayloadSize

UDINT

Size of the message |pbPayload|

sPropertyBag

STRING

Property bag (optional) Example: RFC 2396-encoded(<PropertyName1>)=RFC 2396-encoded(<PropertyValue1>)&RFC 2396-encoded(<PropertyName2>

Inout

azureMQTTClient

AzureMQTTClient

Reference to AzureMQTTClient

Output

xError

BOOL

TRUE, if an error occurred

xBusy

BOOL

TRUE, while sending the message

xDone

BOOL

TRUE, if the message was sent successfully

eError

MQTT.MQTT_ERROR

Error code