MQTTSubscribe (FB)

FUNCTION_BLOCK MQTTSubscribe EXTENDS CBML.LCon IMPLEMENTS ISubscriber

Function block to subscribe (receive) messages from a MQTT broker

InOut:

Scope

Name

Type

Initial

Comment

Inherited from

Input

xEnable

BOOL

TRUE: Activates the defined operation FALSE: Aborts/resets the defined operation

LCon

Output

xDone

BOOL

TRUE: Ready condition reached

LCon

xBusy

BOOL

TRUE: Operation is running

LCon

xError

BOOL

TRUE: Error condition reached

LCon

Input

eSubscribeQoS

MQTT_QOS

QoS-Level for Subscribe

pbPayload

POINTER TO BYTE

Pointer to memory for incoming payload

udiMaxPayloadSize

UDINT

Maximum Size of incoming payload

eFilterMode

FILTER_MODE

FILTER_MODE.FILTER_ON

Filter mode for incoming telegrams. Default: FILTER_MODE.FILTER_ON

mQTTSubscribeProperties

REFERENCE TO MQTTSubscribeProperties

Subscribe proerties (MQTT V5 only)

udiTimeout

UDINT

1000000

Time in µs in which an subcription acknowledgement (SUBACK) must be received.

Inout

mqttClient

MQTTClient

Function block MQTTClient

wsTopicFilter

WSTRING(1024)

Topic Filter

Output

eMQTTError

MQTT_ERROR

MQTT Error Type

xReceived

BOOL

FALSE as long as there is no message, TRUE if a message got received, in new cyclus then again FALSE

udiPayloadSize

UDINT

Size of the received message

xSubscribeActive

BOOL

FALSE

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

wsLastTopic

WSTRING(1024)

The real topic value from the publish packet that is corresponding to this topic filter

mQTTPublishProperties

MQTTPublishProperties

Last received publish properties

Properties:

Methods:

Structure: