#ifndef WLAN_H
#define WLAN_H

#include "config.h"
#include <AsyncMqttClient.h>
#include <Ticker.h>
#include <WiFi.h>

static AsyncMqttClient mqtt_client;
static Ticker mqtt_connection_timer, wlan_connection_timer;
extern Config *config;

void initialize_wlan();

void initialize_mqtt();

void connect_wlan();

void connect_mqtt();

void wlan_connection_handler(WiFiEvent_t 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 */
