SubscribeMQTTMessage (FB)ΒΆ

FUNCTION_BLOCK SubscribeMQTTMessage

Function block to read C2D messages from Azure IoT Hub via MQTT.

InOut:

Scope

Name

Type

Initial

Comment

Input

xEnable

BOOL

TRUE: Subscribes C2D messages

pbPayload

POINTER TO BYTE

Pointer to the receive buffer

udiMaxPayloadSize

UDINT

Maximum size of the receive buffer

Inout

azureMQTTClient

AzureMQTTClient

Reference to AzureMQTTClient

Output

xError

BOOL

TRUE, if an error occurred

xBusy

BOOL

TRUE, while the topic is subscribed

eError

MQTT.MQTT_ERROR

Error code

xReceived

BOOL

TRUE, if a message has been received (see |pbPayload|).

udiPayloadSize

UDINT

Length of the received message

xSubscribeActive

BOOL

FALSE

FALSE: When there is no active subscription, TRUE: Subscriber is listening