#include "configuration.h"
#include "RequestPrimitive.h"
#include "ResponsePrimitive.h"
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
Go to the source code of this file.
◆ mqtt_callback()
| void mqtt_callback |
( |
char * |
topic, |
|
|
byte * |
payload, |
|
|
unsigned int |
length |
|
) |
| |
Callback to use when a new MQTT message is received
- Parameters
-
| topic | - the topic of the received message |
| payload | - of the message |
| lenght | - of the message |
This is used for MQTT setup and subscription
◆ mqtt_reconnect()
| void mqtt_reconnect |
( |
WiFiClientSecure * |
espClient, |
|
|
PubSubClient * |
client, |
|
|
bool |
loop = true |
|
) |
| |
Reconnect to the MQTT broker
- Parameters
-
| client | - PubSubClient (mqtt) used to publish and subscribe to topics on the broker |
| espClient | used for the TCP connection |
| loop | - enables to try only once to reconnect or to loop until it is connected Default is keep looping until connected. Used when connection is lost and will lock the process into reconnection phase until it succeeds (if loop set to true or not set at all) |
◆ mqtt_send_request()
Send a request over MQTTS
- Parameters
-
| client | - MQTT client to use |
| req | - request primitive to serialize and to send over mqtt |
| topic | - mqtt topic structure containing elements to build the topic to publish to |
◆ mqtt_send_response()
Send a response over MQTTS
- Parameters
-
| client | - MQTT client to use |
| resp | - response primitive to serialize and to send over mqtt |
| topic | - mqtt topic structure containing elements to build the topic to publish to |
◆ mqtt_setup()
| bool mqtt_setup |
( |
WiFiClientSecure * |
espClient | ) |
|
Perform all the setup for MQTTS binding
- load CA
- load device cert
- load private key
- Parameters
-
| espClient | used for secure connection establishment |
◆ MQTT_CLIENT
| PubSubClient* MQTT_CLIENT |
|
extern |