Types#

This section provides a reference to the MQTT API data types.

Modules#

sl_mqtt_client_last_will_message_t

sl_mqtt_client_message_t

sl_mqtt_broker_t

sl_mqtt_client_credentials_t

sl_mqtt_client_configuration_t

sl_mqtt_client_topic_subscription_info_t

sl_mqtt_client_t

Typedefs#

typedef void(*
sl_mqtt_client_event_handler_t)(void *client, sl_mqtt_client_event_t event, void *event_data, void *context)

Handler for MQTT client events.

typedef void(*
sl_mqtt_client_message_received_t)(void *client, sl_mqtt_client_message_t *message_to_be_published, void *context)

Handler for received MQTT client messages.

Typedef Documentation#

sl_mqtt_client_event_handler_t#

sl_mqtt_client_event_handler_t )(void *client, sl_mqtt_client_event_t event, void *event_data, void *context)

Handler for MQTT client events.

Parameters
N/Aclient

Pointer to the MQTT client on which the event occurred. This pointer must not be NULL.

N/Aevent

The type of event that occurred. This is of type sl_mqtt_client_event_t.

N/Aevent_data

Pointer to the event data. This parameter is non-null only for events of type MQTT_CLIENT_MESSAGE_RECEIVED and MQTT_CLIENT_ERROR.

N/Acontext

Pointer to the user-provided context. This context is provided at the time of the API call (e.g., sl_mqtt_client_init). The caller must ensure that the lifecycle of the context is retained until the callback is invoked. The deallocation of the context is also the responsibility of the caller.

This function pointer type defines the handler for various events that occur on the MQTT client. The handler is invoked with details about the event, including the client on which the event occurred, the type of event, any associated event data, and a user-provided context.


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

sl_mqtt_client_message_received_t#

sl_mqtt_client_message_received_t )(void *client, sl_mqtt_client_message_t *message_to_be_published, void *context)

Handler for received MQTT client messages.

Parameters
N/Aclient

Pointer to the MQTT client that received the message. This pointer must not be NULL.

N/Amessage_to_be_published

Pointer to the received message of type sl_mqtt_client_message_t. This pointer must not be NULL.

N/Acontext

Pointer to the user-provided context. This context is provided at the time of the Subscribe API call. The caller (the function or module that invokes the Subscribe API) must ensure that the lifecycle of the context is retained until the callback is invoked. The deallocation of the context is also the responsibility of the caller.

This function pointer type defines the handler for messages received by the MQTT client. The handler is invoked with details about the client that received the message, the message itself, and a user-provided context.

Note

  • Due to constraints from the firmware, the fields is_retained, qos_level, packet_identifier, and duplicate_message of sl_mqtt_client_message_t are not populated and should be ignored while processing the message.


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