m2mb API docs  25.21.002
m2mb API sets documentation
m2mb_mqtt.h File Reference

MQTT(Message Queuing Telemetry Transport) Client service. More...

Go to the source code of this file.

Data Structures

struct  M2MB_MQTT_TOPIC
 MQTT Topic Structure This is used in m2mb_mqtt_subscribe and m2mb_mqtt_unsubscribe API. More...
 
#define m2mb_mqtt_conf_(h, args...)   m2mb_mqtt_conf( h, CMDS( args ) )
 
enum  M2MB_MQTT_IND_E { M2MB_MQTT_INDICATION_DISCONNECT }
 MQTT Indications enum. More...
 
enum  M2MB_MQTT_RESPONSE_E {
  M2MB_MQTT_SUCCESS = 0, M2MB_MQTT_ERROR_BAD_ARG = -1, M2MB_MQTT_ERROR_OUT_OF_BUFFER = -2, M2MB_MQTT_ERROR_MALFORMED_DATA = -3,
  M2MB_MQTT_ERROR_PACKET_TYPE = -4, M2MB_MQTT_ERROR_PACKET_ID = -5, M2MB_MQTT_ERROR_TLS_CONNECT = -6, M2MB_MQTT_ERROR_TIMEOUT = -7,
  M2MB_MQTT_ERROR_NETWORK = -8, M2MB_MQTT_ERROR_MEMORY = -9, M2MB_MQTT_ERROR_STAT = -10, M2MB_MQTT_ERROR_PROPERTY = -11,
  M2MB_MQTT_ERROR_SERVER_PROP = -12, M2MB_MQTT_ERROR_CALLBACK = -13, M2MB_MQTT_ERROR_SEM = -14, M2MB_MQTT_ERROR_TOPIC_LIST = -15,
  M2MB_MQTT_ERROR_ASYNC_THREAD = -16, M2MB_MQTT_ERROR_QUEUE = -17, M2MB_MQTT_CONTINUE = -101, M2MB_MQTT_STDIN_WAKE = -102
}
 MQTT APIs response enum. More...
 
enum  M2MB_MQTT_STATUS_E {
  M2MB_MQTT_NOT_CONNECTED, M2MB_MQTT_CLIENT_CONNECTED, M2MB_MQTT_CONN_RESET_BY_PEER, M2MB_MQTT_PINGREQ_TIMEOUT_FAIL,
  M2MB_MQTT_CONNACK_TIMEOUT, M2MB_MQTT_CONNECT_TIMEOUT, M2MB_MQTT_FATAL_ERROR, M2MB_MQTT_NETWORK_ERROR,
  M2MB_MQTT_STATUS_UNKNOWN = 0xFF
}
 mqtt client status enum More...
 
enum  M2MB_MQTT_ACTION_E {
  M2MB_MQTT_SET_CLIENT_ID, M2MB_MQTT_SET_TIMEOUT_MS, M2MB_MQTT_SECURE_OPT, M2MB_MQTT_SET_KEEPALIVE_SEC,
  M2MB_MQTT_SET_CLEAN_SESSION, M2MB_MQTT_SET_PROTOCOL_LEVEL, M2MB_MQTT_SET_LAST_WILL, M2MB_MQTT_SET_USERNAME,
  M2MB_MQTT_SET_PASSWORD, M2MB_MQTT_SET_PDP_CONTEXT, M2MB_MQTT_GET_CLIENT_ID, M2MB_MQTT_GET_TIMEOUT_MS,
  M2MB_MQTT_GET_KEEPALIVE_SEC, M2MB_MQTT_GET_CLEAN_SESSION, M2MB_MQTT_GET_PROTOCOL_LEVEL, M2MB_MQTT_GET_LAST_WILL,
  M2MB_MQTT_GET_PDP_CONTEXT
}
 MQTT actions enum List of actions performed through m2mb_mqtt_conf API. More...
 
enum  M2MB_MQTT_QOS_E { M2MB_MQTT_QOS_0 = 0, M2MB_MQTT_QOS_1 = 1, M2MB_MQTT_QOS_2 = 2 }
 MQTT QoS Enum. More...
 
enum  M2MB_MQTT_RX_STATUS_E { M2MB_MQTT_RX_FINISHED, M2MB_MQTT_RX_MORE_DATA }
 MQTT Receive Data Status Enum. More...
 
