GetLibVersion (FUN) ¶ FUNCTION GetLibVersion : VERSION InOut: Scope Name Type Return GetLibVersion VERSION
GetLibVersionNumber (FUN) ¶ FUNCTION GetLibVersionNumber : DWORD InOut: Scope Name Type Return GetLibVersionNumber DWORD
IsLibReleased (FUN) ¶ FUNCTION IsLibReleased : BOOL InOut: Scope Name Type Return IsLibReleased BOOL
MQTT Client SL Library Documentation ¶ Company : CODESYS Title : MQTT Client SL Version : 1.10.0.0 Categories : Application|Utils Namespace : MQTT Author : CODESYS Development GmbH Placeholder : MQTT_Client_SL Description [ 1 ] ¶ MQTT (Message Queuing Telemetry Transport) is an open-source IoT protocol that allows for the transmission of telemetry data as messages between devices. Device communication always takes place by means of an MQTT broker (e.g. Mosquitto https://mosquitto.org/ ). Messages are sent and subscribed to based on topics. A topic corresponds to a path (e.g. device1/temperature). Subscribing to messages is done by specifying a topic filter. Wildcards are also permitted (+ for one level and # for multiple levels). The message format is not fixed, which means that a JSON string or any data structure can be transmitted. With the “MQTT Client SL” library, messages can be sent from a CODESYS controller to an MQTT broker, and messages can be subscribed to based on topics. The “MQTT Client SL” package contains the following components: MQTT Client SL library with the following function blocks: MQTTClient FB for establishing an MQTT link MQTTPublish FB for sending messages MQTTSubscribe FB for subscribing to messages Sample project “MQTT Client SL Example.project” with a visualization for sending and receiving messages Description of the function blocks (CHM help file) Data sheet (German/English) Supported functions ¶ Publishing and subscription of messages based on MQTT V3.1.1 and MQTT V5.0 TLS encryption Client certificates (transfer of a certificate handle) Quality of Service: 0, 1, and 2 (QoS0, QoS1, QoS2) for the last will, publisher, and subscriber Data type “Topics”: WSTRING Maximum size of a topic: 1024 The maximum package size and payload size can be configured by means of a parameter list. Multitasking and multicore support ( MQTTClient , MQTTPublish , and MQTTSubscribe can each be run on different tasks or CPU cores.) Last will messages (QoS0, QoS1, QoS2) Wildcards (# and +) MQTT over WebSocket Supported MQTT V5 functions ¶ Session expiry: see MQTTConnectProperties.udiSessionExpiryInterval Message expiry: see MQTTPublishProperties.udiMessageExpiryInterval and MQTTWillProperties.udiMessageExpiryInterval Reason codes: The reason code of the last response is set to the output MQTTClient.eReaonCode Reason strings: see MQTTConnackProperties.wsReasonString and Server disconnect: The server can send a DISCONNECT packet to the client. The reason code will be set to MQTTClient.eReaonCode Payload format and content type: see MQTTPublishProperties.bPayloadFormatIndicator, MQTTWillProperties.bPayloadFormatIndicator, MQTTPublishProperties.wsContentType and MQTTWillProperties.wsContentType Request / Response: see MQTTPublishProperties.wsResponseTopic and MQTTWillProperties.wsResponseTopic Shared Subscriptions: A Shared Subscription is identified using a special style of Topic Filter. The format of this filter is: $share/{ShareName}/{filter} Subscription ID: see MQTTSubscribeProperties.udiSubscriptionIdentifier Topic Alias: see MQTTPublishProperties.uiTopicAlias Flow control: see MQTTConnackProperties.uiReceiveMaximum and MQTTConnectProperties.uiReceiveMaximum User properties: see MQTTConnectProperties.userProperties, MQTTConnackProperties.userProperties, MQTTConnectProperties.userProperties, MQTTPublishProperties.userProperties, MQTTSubscribeProperties.userProperties and MQTTWillProperties.userProperties Maximum Packet Size: see MQTTConnectProperties.udiMaximumPacketSize, MQTTConnackProperties.udiMaximumPacketSize Optional Server feature availability: see MQTTConnackProperties.bMaximumQoS, MQTTConnackProperties.bRetainAvailable, MQTTConnackProperties.bWildcardSubscriptionAvailable, MQTTConnackProperties.bSubscriptionIdentifierAvailable, MQTTConnackProperties.bSharedSubscriptionAvailable Enhanced authentication: see MQTTConnectProperties, MQTTConnackProperties and MQTTAuthProperties Subscription options: see MQTTSubscribeProperties.xNoLocalOption, MQTTSubscribeProperties.xRetainAsPublished and MQTTSubscribeProperties.eRetainHandling, Will delay: see MQTTWillProperties.udiWillDelayInterval Server Keep Alive: see MQTTConnackProperties.uiServerKeepAlive Assigned ClientID: see MQTTConnackProperties.wsAssignedClientIdentifier Server reference: see MQTTConnackProperties.wsServerReference Contents: ¶ MQTT Client Common UTF-8 Indices and tables ¶ [ 1 ] Based on MQTT Client SL.library, last modified 06.05.2024, 08:26:27. LibDoc 4.5.0.0 The content file MQTT Client SL.clean.json was generated with CODESYS V3.5 SP16 Patch 3 on 06.05.2024, 08:26:30.
MQTT Client ¶ Common Enums COMMUNICATION_MODE (Enum) FILTER_MODE (Enum) MQTT_ERROR (Enum) MQTT_QOS (Enum) MQTT_VERSION (Enum) V5 MQTT_REASON_CODE (Enum) MQTT_RETAIN_HANDLING (Enum) Function Blocks MQTTClient (FunctionBlock) ResetAction (Method) SendAuthPacket (Method) SetInitialValue (Method) SetWebSocketOptions (Method) MQTTPublish (FunctionBlock) MQTTSubscribe (FunctionBlock) FilterMode (Property) ResetAction (Method) SubscribeActive (Property) Params MQTTParam (ParamList) Structs MQTTV5 Properties MQTTAuthProperties (Struct) MQTTConnackProperties (Struct) MQTTConnectProperties (Struct) MQTTPublishProperties (Struct) MQTTStringPair (Struct) MQTTSubscribeProperties (Struct) MQTTWillProperties (Struct) UTF-8 ConvertUTF16toUTF8 (Function) ConvertUTF8toUTF16 (Function)
Common ¶ Enums COMMUNICATION_MODE (Enum) FILTER_MODE (Enum) MQTT_ERROR (Enum) MQTT_QOS (Enum) MQTT_VERSION (Enum) V5 MQTT_REASON_CODE (Enum) MQTT_RETAIN_HANDLING (Enum) Function Blocks MQTTClient (FunctionBlock) ResetAction (Method) SendAuthPacket (Method) SetInitialValue (Method) SetWebSocketOptions (Method) MQTTPublish (FunctionBlock) MQTTSubscribe (FunctionBlock) FilterMode (Property) ResetAction (Method) SubscribeActive (Property) Params MQTTParam (ParamList) Structs MQTTV5 Properties MQTTAuthProperties (Struct) MQTTConnackProperties (Struct) MQTTConnectProperties (Struct) MQTTPublishProperties (Struct) MQTTStringPair (Struct) MQTTSubscribeProperties (Struct) MQTTWillProperties (Struct)
Enums ¶ COMMUNICATION_MODE (Enum) FILTER_MODE (Enum) MQTT_ERROR (Enum) MQTT_QOS (Enum) MQTT_VERSION (Enum) V5 MQTT_REASON_CODE (Enum) MQTT_RETAIN_HANDLING (Enum)
COMMUNICATION_MODE (ENUM) ¶ TYPE COMMUNICATION_MODE : Communication mode Attributes: qualified_only InOut: Name Initial Comment TCP 0 Standard TCP/IP communication WEB_SOCKET 1 TCP/IP communication via WebSocket (MQTT over WebSocket)
FILTER_MODE (ENUM) ¶ TYPE FILTER_MODE : Filter settings for the subcriber function block. Attributes: qualified_only InOut: Name Initial Comment FILTER_ON 0 Filters the telegrams by topics FILTER_OFF 1 Turns the filter off and receives ALL subscribed telegrams FILTER_NONE 2 Receives no telegrams. In this mode you can only subscribe or unsubscribe topics
MQTT_ERROR (ENUM) ¶ TYPE MQTT_ERROR : Attributes: qualified_only InOut: Name Initial Comment NO_ERROR 0 No error TCP_INIT_ERROR 1 Unable to initialize the TCP socket TCP_READ_ERROR 2 Error while reading response TCP_WRITE_ERROR 3 Error while sending the request MAX_RESPONSE_SIZE_EXCEEDED 4 Size of incoming packet exceeds the maximum packet size. See MQTTParam.g_udiMaxPacketSize DECODE_REMAINING_LENGTH_MALFORMED 5 Malformation during Decoding of Remaining Length of Packet RESPONSE_PACKET_EMPTY 6 The Response Packet is empty INVALID_PACKET_TYPE 7 Invalid Packet Type in first byte of Fixed Header INVALID_PACKET_BIT_FLAGS 8 Invalid Packet Bit Flags in first byte of Fixed Header INVALID_PACKET 9 Invalid Packet KEEP_ALIVE_TIME_EXCEEDED 10 Keep Alive Time is too much WRONG_SESSION_PRESENT_CONNACK 11 Wrong Session Present in CONNACK packet UNACCEPTABLE_PROTOCOL_VERION 12 Connection to Broker is Refused, because of Unacceptable Protocol Version IDENTIFIER_REJECTED 13 Connection to Broker is Refused, because of Rejection of Client Identifier SERVER_UNAVAILABLE 14 Connection to Broker is Refused, because the Server Broker is not available BAD_USER_NAME_PASSWORD 15 Connection to Broker is Refused, because of Bad User name or Bad Password NOT_AUTHORIZED 16 Connection to Broker is Refused, because of Not Authorized access TOPIC_FILTER_EMPTY 17 Topic Filter is empty “”, MUST be at least one character long TOPIC_NAME_NOT_ALLOWED_WILDCARD 18 Topic Name contains Wildcards, what is not allowed. Only Topic Filter can contain these TOPIC_INVALID_LENGTH 19 Topic Length out of valid range (valid range: 1 - 1024) TOPIC_IS_EMPTY 20 Topic name is empty SUBSCRIBE_FAILURE 21 Subscription Failure ADD_MQTT_PACKET_COLLECTION_ERROR 22 Collection Error while trying to add a mqtt packet to the stack ADD_SUBSCRIBER_COLLECTION_ERROR 23 Collection Error while trying to add a subscriber to the stack REMOVE_SUBSCRIBER_COLLECTION_ERROR 24 Collection Error while trying to remove a subscriber from the stack ACKNOWLEDGE_TIMEOUT 25 Client waits for ping response from Server, but Server does not response within a given time interval (2 * ping interval) ALLOCATED_PAYLOAD_SIZE_EXCEEDED 26 The Size of the received payload is more than given allocated memory MAX_NUMBER_OF_PACKETS_EXCEEDED 27 The maximum size of packets has been exceeded CAN_NOT_ADD_ELEMENT_TO_QUEUE 28 Can not add the element to queue (maybe the maximum size has been exceeded) QUERYINTERFACE_ERROR 29 Call of function __QUERYINTERFACE failed (internal error) TIME_OUT 30 Action returned with timeout error. INVALID_LICENSE 31 No valid license found or demo mode has expired. CLIENT_NOT_CONNECTED 32 The MQTT client is not connected to a broker. RESOLVE_HOSTNAME_FAILED 33 The hostname can not be resolved. MAX_REQUEST_SIZE_EXCEEDED 34 Size of publish packet packet exceeds the maximum packet size UNSUPPORTED_VERSION 35 Unsupported MQTT version OPERATION_NOT_SUCCESSFUL 36 The operation was not successful. See eReasonCode for more information. (MQTT V5 only) SEND_QUOTA_LIMIT_REACHED 37 The send quota limit has been reached. Try to publish the message later. INVALID_REASON_CODE 38 The reason code is not allowed in this context. MAX_RECEIVE_BUFFER_SIZE_EXCEEDED 39 Size of incoming packets exceeds the maximum size of the receive buffer. See MQTTParam.g_udiMaxReceiveBufferSize MAX_TOPIC_LEVEL_EXCEEDED 40 The maximum topic level has been exceeded. MAX_STRING_LENGTH_EXCEEDED 41 The maximum length of a STRING has been exceeded (Maximum length: 1024). MAX_CORRELATION_DATA_LENGTH_EXCEEDED 42 The maximum size of Correlation Data has been exceeded. See MQTTParam.g_udiMaxCorrelationDataSize MAX_NUMBER_OF_PUBLISHER_AND_SUBSCRIBER_EXCEEDED 43 The maximum number of publishers and subscribers has been exceeded. See MQTTParam.g_udiMaxPublishersAndSubscribers