Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mqtt_sn.h File Reference

MQTT-SN Client Implementation. More...

#include <stddef.h>
#include <zephyr/net_buf.h>
#include <zephyr/types.h>
#include <sys/types.h>

Go to the source code of this file.

Data Structures

struct  mqtt_sn_data
 Abstracts memory buffers. More...
 
union  mqtt_sn_evt_param
 Event metadata. More...
 
struct  mqtt_sn_evt
 MQTT-SN event structure to be handled by the event callback. More...
 
struct  mqtt_sn_transport
 Structure to describe an MQTT-SN transport. More...
 
struct  mqtt_sn_client
 Structure describing an MQTT-SN client. More...
 

Macros

#define MQTT_SN_DATA_STRING_LITERAL(literal)
 Initialize memory buffer from C literal string.
 
#define MQTT_SN_DATA_BYTES(...)
 Initialize memory buffer from single bytes.
 

Typedefs

typedef void(* mqtt_sn_evt_cb_t) (struct mqtt_sn_client *client, const struct mqtt_sn_evt *evt)
 Asynchronous event notification callback registered by the application.
 

Enumerations

enum  mqtt_sn_qos { MQTT_SN_QOS_0 , MQTT_SN_QOS_1 , MQTT_SN_QOS_2 , MQTT_SN_QOS_M1 }
 Quality of Service. More...
 
enum  mqtt_sn_topic_type { MQTT_SN_TOPIC_TYPE_NORMAL , MQTT_SN_TOPIC_TYPE_PREDEF , MQTT_SN_TOPIC_TYPE_SHORT }
 MQTT-SN topic types. More...
 
enum  mqtt_sn_return_code { MQTT_SN_CODE_ACCEPTED = 0x00 , MQTT_SN_CODE_REJECTED_CONGESTION = 0x01 , MQTT_SN_CODE_REJECTED_TOPIC_ID = 0x02 , MQTT_SN_CODE_REJECTED_NOTSUP = 0x03 }
 MQTT-SN return codes. More...
 
enum  mqtt_sn_evt_type {
  MQTT_SN_EVT_CONNECTED , MQTT_SN_EVT_DISCONNECTED , MQTT_SN_EVT_ASLEEP , MQTT_SN_EVT_AWAKE ,
  MQTT_SN_EVT_PUBLISH , MQTT_SN_EVT_PINGRESP
}
 Event types that can be emitted by the library. More...
 

Functions

int mqtt_sn_client_init (struct mqtt_sn_client *client, const struct mqtt_sn_data *client_id, struct mqtt_sn_transport *transport, mqtt_sn_evt_cb_t evt_cb, void *tx, size_t txsz, void *rx, size_t rxsz)
 Initialize a client.
 
void mqtt_sn_client_deinit (struct mqtt_sn_client *client)
 Deinitialize the client.
 
int mqtt_sn_connect (struct mqtt_sn_client *client, bool will, bool clean_session)
 Connect the client.
 
int mqtt_sn_disconnect (struct mqtt_sn_client *client)
 Disconnect the client.
 
int mqtt_sn_sleep (struct mqtt_sn_client *client, uint16_t duration)
 Set the client into sleep state.
 
int mqtt_sn_subscribe (struct mqtt_sn_client *client, enum mqtt_sn_qos qos, struct mqtt_sn_data *topic_name)
 Subscribe to a given topic.
 
int mqtt_sn_unsubscribe (struct mqtt_sn_client *client, enum mqtt_sn_qos qos, struct mqtt_sn_data *topic_name)
 Unsubscribe from a topic.
 
int mqtt_sn_publish (struct mqtt_sn_client *client, enum mqtt_sn_qos qos, struct mqtt_sn_data *topic_name, bool retain, struct mqtt_sn_data *data)
 Publish a value.
 
int mqtt_sn_input (struct mqtt_sn_client *client)
 Check the transport for new incoming data.
 
int mqtt_sn_get_topic_name (struct mqtt_sn_client *client, uint16_t id, struct mqtt_sn_data *topic_name)
 Get topic name by topic ID.
 

Detailed Description

MQTT-SN Client Implementation.

MQTT-SN Client's Application interface is defined in this header. Targets protocol version 1.2.