2023-03-30 01:28:31 +02:00
|
|
|
#ifndef WLAN_H
|
|
|
|
#define WLAN_H
|
|
|
|
|
2023-04-03 03:26:12 +02:00
|
|
|
#include <ESP8266WiFi.h>
|
|
|
|
#include <PubSubClient.h>
|
|
|
|
|
|
|
|
const int SLEEP_TIME = 900000000;
|
2023-03-30 01:28:31 +02:00
|
|
|
const int WIFI_TIMEOUT = 10000;
|
|
|
|
|
2023-04-03 03:26:12 +02:00
|
|
|
void initial_connection();
|
|
|
|
void connect_wlan(const int max_retries);
|
|
|
|
void connect_mqtt(PubSubClient &client, const char *device_id,
|
2023-04-03 06:23:03 +02:00
|
|
|
const char *topic);
|
|
|
|
void disconnect_mqtt(PubSubClient &client, const char *topic);
|
|
|
|
size_t construct_json(float *data, char *buffer, int buffer_size);
|
2023-04-03 03:26:12 +02:00
|
|
|
void mqtt_transfer(PubSubClient &client, const char *device_id,
|
2023-04-03 06:23:03 +02:00
|
|
|
const char *topic, float *data);
|
2023-03-30 02:10:49 +02:00
|
|
|
void enter_deep_sleep(bool wifi_timeout);
|
2023-03-30 01:28:31 +02:00
|
|
|
|
|
|
|
#endif /* WLAN_H */
|