Constants#

This section provides a reference to the MQTT API constants.

Enumerations#

enum
SL_MQTT_QOS_LEVEL_0
SL_MQTT_QOS_LEVEL_1
SL_MQTT_QOS_LEVEL_2
}

MQTT Quality of Service (QoS) levels.

enum
SL_MQTT_CLIENT_DISCONNECTED
SL_MQTT_CLIENT_TA_INIT
SL_MQTT_CLIENT_CONNECTION_FAILED
SL_MQTT_CLIENT_CONNECTED
SL_MQTT_CLIENT_TA_DISCONNECTED
}

MQTT Client connection states.

enum
SL_MQTT_VERSION_3
SL_MQTT_VERSION_3_1
}

MQTT Protocol versions.

enum
SL_MQTT_CLIENT_CONNECTED_EVENT
SL_MQTT_CLIENT_DISCONNECTED_EVENT
SL_MQTT_CLIENT_MESSAGE_PUBLISHED_EVENT
SL_MQTT_CLIENT_MESSAGED_RECEIVED_EVENT
SL_MQTT_CLIENT_SUBSCRIBED_EVENT
SL_MQTT_CLIENT_UNSUBSCRIBED_EVENT
SL_MQTT_CLIENT_ERROR_EVENT
}

MQTT Client Events.

enum
SL_MQTT_CLIENT_CONNECT_FAILED
SL_MQTT_CLIENT_PUBLISH_FAILED
SL_MQTT_CLIENT_SUBSCRIBE_FAILED
SL_MQTT_CLIENT_UNSUBSCRIBED_FAILED
SL_MQTT_CLIENT_DISCONNECT_FAILED
SL_MQTT_CLIENT_UNKNOWN_ERROR
}

MQTT Client error statuses.

enum
SL_MQTT_CLIENT_REMOTE_TERMINATE_DISCONNECTION
SL_MQTT_CLIENT_WLAN_DISCONNECTION
SL_MQTT_CLIENT_USER_INITIATED_DISCONNECTION
SL_MQTT_CLIENT_KEEP_ALIVE_RESPONSE_TIMEOUT_DISCONNECTION
}

MQTT Client disconnection reasons.

enum
SL_MQTT_TLS_ENABLE = BIT(0)
SL_MQTT_TLS_TLSV_1_0 = BIT(1)
SL_MQTT_TLS_TLSV_1_1 = BIT(2)
SL_MQTT_TLS_TLSV_1_2 = BIT(3)
SL_MQTT_TLS_TLSV_1_3 = BIT(4)
SL_MQTT_TLS_CERT_INDEX_1 = BIT(5)
SL_MQTT_TLS_CERT_INDEX_2 = BIT(6)
}

MQTT TLS and certificate options.

Enumeration Documentation#

sl_mqtt_qos_t#

sl_mqtt_qos_t

MQTT Quality of Service (QoS) levels.

This enumeration defines the Quality of Service (QoS) levels for MQTT messages. QoS levels determine the guarantee of delivery for a message.

Note

  • Quality of Service (QoS) level 2 is not currently supported.

Enumerator
SL_MQTT_QOS_LEVEL_0

At most once delivery. The message is delivered according to the best efforts of the operating environment. Message loss can occur.

SL_MQTT_QOS_LEVEL_1

At least once delivery. The message is assured to arrive but duplicates can occur.

SL_MQTT_QOS_LEVEL_2

Exactly once delivery. The message is assured to arrive exactly once. (Not currently supported).


Definition at line 55 of file components/service/mqtt/inc/sl_mqtt_client_types.h

sl_mqtt_client_connection_state_t#

sl_mqtt_client_connection_state_t

MQTT Client connection states.

This enumeration defines the various states of the MQTT client during its lifecycle. These states indicate the current status of the client's connection to the MQTT broker.

Enumerator
SL_MQTT_CLIENT_DISCONNECTED

Initial state. The client is not connected to the MQTT broker.

SL_MQTT_CLIENT_TA_INIT

The client has successfully initialized the NWP(Network Wireless Processor) for MQTT.

SL_MQTT_CLIENT_CONNECTION_FAILED

The client attempted to connect to the MQTT broker but failed.

SL_MQTT_CLIENT_CONNECTED

The client is successfully connected to the MQTT broker.

SL_MQTT_CLIENT_TA_DISCONNECTED

The NWP(Network Wireless Processor) is disconnected from the broker, but NWP deinitialization has not yet been called.


Definition at line 68 of file components/service/mqtt/inc/sl_mqtt_client_types.h

sl_mqtt_version_t#

sl_mqtt_version_t

MQTT Protocol versions.

This enumeration defines the supported versions of the MQTT protocol. The version determines the protocol features and behaviors used by the MQTT client.

Enumerator
SL_MQTT_VERSION_3

