FB_IotMqtt5UserProperties

FB_IotMqtt5UserProperties 1:

The function block enables the definition and handling of UserProperties. UserProperties are key/value pairs that describe optional metadata and can be used, for example, with PublishProperties.

FB_IotMqtt5UserProperties 2:

Number of UserProperties

The processing of UserProperties in the PLC real-time task cycle requires a certain amount of time, which is why it is better to keep it low.
The maximum amount of possible UserProperties can be set via the parameter cMaxMqtt5UserProps in the parameter list of the Tc3_IotBase library.

Syntax

Definition:

FUNCTION_BLOCK FB_IotMqtt5UserProperties 
VAR_OUTPUT
    bError           : BOOL;
    hrErrorCode      : HRESULT;
END_VAR

FB_IotMqtt5UserProperties 3: Outputs

Name

Type

Description

bError

BOOL

Becomes TRUE as soon as an error situation occurs.

hrErrorCode

HRESULT

Returns an error code if the bError output is set. An explanation of the possible error codes can be found in the Appendix.

FB_IotMqtt5UserProperties 4: Properties

Name

Type

Access

Description

nUserPropertyCnt

UINT

Get

Specifies the number of UserProperties included.

FB_IotMqtt5UserProperties 5: Methods

Name

Description

AddUserProperty

Adds a UserProperty to the list. The property is specified by its name and value.

ClearUserProperties

Deletes all UserProperties contained in the list.

GetUserPropertyByIdx

Returns the name and value of a UserProperty specified by its position (index) in the list.

GetUserPropertyValueByName

Returns the value of a UserProperty specified by its name.

SetUserProperties

Deletes all UserProperties contained in the list and adds a set of UserProperties specified by an array of objects of type MqttUserProperty.

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.4026.0

IPC or CX (x86, x64, ARM)

Tc3_IotBase (>= v3.4.2.0)