Replace the MQTT client with a robust async option
This commit is contained in:
@@ -2,14 +2,33 @@
|
||||
#define WLAN_H
|
||||
|
||||
#include "config.h"
|
||||
#include <PubSubClient.h>
|
||||
#include <AsyncMqttClient.h>
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <Ticker.h>
|
||||
|
||||
static AsyncMqttClient mqtt_client;
|
||||
static Ticker mqtt_connection_timer, wlan_connection_timer;
|
||||
static WiFiEventHandler connection_handler, disconnection_handler;
|
||||
extern Config *config;
|
||||
|
||||
void initialize_wlan();
|
||||
|
||||
void initialize_mqtt();
|
||||
|
||||
void connect_wlan();
|
||||
|
||||
void connect_mqtt();
|
||||
|
||||
void on_wlan_connection(const WiFiEventStationModeGotIP &event);
|
||||
|
||||
void on_wlan_disconnection(const WiFiEventStationModeDisconnected &event);
|
||||
|
||||
void on_mqtt_connection(bool session);
|
||||
|
||||
void on_mqtt_disconnection(AsyncMqttClientDisconnectReason reason);
|
||||
|
||||
void initial_connection(const char *ssid, const char *psk,
|
||||
const char *hostname);
|
||||
void connect_wlan(Config *config);
|
||||
void connect_mqtt(PubSubClient &client, Config *config);
|
||||
void disconnect_mqtt(PubSubClient &client, const char *topic);
|
||||
size_t construct_json(float *data, char *buffer, int buffer_size);
|
||||
void mqtt_transfer(PubSubClient &client, Config *config, float *data);
|
||||
|
||||
void mqtt_transfer(float *data);
|
||||
|
||||
#endif /* WLAN_H */
|
||||
|
||||
Reference in New Issue
Block a user