m2mb API docs  25.30.003
m2mb API sets documentation
m2mb_mqttsn.h File Reference

MQTT-SN(MQTT-SN for Sensor Networks) Client service. More...

Go to the source code of this file.

Data Structures

struct  M2MB_MQTTSN_WILL
 MQTT-SN will structure. Used while setting will and will topic update. More...
 
struct  M2MB_MQTTSN_PUBLISH
 MQTT-SN Publish structure. This is used to Publish data to the Gateway. More...
 
struct  M2MB_MQTTSN_SUBSCRIBE
 MQTT-SN Subscribe structure. This is used while subscribing to a topic/topic Id. More...
 
struct  M2MB_MQTTSN_MESSAGE_CTX
 MQTT-SN Subscribe structure. This is used while subscribing to a topic/topic Id. More...
 
#define m2mb_mqttsn_conf_(h, args...)   m2mb_mqttsn_conf( h, CMDS( args ) )
 
enum  M2MB_MQTTSN_IND_E { M2MB_MQTTSN_INDICATION_DISCONNECT = 0, M2MB_MQTTSN_INDICATION_MESSAGE_RCV = 1 }
 MQTT-SN Indications enum. More...
 
enum  M2MB_MQTTSN_RESPONSE_E {
  M2MB_MQTTSN_SUCCESS = 0, M2MB_MQTTSN_ERROR_BAD_ARG = -1, M2MB_MQTTSN_ERROR_OUT_OF_BUFFER = -2, M2MB_MQTTSN_ERROR_MALFORMED_DATA = -3,
  M2MB_MQTTSN_ERROR_PACKET_TYPE = -4, M2MB_MQTTSN_ERROR_PACKET_ID = -5, M2MB_MQTTSN_ERROR_TIMEOUT = -7, M2MB_MQTTSN_ERROR_NETWORK = -8,
  M2MB_MQTTSN_ERROR_MEMORY = -9, M2MB_MQTTSN_ERROR_STAT = -10, M2MB_MQTTSN_ERROR_CALLBACK = -13, M2MB_MQTTSN_ERROR_SEM = -14,
  M2MB_MQTTSN_ERROR_ASYNC_THREAD = -16, M2MB_MQTTSN_ERROR = -100, M2MB_MQTTSN_CONTINUE = -101
}
 MQTT-SN APIs response enum. More...
 
enum  M2MB_MQTTSN_STATUS_E {
  M2MB_MQTTSN_NOT_CONNECTED, M2MB_MQTTSN_SOCKET_CONNECTED, M2MB_MQTTSN_CLIENT_CONNECTED, M2MB_MQTTSN_CONN_RESET_BY_PEER,
  M2MB_MQTTSN_PINGREQ_TIMEOUT_FAIL, M2MB_MQTTSN_CONNECT_TIMEOUT, M2MB_MQTTSN_CLIENT_SLEEP, M2MB_MQTTSN_CLIENT_AWAKE,
  M2MB_MQTTSN_FATAL_ERROR, M2MB_MQTTSN_NETWORK_ERROR, M2MB_MQTTSN_STATUS_UNKNOWN = 0xFF
}
 mqtt-sn client status enum More...
 
enum  M2MB_MQTTSN_ACTION_E {
  M2MB_MQTTSN_SET_CLIENT_ID, M2MB_MQTTSN_SET_TIMEOUT_MS, M2MB_MQTTSN_SECURE_OPT, M2MB_MQTTSN_SET_KEEPALIVE_SEC,
  M2MB_MQTTSN_SET_CLEAN_SESSION, M2MB_MQTTSN_SET_LAST_WILL, M2MB_MQTTSN_SET_PDP_CONTEXT, M2MB_MQTTSN_GET_CLIENT_ID,
  M2MB_MQTTSN_GET_TIMEOUT_MS, M2MB_MQTTSN_GET_KEEPALIVE_SEC, M2MB_MQTTSN_GET_CLEAN_SESSION, M2MB_MQTTSN_GET_LAST_WILL,
  M2MB_MQTTSN_GET_PDP_CONTEXT
}
 MQTT-SN actions enum List of actions performed through m2mb_mqttsn_conf API. More...
 
enum  M2MB_MQTTSN_QOS_E { M2MB_MQTTSN_QOS_0 = 0, M2MB_MQTTSN_QOS_1 = 1, M2MB_MQTTSN_QOS_2 = 2, M2MB_MQTTSN_QOS_3 = 3 }
 MQTT-SN QoS Enum. More...
 
enum  M2MB_MQTTSN_TOPIC_ID_E { M2MB_MQTTSN_TOPIC_ID_NORMAL = 0x0, M2MB_MQTTSN_TOPIC_ID_PREDEF = 0x1, M2MB_MQTTSN_TOPIC_ID_SHORT = 0x2 }
 MQTT-SN Topic ID types. More...
 
enum  M2MB_MQTTSN_RX_STATUS_E { M2MB_MQTTSN_RX_FINISHED, M2MB_MQTTSN_RX_MORE_DATA }
 MQTT-SN Receive Data Status Enum. More...
 
enum  M2MB_MQTTSN_CODE_E { M2MB_MQTTSN_CODE_ACCEPTED = 0x00, M2MB_MQTTSN_CODE_CONGESTION = 0x01, M2MB_MQTTSN_CODE_INVTOPICNAME = 0x02, M2MB_MQTTSN_CODE_NOTSUPPORTED = 0x03 }
 RETURN CODE values received in various MQTT-SN response (Acknowledgement) packets. More...
 
