42 lines
836 B
C++
42 lines
836 B
C++
/**
|
|
* @file network.h
|
|
* @author Alexander Klein (alex@kleiax.de)
|
|
* @brief TODO: write some stuff here too
|
|
* @version 0.1
|
|
* @date 2021-12-14
|
|
*
|
|
* @copyright Copyright (c) 2021
|
|
*
|
|
*/
|
|
|
|
#ifndef NETWORK_H
|
|
#define NETWORK_H
|
|
|
|
#include <WiFi.h>
|
|
#include <PubSubClient.h>
|
|
|
|
#include "networkConfig.h"
|
|
|
|
#define MQTT_TIME_RECONNECT 2500
|
|
|
|
class Network {
|
|
public:
|
|
static void setIps();
|
|
static void connectWifi();
|
|
static void setupMQTT();
|
|
static void checkMQTT();
|
|
static PubSubClient* getMqtttClient();
|
|
|
|
private:
|
|
static bool connectMQTT();
|
|
|
|
static IPAddress local_IP;
|
|
static IPAddress gateway;
|
|
static IPAddress subnet;
|
|
static IPAddress mqtt_server;
|
|
|
|
static WiFiClient wifi_client;
|
|
static PubSubClient* mqtt_client;
|
|
};
|
|
|
|
#endif // NETWORK_H
|