AWSIoTSubscribe (FB)

FUNCTION_BLOCK AWSIoTSubscribe

Function block to subscribe a topic.

InOut:

Scope

Name

Type

Initial

Comment

Input

xEnable

BOOL

TRUE: Subscribes a topic (see |wsTopicFilter|), FALSE: Unsubscribe

pbPayload

POINTER TO BYTE

Pointer to the receive buffer

udiMaxPayloadSize

UDINT

Maximum size of the receive buffer

eQoS

QOS

Quality of service level (QoS)

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

awsIoTClient

AWSIoTClient

Reference to AWSIoTClient

wsTopicFilter

WSTRING(1024)

Reference to the topic filter (‘+’ and ‘#’ are allowed)

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

wsLastTopic

WSTRING(1024)

Last received topic

mQTTPublishProperties

MQTTPublishProperties

Last received publish properties (MQTT V5 only)