MQTT Version 3.0.

SL_MQTT_VERSION_3_1

MQTT Version 3.1.


Definition at line 83 of file components/service/mqtt/inc/sl_mqtt_client_types.h

sl_mqtt_client_event_t#

sl_mqtt_client_event_t

MQTT Client Events.

This enumeration defines the various events that can occur in the lifecycle of an MQTT client. These events notifies the application about changes in the client's state, or the receipt of messages.

Enumerator
SL_MQTT_CLIENT_CONNECTED_EVENT

Event indicating that the MQTT client has successfully connected to the broker.

SL_MQTT_CLIENT_DISCONNECTED_EVENT

Event indicating that the MQTT client has disconnected from the broker.

SL_MQTT_CLIENT_MESSAGE_PUBLISHED_EVENT

Event indicating that a message has been successfully published by the MQTT client.

SL_MQTT_CLIENT_MESSAGED_RECEIVED_EVENT

Event indicating that a message has been received by the MQTT client.

SL_MQTT_CLIENT_SUBSCRIBED_EVENT

Event indicating that the MQTT client has successfully subscribed to a topic.

SL_MQTT_CLIENT_UNSUBSCRIBED_EVENT

Event indicating that the MQTT client has successfully unsubscribed from a topic.

SL_MQTT_CLIENT_ERROR_EVENT

Event indicating that an error has occurred in the MQTT client.


Definition at line 95 of file components/service/mqtt/inc/sl_mqtt_client_types.h

sl_mqtt_client_error_status_t#

sl_mqtt_client_error_status_t

MQTT Client error statuses.

This enumeration defines the various error statuses that can occur in the MQTT client. These statuses indicate the type of error that has occurred during the client's operations.

Enumerator
SL_MQTT_CLIENT_CONNECT_FAILED

Error status indicating that the MQTT client failed to connect to the broker.

SL_MQTT_CLIENT_PUBLISH_FAILED

Error status indicating that the MQTT client failed to publish a message.

SL_MQTT_CLIENT_SUBSCRIBE_FAILED

Error status indicating that the MQTT client failed to subscribe to a topic.

SL_MQTT_CLIENT_UNSUBSCRIBED_FAILED

Error status indicating that the MQTT client failed to unsubscribe from a topic.

SL_MQTT_CLIENT_DISCONNECT_FAILED

Error status indicating that the MQTT client failed to disconnect from the broker.

SL_MQTT_CLIENT_UNKNOWN_ERROR

Error status indicating that an unknown error occurred in the MQTT client.


Definition at line 112 of file components/service/mqtt/inc/sl_mqtt_client_types.h

sl_mqtt_client_disconnection_reason_t#

sl_mqtt_client_disconnection_reason_t

MQTT Client disconnection reasons.

This enumeration defines the various reasons for the disconnection of an MQTT client from the broker. These reasons help in identifying the cause of the disconnection.

Enumerator
SL_MQTT_CLIENT_REMOTE_TERMINATE_DISCONNECTION

Disconnection due to remote termination by the broker.

SL_MQTT_CLIENT_WLAN_DISCONNECTION

Disconnection due to WLAN (Wi-Fi) network issues.

SL_MQTT_CLIENT_USER_INITIATED_DISCONNECTION

Disconnection initiated by the user.

SL_MQTT_CLIENT_KEEP_ALIVE_RESPONSE_TIMEOUT_DISCONNECTION

Disconnection due to keep-alive response timeout.


Definition at line 128 of file components/service/mqtt/inc/sl_mqtt_client_types.h

sl_mqtt_tls_flag_t#

sl_mqtt_tls_flag_t

MQTT TLS and certificate options.

This enumeration defines the various TLS (Transport Layer Security) and certificate options available for the MQTT client. These options include enabling TLS, selecting the TLS version, and choosing the certificate index.

Note

  • Only one TLS version (SL_MQTT_TLS_TLSV_X_X) can be set at a time.

  • Only one certificate index (SL_MQTT_TLS_CERT_INDEX_X) can be set at a time.

Enumerator
SL_MQTT_TLS_ENABLE

Enable TLS for MQTT.

SL_MQTT_TLS_TLSV_1_0

Enable TLS version 1.0 for MQTT.

SL_MQTT_TLS_TLSV_1_1

Enable TLS version 1.1 for MQTT.

SL_MQTT_TLS_TLSV_1_2

Enable TLS version 1.2 for MQTT.

SL_MQTT_TLS_TLSV_1_3

Enable TLS version 1.3 for MQTT.

SL_MQTT_TLS_CERT_INDEX_1

Use certificate index 1 for MQTT.

SL_MQTT_TLS_CERT_INDEX_2

Use certificate index 2 for MQTT.


Definition at line 147 of file components/service/mqtt/inc/sl_mqtt_client_types.h