The ESP-AT MQTT library project
A simple wrapper to the MQTT functionality found in the ESP-AT interpreter
EspATMQTT.h
Go to the documentation of this file.
1 /*
2  * ----------------------------------------------------------------------------
3  * _ _ _
4  * (_) | | |
5  * _| | __ _| |__ ___
6  * | | | / _` | '_ \/ __|
7  * | | |___| (_| | |_) \__ \
8  * |_|______\__,_|_.__/|___/
9  *
10  * ----------------------------------------------------------------------------
11  Copyright (c) 2022 iLabs - Pontus Oldberg
12 
13  Permission is hereby granted, free of charge, to any person obtaining a copy
14  of this software and associated documentation files (the "Software"), to deal
15  in the Software without restriction, including without limitation the rights
16  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17  copies of the Software, and to permit persons to whom the Software is
18  furnished to do so, subject to the following conditions:
19 
20  The above copyright notice and this permission notice shall be included in all
21  copies or substantial portions of the Software.
22 
23  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29  SOFTWARE.
30  * ----------------------------------------------------------------------------
31  */
32 
35 #ifndef _H_ESPATMQTT_
36 #define _H_ESPATMQTT_
37 
38 #include <inttypes.h>
39 #include <AT.h>
40 
41 #define MQTT_BUFFER_SIZE 1024
42 
57 };
58 typedef enum mqtt_scheme_e mqtt_scheme_t;
59 
76  AT_MQTT_NULL_LINK = 0x6006,
154 };
155 
164  AT_MQTT_DO_NOT_RETAIN = 0,
165  AT_MQTT_RETAIN = 1
166 };
167 
171 typedef enum mqtt_connectType_e {
173  AT_CONN_SYNCH = 0x1001,
174  AT_CONN_ASYNCH = 0x1002
176 
177 #define MQTT_ERROR(x) (x & 0xffff)
178 
179 #define DEFAULT_LINK_ID 0
185 typedef void (*subscription_cb_t)(char *topic, char *mqttdata);
186 
190 typedef void (*validDateTime_cb_t)(char *dateTime);
195 typedef void (*connected_cb_t)(char *connectionString);
196 
202 typedef uint32_t mqtt_status_t;
203 
204 
207 class EspATMQTT {
208 public:
209  EspATMQTT(HardwareSerial* = &ESP_SERIAL_PORT);
210 
212  mqtt_status_t userConfig(uint32_t linkID, mqtt_scheme_t scheme, const char *clientID,
213  const char *userName="", const char *password="",
214  uint32_t certKeyID=0, uint32_t caID=0,
215  const char *path="");
216  mqtt_status_t userConfig(uint32_t linkID, mqtt_scheme_t scheme, char *clientID,
217  const char *userName="", const char *password="",
218  uint32_t certKeyID=0, uint32_t caID=0,
219  const char *path="");
220  mqtt_status_t userConfig(uint32_t linkID, mqtt_scheme_t scheme, char *clientID,
221  char *userName, char *password, uint32_t certKeyID=0,
222  uint32_t caID=0, const char *path="");
223  mqtt_status_t connect(uint32_t linkID, const char *host,
224  uint32_t port=1883, uint32_t reconnect=0,
225  uint32_t timeout = 5000, connected_cb_t cb = NULL);
226  mqtt_status_t setClientID(uint32_t linkID, const char *clientID);
227  mqtt_status_t setClientID(uint32_t linkID, char *clientID);
228  mqtt_status_t setUsername(uint32_t linkID, const char *username);
229  mqtt_status_t setUsername(uint32_t linkID, char *username);
230  mqtt_status_t setPassword(uint32_t linkID, const char *password);
231  mqtt_status_t setPassword(uint32_t linkID, char *password);
232  mqtt_status_t connectionConfig(uint32_t linkID, uint32_t keepalive,
233  uint32_t disable_clean_session, const char* lwt_topic,
234  const char* lwt_message, uint32_t lwt_qos = 0,
235  uint32_t lwt_retain = 0);
236  mqtt_status_t setALPN(uint32_t linkID, const char *alpn1 = NULL,
237  const char *alpn2 = NULL,
238  const char *alpn3 = NULL,
239  const char *alpn4 = NULL,
240  const char *alpn5 = NULL);
241  mqtt_status_t pubString(uint32_t linkID, const char *topic, const char *data,
242  uint32_t qos=0, uint32_t retain=0);
243  mqtt_status_t pubString(uint32_t linkID, const char *topic, char *data,
244  uint32_t qos=0, uint32_t retain=0);
245  mqtt_status_t pubRaw(uint32_t linkID, const char *topic, const char *data,
246  uint32_t qos=0, uint32_t retain=0);
247  mqtt_status_t pubRaw(uint32_t linkID, const char *topic, char *data,
248  uint32_t qos=0, uint32_t retain=0);
249  mqtt_status_t subscribeTopic(subscription_cb_t cb, uint32_t linkID, const char * topic, uint32_t qos=0);
250  mqtt_status_t subscribeTopic(subscription_cb_t cb, uint32_t linkID, char * topic, uint32_t qos=0);
251  mqtt_status_t unSubscribeTopic(uint32_t linkID, const char * topic);
252  mqtt_status_t unSubscribeTopic(uint32_t linkID, char * topic);
253  mqtt_status_t close(uint32_t linkID);
254 
255  // Non MQTT stuff but needed or usefull to get things going
256  mqtt_status_t enableNTPTime(bool enable, validDateTime_cb_t cb, uint32_t timezone,
257  const char *ts1 = NULL, const char *ts2 = NULL,
258  const char *ts3 = NULL);
259  mqtt_status_t getNTPTime(char **time);
260  bool isConnected();
261  void process();
262 private:
263  AT_Class *at;
264  subscription_cb_t subscription_cb;
265  validDateTime_cb_t validDateTime_cb;
266  mqtt_connectType_t connType;
267  connected_cb_t connected_cb;
268 
269  int topicSubscriptions;
270  bool connected;
271  bool ntpTimeValid;
272 
273  char buff[MQTT_BUFFER_SIZE];
274 };
275 
276 #endif
AT_MQTT_CLIENT_ID_IS_OVERLENGTH
@ AT_MQTT_CLIENT_ID_IS_OVERLENGTH
The client ID is to long.
Definition: EspATMQTT.h:92
AT_MQTT_LWT_QOS_VALUE_IS_WRONG
@ AT_MQTT_LWT_QOS_VALUE_IS_WRONG
Incorrect LWT QoS value specified.
Definition: EspATMQTT.h:125
AT_CONN_SYNCH
@ AT_CONN_SYNCH
MQTT server has connected synchronously.
Definition: EspATMQTT.h:173
AT_MQTT_CLIENT_UNSUBSCRIBE_FAILED
@ AT_MQTT_CLIENT_UNSUBSCRIBE_FAILED
Failed to unsubscribe from topic.
Definition: EspATMQTT.h:84
EspATMQTT::pubString
mqtt_status_t pubString(uint32_t linkID, const char *topic, const char *data, uint32_t qos=0, uint32_t retain=0)
Publish a string to a specified topic.
Definition: EspATMQTT.cpp:705
AT_MQTT_PARAM_PREPARE_ERROR
@ AT_MQTT_PARAM_PREPARE_ERROR
?
Definition: EspATMQTT.h:80
AT_MQTT_NULL_PARAMTER
@ AT_MQTT_NULL_PARAMTER
A NULL parameter was found when valid data was expected.
Definition: EspATMQTT.h:77
AT_MQTT_LWT_QOS_READ_FAILED
@ AT_MQTT_LWT_QOS_READ_FAILED
Failed to read LWT QoS parameter.
Definition: EspATMQTT.h:124
AT_MQTT_USERNAME_READ_FAILED
@ AT_MQTT_USERNAME_READ_FAILED
Failed to read the user name.
Definition: EspATMQTT.h:93
AT_MQTT_NULL_LINK
@ AT_MQTT_NULL_LINK
?
Definition: EspATMQTT.h:76
AT_MQTT_SCHEME_READ_FAILED
@ AT_MQTT_SCHEME_READ_FAILED
Failed to read the security scheme used.
Definition: EspATMQTT.h:88
AT_MQTT_VERSION_READ_FAILED
@ AT_MQTT_VERSION_READ_FAILED
Failed to read version.
Definition: EspATMQTT.h:112
AT_MQTT_PATH_READ_FAILED
@ AT_MQTT_PATH_READ_FAILED
Failed to read from path.
Definition: EspATMQTT.h:109
AT_CONN_ASYNCH
@ AT_CONN_ASYNCH
MQTT server has not connected yet and is awaiting a connection callback.
Definition: EspATMQTT.h:174
EspATMQTT::EspATMQTT
EspATMQTT(HardwareSerial *=&ESP_SERIAL_PORT)
The module constructor allows you to select what serial port that should be used to communicate with ...
Definition: EspATMQTT.cpp:72
AT_MQTT_KEY_READ_FAILED
@ AT_MQTT_KEY_READ_FAILED
Failed to read client key.
Definition: EspATMQTT.h:108
AT_MQTT_DATA_READ_FAILED
@ AT_MQTT_DATA_READ_FAILED
Failed to read message.
Definition: EspATMQTT.h:138
AT_MQTT_CLIENT_ID_READ_FAILED
@ AT_MQTT_CLIENT_ID_READ_FAILED
Failed to read the client ID.
Definition: EspATMQTT.h:90
AT_MQTT_LWT_TOPIC_IS_OVERLENGTH
@ AT_MQTT_LWT_TOPIC_IS_OVERLENGTH
LWT topic is to long.
Definition: EspATMQTT.h:120
AT_MQTT_NOT_IN_CONFIGURED_STATE
@ AT_MQTT_NOT_IN_CONFIGURED_STATE
MQTT layer not in a configured state (same as above ?)
Definition: EspATMQTT.h:72
AT_MQTT_LWT_MSG_READ_FAILED
@ AT_MQTT_LWT_MSG_READ_FAILED
Failed to read LWT message.
Definition: EspATMQTT.h:121
AT_MQTT_TOPIC_READ_FAILED
@ AT_MQTT_TOPIC_READ_FAILED
Failed to read topic parameter.
Definition: EspATMQTT.h:135
AT_MQTT_CERT_LENGTH_ERROR
@ AT_MQTT_CERT_LENGTH_ERROR
Incorrect client certificate length.
Definition: EspATMQTT.h:105
AT_MQTT_TOPIC_IS_OVERLENGTH
@ AT_MQTT_TOPIC_IS_OVERLENGTH
Failed to set topic, to long.
Definition: EspATMQTT.h:137
mqtt_retain_e
mqtt_retain_e
A retained message is a normal MQTT message with the retained flag set to true.
Definition: EspATMQTT.h:163
AT_MQTT_LWT_MSG_IS_NULL
@ AT_MQTT_LWT_MSG_IS_NULL
LWT message can not be set to NULL.
Definition: EspATMQTT.h:122
AT_MQTT_CREATE_SEMA_FAILED
@ AT_MQTT_CREATE_SEMA_FAILED
Internal error, failed to create semaphore.
Definition: EspATMQTT.h:148
ESP_MQTT_SCHEME_MQTT_OVER_WS_TCP_SEC_TLS_NCV
@ ESP_MQTT_SCHEME_MQTT_OVER_WS_TCP_SEC_TLS_NCV
MQTT over WebSocket Secure (based on TLS, no certificate verification).
Definition: EspATMQTT.h:53
AT_MQTT_PUBLISH_LENGTH_READ_FAILED
@ AT_MQTT_PUBLISH_LENGTH_READ_FAILED
Failed to read publish length parameter.
Definition: EspATMQTT.h:145
AT_MQTT_PUBLISH_LENGTH_VALUE_IS_WRONG
@ AT_MQTT_PUBLISH_LENGTH_VALUE_IS_WRONG
Failed to set published length value.
Definition: EspATMQTT.h:146
ESP_MQTT_SCHEME_MQTT_OVER_TLS_NCV
@ ESP_MQTT_SCHEME_MQTT_OVER_TLS_NCV
MQTT over TLS (no certificate verification).
Definition: EspATMQTT.h:48
ESP_MQTT_SCHEME_MQTT_OVER_WS_TCP_SEC_TLS_VSC
@ ESP_MQTT_SCHEME_MQTT_OVER_WS_TCP_SEC_TLS_VSC
MQTT over WebSocket Secure (based on TLS, verify server certificate).
Definition: EspATMQTT.h:54
mqtt_error_e
mqtt_error_e
The caller should use these error codes to determine the cause of an MQTT error.
Definition: EspATMQTT.h:70
AT_MQTT_KEEPALIVE_READ_FAILED
@ AT_MQTT_KEEPALIVE_READ_FAILED
Failed to read keepalive value.
Definition: EspATMQTT.h:113
AT_MQTT_TLS_CONFIG_ERROR
@ AT_MQTT_TLS_CONFIG_ERROR
Something is wrong with the TLS configuration.
Definition: EspATMQTT.h:79
AT_MQTT_NO_CONFIGURED
@ AT_MQTT_NO_CONFIGURED
MQTT layer not configured yet.
Definition: EspATMQTT.h:71
AT_MQTT_LINK_ID_READ_FAILED
@ AT_MQTT_LINK_ID_READ_FAILED
Failed to read the link ID.
Definition: EspATMQTT.h:86
AT_MQTT_IN_DISCONNECTED_STATE
@ AT_MQTT_IN_DISCONNECTED_STATE
MQTT is in disconnected state.
Definition: EspATMQTT.h:151
mqtt_connectType_e
mqtt_connectType_e
Definition: EspATMQTT.h:171
AT_MQTT_DISABLE_CLEAN_SESSION_READ_FAILED
@ AT_MQTT_DISABLE_CLEAN_SESSION_READ_FAILED
Failed to read the clean session parameter.
Definition: EspATMQTT.h:116
AT_MQTT_QOS_VALUE_IS_WRONG
@ AT_MQTT_QOS_VALUE_IS_WRONG
Incorrect QoS value specified.
Definition: EspATMQTT.h:142
mqtt_status_t
uint32_t mqtt_status_t
The return value of an ESP-AT MQTT operation.
Definition: EspATMQTT.h:202
AT_MQTT_CERT_READ_FAILED
@ AT_MQTT_CERT_READ_FAILED
Failed to read client certificate.
Definition: EspATMQTT.h:106
AT_MQTT_FAILED_TO_PUBLISH_RAW
@ AT_MQTT_FAILED_TO_PUBLISH_RAW
Failed to publish raw data.
Definition: EspATMQTT.h:153
connected_cb_t
void(* connected_cb_t)(char *connectionString)
Definition: EspATMQTT.h:195
EspATMQTT::getNTPTime
mqtt_status_t getNTPTime(char **time)
Get the current time from the ESP-AT internal NTP Client.
Definition: EspATMQTT.cpp:1171
EspATMQTT::setUsername
mqtt_status_t setUsername(uint32_t linkID, const char *username)
Sets the username used in authenticating the client with the broker.
Definition: EspATMQTT.cpp:365
AT_MQTT_USERNAME_IS_OVERLENGTH
@ AT_MQTT_USERNAME_IS_OVERLENGTH
The user name is to long.
Definition: EspATMQTT.h:95
AT_MQTT_LWT_TOPIC_READ_FAILED
@ AT_MQTT_LWT_TOPIC_READ_FAILED
Failed to read the lwt topic.
Definition: EspATMQTT.h:118
AT_MQTT_HOST_IS_OVERLENGTH
@ AT_MQTT_HOST_IS_OVERLENGTH
Host value to long.
Definition: EspATMQTT.h:130
EspATMQTT::connect
mqtt_status_t connect(uint32_t linkID, const char *host, uint32_t port=1883, uint32_t reconnect=0, uint32_t timeout=5000, connected_cb_t cb=NULL)
Connects to the specified server/broker with the previously defined transport scheme.
Definition: EspATMQTT.cpp:637
AT_MQTT_KEEPALIVE_IS_NULL
@ AT_MQTT_KEEPALIVE_IS_NULL
Keepalive value must not be NULL.
Definition: EspATMQTT.h:114
AT_MQTT_LINK_ID_VALUE_IS_WRONG
@ AT_MQTT_LINK_ID_VALUE_IS_WRONG
Wrong link ID value was used.
Definition: EspATMQTT.h:87
AT_MQTT_HOST_READ_FAILED
@ AT_MQTT_HOST_READ_FAILED
Failed to read host parameter.
Definition: EspATMQTT.h:128
AT_MQTT_UNINITIATED_OR_ALREADY_CLEAN
@ AT_MQTT_UNINITIATED_OR_ALREADY_CLEAN
Tried to perform clean when the MQTT layer was already clean.
Definition: EspATMQTT.h:73
AT_MQTT_CLIENT_SUBSCRIBE_FAILED
@ AT_MQTT_CLIENT_SUBSCRIBE_FAILED
Failed to subscribe to topic at broker.
Definition: EspATMQTT.h:83
AT_MQTT_RECV_LENGTH_IS_WRONG
@ AT_MQTT_RECV_LENGTH_IS_WRONG
Incorrect receive length is specified.
Definition: EspATMQTT.h:147
AT_MQTT_PASSWORD_READ_FAILED
@ AT_MQTT_PASSWORD_READ_FAILED
Failed to read the password.
Definition: EspATMQTT.h:96
AT_MQTT_PASSWORD_IS_NULL
@ AT_MQTT_PASSWORD_IS_NULL
The password can't be NULL.
Definition: EspATMQTT.h:97
AT_MQTT_CREATE_EVENT_GROUP_FAILED
@ AT_MQTT_CREATE_EVENT_GROUP_FAILED
Internal error, failed to create event group.
Definition: EspATMQTT.h:149
AT_MQTT_TOPIC_IS_NULL
@ AT_MQTT_TOPIC_IS_NULL
Failed to set topic, can't be NULL.
Definition: EspATMQTT.h:136
ESP_MQTT_SCHEME_MQTT_OVER_WS_TCP_SEC_TLS_VSCPCC
@ ESP_MQTT_SCHEME_MQTT_OVER_WS_TCP_SEC_TLS_VSCPCC
MQTT over WebSocket Secure (based on TLS, verify server certificate and provide client certificate).
Definition: EspATMQTT.h:56
AT_MQTT_CLIENT_ID_IS_NULL
@ AT_MQTT_CLIENT_ID_IS_NULL
The client ID can't be NULL.
Definition: EspATMQTT.h:91
EspATMQTT::process
void process()
The process method must be placed in the main loop in order to process MQTT events that are reported ...
Definition: EspATMQTT.cpp:1193
EspATMQTT::enableNTPTime
mqtt_status_t enableNTPTime(bool enable, validDateTime_cb_t cb, uint32_t timezone, const char *ts1=NULL, const char *ts2=NULL, const char *ts3=NULL)
Enables the internal NTP Time client.
Definition: EspATMQTT.cpp:1124
AT_MQTT_CERT_KEY_ID_READ_FAILED
@ AT_MQTT_CERT_KEY_ID_READ_FAILED
The cert key ID could not be read.
Definition: EspATMQTT.h:99
ESP_MQTT_SCHEME_MQTT_OVER_WS_TCP_SEC_TLS_PCC
@ ESP_MQTT_SCHEME_MQTT_OVER_WS_TCP_SEC_TLS_PCC
MQTT over WebSocket Secure (based on TLS, provide client certificate).
Definition: EspATMQTT.h:55
AT_MQTT_DATA_IS_NULL
@ AT_MQTT_DATA_IS_NULL
Incorrect message specified, can't be NULL.
Definition: EspATMQTT.h:139
AT_MQTT_RECONNECT_READ_FAILED
@ AT_MQTT_RECONNECT_READ_FAILED
Failed to read reconnect parameter.
Definition: EspATMQTT.h:133
AT_MQTT_URI_PARSE_FAILED
@ AT_MQTT_URI_PARSE_FAILED
Internal error, failed to parse URI.
Definition: EspATMQTT.h:150
AT_MQTT_CA_ID_READ_FAILED
@ AT_MQTT_CA_ID_READ_FAILED
The CA ID could not be read.
Definition: EspATMQTT.h:101
AT_MQTT_CERT_KEY_ID_VALUE_IS_WRONG
@ AT_MQTT_CERT_KEY_ID_VALUE_IS_WRONG
The cert key ID is incorrect.
Definition: EspATMQTT.h:100
AT_MQTT_DATA_IS_OVERLENGTH
@ AT_MQTT_DATA_IS_OVERLENGTH
Message to long.
Definition: EspATMQTT.h:140
AT_MQTT_USERNAME_IS_NULL
@ AT_MQTT_USERNAME_IS_NULL
The user name can't be NULL.
Definition: EspATMQTT.h:94
EspATMQTT::begin
mqtt_status_t begin()
The begin method initializes the system before usage.
Definition: EspATMQTT.cpp:85
mqtt_scheme_e
mqtt_scheme_e
MQTT configuration schemes.
Definition: EspATMQTT.h:46
AT_MQTT_PORT_VALUE_IS_WRONG
@ AT_MQTT_PORT_VALUE_IS_WRONG
Port value is incorrect.
Definition: EspATMQTT.h:132
AT_MQTT_MALLOC_FAILED
@ AT_MQTT_MALLOC_FAILED
Failed to allocate memory internally.
Definition: EspATMQTT.h:75
AT_MQTT_CLIENT_START_FAILED
@ AT_MQTT_CLIENT_START_FAILED
Failed to start MQTT client.
Definition: EspATMQTT.h:81
AT_MQTT_CLIENT_DISCONNECT_FAILED
@ AT_MQTT_CLIENT_DISCONNECT_FAILED
Failed to disconnect from the broker.
Definition: EspATMQTT.h:85
EspATMQTT::connectionConfig
mqtt_status_t connectionConfig(uint32_t linkID, uint32_t keepalive, uint32_t disable_clean_session, const char *lwt_topic, const char *lwt_message, uint32_t lwt_qos=0, uint32_t lwt_retain=0)
Sets the configuration of the current MQTT connection.
Definition: EspATMQTT.cpp:495
mqtt_connectType_t
enum mqtt_connectType_e mqtt_connectType_t
AT_MQTT_CA_ID_VALUE_IS_WRONG
@ AT_MQTT_CA_ID_VALUE_IS_WRONG
The CA ID value is incorrect.
Definition: EspATMQTT.h:102
EspATMQTT::isConnected
bool isConnected()
Checks to see if the mqtt client is connected and returns true if it is.
Definition: EspATMQTT.cpp:1182
AT_MQTT_SCHEME_VALUE_IS_WRONG
@ AT_MQTT_SCHEME_VALUE_IS_WRONG
Incorrect scheme value was used.
Definition: EspATMQTT.h:89
ESP_MQTT_SCHEME_MQTT_OVER_TLS_PCC
@ ESP_MQTT_SCHEME_MQTT_OVER_TLS_PCC
MQTT over TLS (provide client certificate).
Definition: EspATMQTT.h:50
ESP_MQTT_SCHEME_MQTT_OVER_TLS_VSCPCC
@ ESP_MQTT_SCHEME_MQTT_OVER_TLS_VSCPCC
MQTT over TLS (verify server certificate and provide client certificate).
Definition: EspATMQTT.h:51
AT_MQTT_LWT_RETAIN_READ_FAILED
@ AT_MQTT_LWT_RETAIN_READ_FAILED
Failed to read LWT retain parameter.
Definition: EspATMQTT.h:126
AT_MQTT_LWT_TOPIC_IS_NULL
@ AT_MQTT_LWT_TOPIC_IS_NULL
LWT topic can not be set to NULL.
Definition: EspATMQTT.h:119
AT_Class
EspAT MQTT AT_Class definition.
Definition: AT.h:90
ESP_MQTT_SCHEME_MQTT_OVER_TLS_VSC
@ ESP_MQTT_SCHEME_MQTT_OVER_TLS_VSC
MQTT over TLS (verify server certificate).
Definition: EspATMQTT.h:49
EspATMQTT
EspAT MQTT EspATMQTT class definition.
Definition: EspATMQTT.h:207
AT_MQTT_LWT_MSG_IS_OVERLENGTH
@ AT_MQTT_LWT_MSG_IS_OVERLENGTH
LWT message is to long.
Definition: EspATMQTT.h:123
AT_MQTT_PASSWORD_IS_OVERLENGTH
@ AT_MQTT_PASSWORD_IS_OVERLENGTH
The password is to long.
Definition: EspATMQTT.h:98
AT_MQTT_PARAMETER_COUNTS_IS_WRONG
@ AT_MQTT_PARAMETER_COUNTS_IS_WRONG
The number of parameters is incorrect.
Definition: EspATMQTT.h:78
EspATMQTT::unSubscribeTopic
mqtt_status_t unSubscribeTopic(uint32_t linkID, const char *topic)
Unsubscribe from messages with a specific topic.
Definition: EspATMQTT.cpp:1012
EspATMQTT::setALPN
mqtt_status_t setALPN(uint32_t linkID, const char *alpn1=NULL, const char *alpn2=NULL, const char *alpn3=NULL, const char *alpn4=NULL, const char *alpn5=NULL)
This function sets the ALPN (Application Layer Protocol Negotiation) of the link.
Definition: EspATMQTT.cpp:539
EspATMQTT::setPassword
mqtt_status_t setPassword(uint32_t linkID, const char *password)
Sets the password used in authenticating the client with the broker.
Definition: EspATMQTT.cpp:421
AT_MQTT_CLIENT_PUBLISH_FAILED
@ AT_MQTT_CLIENT_PUBLISH_FAILED
Failed to publish data to broker.
Definition: EspATMQTT.h:82
AT_MQTT_HOST_IS_NULL
@ AT_MQTT_HOST_IS_NULL
Failed to set host, value can not be NULL.
Definition: EspATMQTT.h:129
EspATMQTT::setClientID
mqtt_status_t setClientID(uint32_t linkID, const char *clientID)
Sets a new client ID for the connection.
Definition: EspATMQTT.cpp:310
AT_MQTT_PATH_IS_OVERLENGTH
@ AT_MQTT_PATH_IS_OVERLENGTH
The path length is to long.
Definition: EspATMQTT.h:111
AT.h
AT_MQTT_PATH_IS_NULL
@ AT_MQTT_PATH_IS_NULL
The path must not be NULL.
Definition: EspATMQTT.h:110
ESP_MQTT_SCHEME_MQTT_OVER_TCP
@ ESP_MQTT_SCHEME_MQTT_OVER_TCP
MQTT over plain TCP.
Definition: EspATMQTT.h:47
AT_MQTT_PORT_READ_FAILED
@ AT_MQTT_PORT_READ_FAILED
Failed to read port parameter.
Definition: EspATMQTT.h:131
EspATMQTT::subscribeTopic
mqtt_status_t subscribeTopic(subscription_cb_t cb, uint32_t linkID, const char *topic, uint32_t qos=0)
Subscribe to messages from a specific topic.
Definition: EspATMQTT.cpp:939
AT_MQTT_KEY_LENGTH_ERROR
@ AT_MQTT_KEY_LENGTH_ERROR
Incorrect client key length.
Definition: EspATMQTT.h:107
validDateTime_cb_t
void(* validDateTime_cb_t)(char *dateTime)
Definition: EspATMQTT.h:190
AT_CONN_UNCONNECTED
@ AT_CONN_UNCONNECTED
MQTT server still in its unconnected state.
Definition: EspATMQTT.h:172
AT_MQTT_RECONNECT_VALUE_IS_WRONG
@ AT_MQTT_RECONNECT_VALUE_IS_WRONG
Incorrect reconnect value specified.
Definition: EspATMQTT.h:134
EspATMQTT::pubRaw
mqtt_status_t pubRaw(uint32_t linkID, const char *topic, const char *data, uint32_t qos=0, uint32_t retain=0)
Publish raw data to a specified topic.
Definition: EspATMQTT.cpp:810
AT_MQTT_ALREADY_CONNECTED
@ AT_MQTT_ALREADY_CONNECTED
Tried to connect when already connected.
Definition: EspATMQTT.h:74
ESP_MQTT_SCHEME_MQTT_OVER_WS_TCP
@ ESP_MQTT_SCHEME_MQTT_OVER_WS_TCP
MQTT over WebSocket (based on TCP).
Definition: EspATMQTT.h:52
AT_MQTT_CA_LENGTH_ERROR
@ AT_MQTT_CA_LENGTH_ERROR
The CA length is incorrect.
Definition: EspATMQTT.h:103
EspATMQTT::userConfig
mqtt_status_t userConfig(uint32_t linkID, mqtt_scheme_t scheme, const char *clientID, const char *userName="", const char *password="", uint32_t certKeyID=0, uint32_t caID=0, const char *path="")
Setup the connection scheme and how to connect to the server/broker.
Definition: EspATMQTT.cpp:165
AT_MQTT_DISABLE_CLEAN_SESSION_VALUE_IS_WRONG
@ AT_MQTT_DISABLE_CLEAN_SESSION_VALUE_IS_WRONG
Incorrect value of the clean session value.
Definition: EspATMQTT.h:117
AT_MQTT_KEEPALIVE_VALUE_IS_WRONG
@ AT_MQTT_KEEPALIVE_VALUE_IS_WRONG
Keepalive value is incorrect.
Definition: EspATMQTT.h:115
AT_MQTT_RETAIN_VALUE_IS_WRONG
@ AT_MQTT_RETAIN_VALUE_IS_WRONG
Incorrect retain value specified.
Definition: EspATMQTT.h:144
AT_MQTT_LWT_RETAIN_VALUE_IS_WRONG
@ AT_MQTT_LWT_RETAIN_VALUE_IS_WRONG
Incorrect LWT value specified.
Definition: EspATMQTT.h:127
subscription_cb_t
void(* subscription_cb_t)(char *topic, char *mqttdata)
Definition: EspATMQTT.h:185
AT_MQTT_CA_READ_FAILED
@ AT_MQTT_CA_READ_FAILED
Failed to read the CA.
Definition: EspATMQTT.h:104
AT_MQTT_HOSTNAME_VERIFY_FAILED
@ AT_MQTT_HOSTNAME_VERIFY_FAILED
Hostname lookup failed.
Definition: EspATMQTT.h:152
AT_MQTT_QOS_READ_FAILED
@ AT_MQTT_QOS_READ_FAILED
Failed to read QoS parameter.
Definition: EspATMQTT.h:141
AT_MQTT_RETAIN_READ_FAILED
@ AT_MQTT_RETAIN_READ_FAILED
Failed to read retain parameter.
Definition: EspATMQTT.h:143
EspATMQTT::close
mqtt_status_t close(uint32_t linkID)
Close (all) conection/s with the specified link ID.
Definition: EspATMQTT.cpp:1067