typedef HANDLE M2MB_MQTTSN_HANDLE
 MQTT-SN context handle. This is obtained from m2mb_mqttsn_init API and then used in subsequent MQTT-SN APIs.
 
typedef struct M2MB_MQTTSN_WILL M2MB_MQTTSN_WILL_T
 MQTT-SN will structure. Used while setting will and will topic update.
 
typedef struct M2MB_MQTTSN_PUBLISH M2MB_MQTTSN_PUBLISH_T
 MQTT-SN Publish structure. This is used to Publish data to the Gateway.
 
typedef struct M2MB_MQTTSN_SUBSCRIBE M2MB_MQTTSN_SUBSCRIBE_T
 MQTT-SN Subscribe structure. This is used while subscribing to a topic/topic Id.
 
typedef struct M2MB_MQTTSN_MESSAGE_CTX M2MB_MQTTSN_MESSAGE_CTX_T
 MQTT-SN Subscribe structure. This is used while subscribing to a topic/topic Id.
 
typedef void(* m2mb_mqttsn_ind_callback) (M2MB_MQTTSN_HANDLE Handle, M2MB_MQTTSN_IND_E event, UINT16 resp_size, void *resp, void *userdata)
 MQTT-SN callback prototype. More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_init (M2MB_MQTTSN_HANDLE *pHandle, m2mb_mqttsn_ind_callback callback, void *userdata)
 m2mb_mqttsn_init is called to initialize MQTT-SN context. More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_deinit (M2MB_MQTTSN_HANDLE handle)
 m2mb_mqttsn_deinit deinitializes MQTT-SN service for specified MQTT-SN client. More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_conf (M2MB_MQTTSN_HANDLE handle, UINT8 nCmds,...)
 m2mb_mqttsn_conf sets/gets some MQTTSN parameters and configurations. More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_socket (M2MB_MQTTSN_HANDLE handle, const CHAR *host, UINT32 port)
 m2mb_mqttsn_socket is called to initialize the socket More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_clean_socket (M2MB_MQTTSN_HANDLE handle)
 m2mb_mqttsn_clean_socket is called to perform socket related cleanup More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_connect (M2MB_MQTTSN_HANDLE handle, UINT8 *return_code)
 m2mb_mqttsn_connect is called to connect to the specified MQTTSN Gateway. More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_disconnect (M2MB_MQTTSN_HANDLE handle)
 m2mb_mqttsn_disconnect is called to disconnect from the MQTTSN Gateway. More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_register (M2MB_MQTTSN_HANDLE handle, const CHAR *topic, UINT16 *topic_id, UINT8 *return_code)
 m2mb_mqttsn_register is called to send Register packet to the Gateway. More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_publish (M2MB_MQTTSN_HANDLE handle, M2MB_MQTTSN_PUBLISH_T publish, UINT8 *return_code)
 m2mb_mqttsn_publish is called to send Publish packet to the Gateway. More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_subscribe (M2MB_MQTTSN_HANDLE handle, M2MB_MQTTSN_SUBSCRIBE_T subscribe, UINT16 *topic_id, UINT8 *return_code)
 m2mb_mqttsn_subscribe is called to send Subscribe to the specified topic/topic name. More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_unsubscribe (M2MB_MQTTSN_HANDLE handle, M2MB_MQTTSN_TOPIC_ID_E topic_type, const CHAR *topic, UINT16 topic_id)
 m2mb_mqttsn_unsubscribe is called to send Unsubscribe to the specified topic/topic name. More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_ping (M2MB_MQTTSN_HANDLE handle)
 m2mb_mqttsn_ping is called to ping More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_enter_sleep (M2MB_MQTTSN_HANDLE handle, UINT16 duration)
 m2mn_mqttsn_enter_sleep is called to enable sleeping client functionality More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_awake (M2MB_MQTTSN_HANDLE handle)
 m2mb_mqttsn_awake is called to enter "awake" state More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_will_topic_update (M2MB_MQTTSN_HANDLE handle, M2MB_MQTTSN_WILL_T *will, UINT8 *return_code)
 m2mb_mqttsn_will_topic_update is called to send Topic Update packet to the Gateway. More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_will_message_update (M2MB_MQTTSN_HANDLE handle, CHAR *will_msg, UINT16 will_msg_len, UINT8 *return_code)
 m2mb_mqttsn_will_message_update is called to send Will Message Update packet to the Gateway. More...
 
M2MB_MQTTSN_RESPONSE_E m2mb_mqttsn_get_client_status (M2MB_MQTTSN_HANDLE handle, M2MB_MQTTSN_STATUS_E *status)
 m2mb_mqttsn_get_client_status gets MQTTSN client current status More...
 

Detailed Description

MQTT-SN(MQTT-SN for Sensor Networks) Client service.

m2m_mqttsn.h

The MQTT-SN Client service provides a collection of APIs that allow the application to implement client functionalities, such as CONNECT, SUBSCRIBE, UNSUBSCRIBE, REGISTER, PUBLISH, DISCONNECT, PING, and so on.

Note
Dependencies: m2mb_types.h
Author
Oshin Bhatia
Date
11/05/2020