typedef HANDLE M2MB_MQTT_HANDLE
 MQTT context handle. This is obtained from m2mb_mqtt_init API and then used in subsequent MQTT APIs.
 
typedef void(* m2mb_mqtt_ind_callback) (M2MB_MQTT_HANDLE Handle, M2MB_MQTT_IND_E event, UINT16 resp_size, void *resp, void *userdata)
 MQTT call back prototype. More...
 
typedef void(* M2MB_MQTT_MSG_HNDLR_CB_T) (M2MB_MQTT_HANDLE Handle, void *arg, const CHAR *topic, UINT16 topic_length, const CHAR *msg, UINT32 msg_length, M2MB_MQTT_RX_STATUS_E status)
 MQTT message handler call back prototype. More...
 
typedef struct M2MB_MQTT_TOPIC M2MB_MQTT_TOPIC_T
 MQTT Topic Structure This is used in m2mb_mqtt_subscribe and m2mb_mqtt_unsubscribe API.
 
M2MB_MQTT_RESPONSE_E m2mb_mqtt_init (M2MB_MQTT_HANDLE *h, m2mb_mqtt_ind_callback callback, void *userdata)
 m2mb_mqtt_init is called to initialize MQTT context. More...
 
M2MB_MQTT_RESPONSE_E m2mb_mqtt_deinit (M2MB_MQTT_HANDLE Handle)
 m2mb_mqtt_deinit deinitializes MQTT service for specified MQTT client. More...
 
M2MB_MQTT_RESPONSE_E m2mb_mqtt_conf (M2MB_MQTT_HANDLE Handle, UINT8 nCmds,...)
 m2mb_mqtt_conf sets/gets some MQTT parameters and configurations. More...
 
M2MB_MQTT_RESPONSE_E m2mb_mqtt_connect (M2MB_MQTT_HANDLE Handle, const CHAR *host, UINT32 port)
 m2mb_mqtt_connect is called to connect to the specified MQTT broker. More...
 
M2MB_MQTT_RESPONSE_E m2mb_mqtt_disconnect (M2MB_MQTT_HANDLE Handle)
 m2mb_mqtt_disconnect is called to disconnect from the MQTT broker. More...
 
M2MB_MQTT_RESPONSE_E m2mb_mqtt_publish (M2MB_MQTT_HANDLE Handle, M2MB_MQTT_QOS_E qos, UINT8 retain, UINT16 message_id, const CHAR *topic, const CHAR *data, UINT32 data_len)
 m2mb_mqtt_publish is called to Publish a message to the MQTT broker. More...
 
M2MB_MQTT_RESPONSE_E m2mb_mqtt_subscribe (M2MB_MQTT_HANDLE Handle, UINT16 message_id, UINT32 topic_count, M2MB_MQTT_TOPIC_T *pTopics)
 m2mb_mqtt_subscribe is called to Subscribe. More...
 
M2MB_MQTT_RESPONSE_E m2mb_mqtt_unsubscribe (M2MB_MQTT_HANDLE Handle, UINT16 message_id, UINT32 topic_count, M2MB_MQTT_TOPIC_T *topics)
 m2mb_mqtt_unsubscribe is called to unsubscribe. More...
 
M2MB_MQTT_RESPONSE_E m2mb_mqtt_ping (M2MB_MQTT_HANDLE Handle)
 m2mb_mqtt_ping is called to ping More...
 
M2MB_MQTT_RESPONSE_E m2mb_mqtt_getClientStatus (M2MB_MQTT_HANDLE handle, M2MB_MQTT_STATUS_E *status)
 m2mb_mqtt_getClientStatus gets MQTT client current status More...
 
M2MB_MQTT_RESPONSE_E m2mb_mqtt_setClientStatus (M2MB_MQTT_HANDLE handle, M2MB_MQTT_STATUS_E status)
 m2mb_mqtt_setClientStatus sets MQTT client current status More...
 

Detailed Description

MQTT(Message Queuing Telemetry Transport) Client service.

m2m_mqtt.h

The MQTT (Message Queuing Telemetry Transport) Client service provides a collection of APIs that allow the application to implement client functionalities, such as CONNECT, SUBSCRIBE, UNSUBSCRIBE, PUBLISH, DISCONNECT, and so on.

Note
Dependencies: m2mb_types.h
Author
Oshin Bhatia
Date
25/10/2019