35 lines
780 B
C
35 lines
780 B
C
#ifndef WLAN_H
|
|
#define WLAN_H
|
|
|
|
#include "config.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);
|
|
|
|
size_t construct_json(float *data, char *buffer, int buffer_size);
|
|
|
|
void mqtt_transfer(float *data);
|
|
|
|
#endif /* WLAN_H */
|