MqttGetReceivedPacket (FB)

FUNCTION_BLOCK MqttGetReceivedPacket EXTENDS AbbETrig3

Get the contents of a packet received from an established connection to an MQTT broker

InOut:

Scope

Name

Type

Initial

Comment

Inherited from

Input

Execute

BOOL

FALSE

A rising edge starts a single operation, the output Busy goes to TRUE. In the first cycle all other inputs are read and stored, afterwards they are ignored. A falling edge does not stop the operation. After Done = TRUE or Error = TRUE and Execute = FALSE all outputs will be reset. For executing another operation the Execute input needs to be retriggered by another rising edge!

AbbETrig3

Output

Done

BOOL

FALSE

Operation is completed without error (while outputs Busy and Error are FALSE). This output is TRUE for at least one cycle or until Execute is set to FALSE

AbbETrig3

Busy

BOOL

FALSE

Operation is running (while outputs Done and Error are FALSE)

AbbETrig3

Error

BOOL

FALSE

Operation is stopped with error (while outputs Busy and Done are FALSE). This output is TRUE for at least one cycle or until Execute is set to FALSE. The output ErrorID gives more details about the error.

AbbETrig3

Input

Conn

POINTER TO MQTT_CONNECTION

0

Pointer to valid connection struct created by MqttConnect.

Payload

POINTER TO BYTE

0

Pointer to the data area where the received packet can be stored.

MaxPayloadSize

DWORD

0

Size of the data area where the received packet can be stored.

Output

ErrorID

ERROR_ID

ERROR_ID.MQTT_ERR_NO_ERROR

Error code description

Topic

STRING(Constants.MQTT_MAX_TOPIC_LEN)

Defaults.MQTT_DEFAULT_EMPTY

Topic where the payload data belongs to.

PayloadLen

DWORD

0

Actual length of the payload.