MQTT-SN client API declaration. More...
Data Structures | |
struct | MQTTSNClientEventHandlers |
Structure grouping event callbacks for MQTT-SN client. More... | |
struct | MQTTSNTopicDescriptor |
Structure describing a single MQTT-SN topic. More... | |
struct | MQTTSNSessionFlags |
MQTT-SN session flags. More... | |
struct | MQTTSNClient |
Structure describing the MQTT-SN Client. More... | |
Macros | |
#define | MQTTSN_MAX_TOPIC_NAME_LENGTH 38 |
Maximum length of the MQTT-SN topic name. | |
#define | MQTTSN_MAX_MESSAGE_DATA 32 |
Maximum length of the MQTT-SN message data. | |
#define | MQTTSN_MAX_CLIENT_ID_LENGTH 23 |
Maximum length of the MQTT-SN client id. | |
#define | MQTTSN_CLIENT_GATEWAY_RESPONSE_TIMEOUT_MS 5000 |
Gateway response timeout in milliseconds, after which the client assumes the gateway is not responding. | |
#define | MQTTSN_CLIENT_MAX_TOPICS_TO_SUBSCRIBE 10 |
Maximum number of topics that the client can subscribe to. | |
#define | MQTTSN_CLIENT_MAX_TOPICS_TO_PUBLISH 10 |
Maximum number of topics that the client can publish to. | |
Typedefs | |
typedef uint16_t | MQTTSNTopicId |
Type describing topic id. | |
typedef void(* | MQTTSNOnClientConnected) (struct MQTTSNClient *client) |
Callback function type describing a function that is called when the MQTT-SN client connects to the gateway. | |
typedef void(* | MQTTSNOnClientDisconnected) (struct MQTTSNClient *client) |
Callback function type describing a function that is called when the MQTT-SN client gets disconnected from the gateway. | |
typedef void(* | MQTTSNOnTopicRegisteredByClient) (const struct MQTTSNClient *client, MQTTSNTopicId topicId, const char *topicName) |
Callback function type describing a function that is called when a topic is successfully registered by the client in the gateway. | |
typedef void(* | MQTTSNOnTopicRegisteredByGateway) (struct MQTTSNClient *client, MQTTSNTopicId topicId, const char *topicName) |
Callback function type describing a function that is called when a topic is successfully registered by the gateway. | |
typedef void(* | MQTTSNOnPublishReceived) (struct MQTTSNClient *client, MQTTSNTopicId topicId, const void *data, size_t dataSize) |
Callback function type describing a function that is called when a message is received on a topic. | |
typedef struct MQTTSNTopicDescriptor | MQTTSNTopicDescriptor |
Structure describing a single MQTT-SN topic. | |
typedef struct MQTTSNClient | MQTTSNClient |
Structure describing the MQTT-SN Client. | |
Functions | |
MQTTSNClientResult | MQTTSN_CLIENT_Init (MQTTSNClient *client, uint16_t port, const char *clientId, const MQTTSNClientEventHandlers *eventHandlers) |
Initializes the MQTT-SN client. | |
void | MQTTSN_CLIENT_Deinit (MQTTSNClient *client) |
Deinitializes the MQTT-SN client. | |
MQTTSNClientResult | MQTTSN_CLIENT_Connect (MQTTSNClient *client, EMBENET_IPV6 const *gatewayAddress, uint16_t gatewayPort, uint16_t keepAliveTime, uint16_t pingPeriod, const char *willTopic, const uint8_t *willMsg) |
Makes the client try to connect to a gateway. | |
MQTTSNClientResult | MQTTSN_CLIENT_CleanConnect (MQTTSNClient *client, EMBENET_IPV6 const *gatewayAddress, uint16_t gatewayPort, uint16_t keepAliveTime, uint16_t pingPeriod, const char *willTopic, const uint8_t *willMsg) |
Makes the client try to connect to a gateway using clean connection. | |
MQTTSNClientResult | MQTTSN_CLIENT_Disconnect (MQTTSNClient *client) |
Disconnects the client from the gateway. | |
MQTTSNClientResult | MQTTSN_CLIENT_RegisterTopic (MQTTSNClient *client, const char *topic, MQTTSNOnTopicRegisteredByClient onTopicRegisteredCallback) |
Registers a topic in the gateway. | |
MQTTSNTopicId | MQTTSN_CLIENT_GetTopicId (MQTTSNClient *client, const char *topic) |
Gets the id of the registered topic. | |
MQTTSNClientResult | MQTTSN_CLIENT_PublishMessage (MQTTSNClient *client, const char *topic, const char *message, size_t messageLen) |
Publishes a message on a topic given the topic string. | |
MQTTSNClientResult | MQTTSN_CLIENT_PublishMessageById (MQTTSNClient *client, MQTTSNTopicId topicId, const char *message, size_t messageLen) |
Publishes a message on a topic given the topic id. | |
MQTTSNClientResult | MQTTSN_CLIENT_Subscribe (MQTTSNClient *client, const char *topic, MQTTSNOnPublishReceived onPublishReceivedCallback) |
Subscribes to the topic. | |
MQTT-SN client API declaration.
This implementation of MQTT-SN client is based on the MQTT-SN specification version 1.2.