This section provides a detailed description of abstract level APIs for data transfer through MQTT.

Click here to download cloud APIs.



Prototype  uint8_t app_mqtt_publish(int8_t * pubtopic,char * data)
Input Arguments uint32_t pubtopic  : Topic on which data should be published

char * data : Message/payload to be published


Return Value

status :   0    -    Success

              <0   -    Failure

Description Publishes data on a particular topic.
Example Usage status1 = app_mqtt_publish(pubtopic,data);



Prototype  uint8_t app_mqtt_subscribe(int8_t * subtopic,uint8_t QoS,void(*call_back_handle)(MessageData* md))
Input Arguments uint8_t subtopic : Topic to be subscribed

uint8_t Qos : Quality of service of the message

void(*call_back_handle)(MessageData* md)) : Callback handler

Return Value

status :   0    -    success

              <0   -   failure

Description Subscribes on a particular topic.
Example Usage status = app_mqtt_subscribe(subtopic,QOS,Call_Back_handler);





Prototype  uint8_t app_mqtt_connect(int8_t * client_ID,int8_t * mqtt_user,int8_t *mqtt_pswd,void (*callback)(uint32_t sock_no, uint8_t *buffer, uint32_t length))
Input Arguments

client_ID : Unique MQTT Client ID

mqtt_user : Username for the login credentials of MQTT server

mqtt_pswd : Password for the login credentials of MQTT server

void (*callback)(uint32_t sock_no, uint8_t *buffer, uint32_t length) : Callback handler

Return Value

status :   0    -    success

              <0   -   failure

Description Connects to the MQTT Broker/Server.
Example Usage

status = app_mqtt_connect(client_ID, mqtt_user,mqtt_pswd,callback_handler);



Prototype rsi_mqtt_client_info_t *  app_mqtt_client_init(int8_t * buffer,uint32_t length,int8_t * server_ip,uint32_t server_port,uint32_t client_port)
Input Arguments

buffer : Buffer pointer to allocate memory for MQTT Client information

length : Buffer length

server_ip : IP address of MQTT broker

server_port : MQTT broker/server port number

client_port : client port number

Return Value

MQTT client information structure pointer -    success

NULL - failure

Description Initializes MQTT.
Example Usage