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
xEnableBOOLTRUE: Activates the defined operationFALSE: Aborts/resets the defined operationLCon
Output
xDoneBOOLTRUE: Ready condition reachedLCon
xBusyBOOLTRUE: Operation is runningLCon
xErrorBOOLTRUE: Error condition reachedLCon
Input
eSubscribeQoSQoS-Level for Subscribe
pbPayloadPOINTER TO BYTE
Pointer to memory for incoming payload
udiMaxPayloadSizeUDINTMaximum Size of incoming payload
eFilterModeFILTER_MODE.FILTER_ON
Filter mode for incoming telegrams. Default: FILTER_MODE.FILTER_ON
mQTTSubscribePropertiesREFERENCE TO MQTTSubscribeProperties
Subscribe proerties (MQTT V5 only)
udiTimeoutUDINT1000000
Time in µs in which an subcription acknowledgement (SUBACK) must be received.
Inout
mqttClientFunction block MQTTClient
wsTopicFilterWSTRING(1024)Topic Filter
Output
eMQTTErrorMQTT Error Type
xReceivedBOOLFALSE as long as there is no message, TRUE if a message got received, in new cyclus then again FALSE
udiPayloadSizeUDINTSize of the received message
xSubscribeActiveBOOLFALSE
FALSE: When there is no active subscription, TRUE: Subscriber is listening
wsLastTopicWSTRING(1024)The real topic value from the publish packet that is corresponding to this topic filter
mQTTPublishPropertiesLast received publish properties
Properties:
Methods:
Structure: