36 lines
615 B
C
36 lines
615 B
C
/**
|
|
* @file network.h
|
|
* @author Alexander Klein (alex@kleiax.de)
|
|
* @brief Some network and MQTT stuff
|
|
* @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
|
|
|
|
IPAddress local_IP;
|
|
extern IPAddress gateway;
|
|
extern IPAddress subnet;
|
|
extern IPAddress mqtt_server;
|
|
|
|
extern WiFiClient wifi_client;
|
|
PubSubClient mqtt_client(wifi_client);
|
|
|
|
void setIps();
|
|
void connectWifi();
|
|
void setupMQTT();
|
|
bool connectMQTT();
|
|
void checkMQTT();
|
|
|
|
#endif // NETWORK_H
|