AWS IoT for ESP32 v1.0.0
An ESP-IDF based solution
lib_mqtt.h
Go to the documentation of this file.
1
6#ifndef _LIB_MQTT_H_
7#define _LIB_MQTT_H_
8
9/*-------------------- Includes -----------------------*/
10#include "lib_config.h"
11#include "lib_msg.h"
12#include "stdutils.h"
13
18typedef enum
19{
25 STATE_MQTT_MAX,
27
32typedef enum
33{
34 MQTT_OKAY,
35 MQTT_READ_EMPTY,
36 MQTT_WRITE_FULL,
37 MQTT_ERROR_MAX,
39
43typedef struct
44{
45 char *pUriStr;
46 char *pCertStr;
50
58bool MQTT_init(mqttConfig_st *ps_config);
59
66void MQTT_sync();
67
76
85
94
103bool MQTT_subscribe(char *pTopicStr, uint8_t qos_e);
104
113
121
129bool MQTT_read(mqttMsg_st *ps_msg);
130
137
138#endif
Configuration header file.
bool MQTT_isStarted()
Check if MQTT is initialized and has started.
bool MQTT_subscribe(char *pTopicStr, uint8_t qos_e)
Subscribe to a give topic.
bool MQTT_isConnected()
Check if MQTT is connected to broker.
bool MQTT_close()
Close and terminate MQTT connection.
bool MQTT_init(mqttConfig_st *ps_config)
Initialize MQTT library with given MQTT configuration.
mqttStates_et
Definition: lib_mqtt.h:19
@ STATE_MQTT_DISCONNECTED
Definition: lib_mqtt.h:22
@ STATE_MQTT_IDLE
Definition: lib_mqtt.h:20
@ STATE_MQTT_START
Definition: lib_mqtt.h:21
@ STATE_MQTT_ABORT
Definition: lib_mqtt.h:24
@ STATE_MQTT_CONNECTED
Definition: lib_mqtt.h:23
bool MQTT_read(mqttMsg_st *ps_msg)
Read the received message received.
void MQTT_printStatus()
Print the status of MQTT library.
mqttWrtStatus_et
Definition: lib_mqtt.h:33
void MQTT_sync()
Run MQTT library, this function should be called periodically by the application.
uint8_t MQTT_availableToRead()
Check is messages are available on subsribed topics. The library maintains a buffer to store received...
bool MQTT_publish(mqttMsg_st *ps_msg)
Publish a given message.
MQTT message header file.
MQTT configuration structure.
Definition: lib_mqtt.h:44
char * pUserNameStr
Definition: lib_mqtt.h:47
char * pPasswordStr
Definition: lib_mqtt.h:48
char * pCertStr
Definition: lib_mqtt.h:46
char * pUriStr
Definition: lib_mqtt.h:45
Structure to represent MQTT message.
Definition: lib_msg.h:48