FB_IotMqtt5DisconnectProperties
The function block enables the reception of disconnection information.
If the client has received Disconnect Properties and provides these at the output, this is indicated by bPropertiesAvailable=TRUE.
General description of the Disconnect Properties:
Property | Description |
---|---|
Reason Code | Specifies the reason for the Disconnect as described in MQTTv5 specification chapter 3.14.2.1. Usually used for programmatic evaluation. |
Reason String | Specifies the reason for the Disconnect in legible form. Usually not used for programmatic evaluation. |
Session Expiry Interval | Indicates the expiration interval for the session (in seconds). |
Server Reference | Can be used by the message broker in conjunction with ReasonCode 0x9C (Use Another Server) or 0x9D (Server moved) to specify a new server. The format of the server reference is not prescribed by the specification and therefore depends on the message broker used. |
User Properties | User Properties are key/value pairs that can be attached to the PublishProperties. This is done by means of the function block FB_IotMqtt5UserProperties. The meaning of the UserProperties is not part of the MQTT5 specification and therefore application specific. |
Syntax
Definition:
FUNCTION_BLOCK FB_IotMqtt5DisconnectProperties EXTENDS FB_IotMqtt5UserProperties
VAR_OUTPUT
bError : BOOL;
hrErrorCode : HRESULT;
END_VAR
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. |
Properties
Name | Type | Access | Description |
---|---|---|---|
bPropertiesAvailable | BOOL | Get | Indicates whether properties are present. |
nReasonCode | BYTE | Get | Specifies the Disconnect reason as a numeric value. |
nSessionExpire | UDINT | Get | Specifies a lifetime in seconds for the session. |
sReasonString | STRING | Get | Specifies the disconnect reason as a readable value. |
sServerReference | STRING | Get | Specifies an optional server reference for ReasonCode 0x9C or 0x9D. |
Methods
Name | Description |
---|---|
SetDisconnectProperties | Allows you to set the Disconnect properties. |
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) |