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 operationFALSE
: Aborts/resets the defined operationLCon
Output
xDone
BOOL
TRUE
: Ready condition reachedLCon
xBusy
BOOL
TRUE
: Operation is runningLCon
xError
BOOL
TRUE
: Error condition reachedLCon
Input
eSubscribeQoS
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_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
Function block MQTTClient
wsTopicFilter
WSTRING(1024)
Topic Filter
Output
eMQTTError
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
Last received publish properties
Properties:
Methods:
Structure: