debug start
This commit is contained in:
parent
c1d598ab20
commit
fc907e0c7a
7 changed files with 194 additions and 4 deletions
|
@ -8,6 +8,32 @@
|
|||
#include <IoTComponent.hpp>
|
||||
#include <PubSubClient.h>
|
||||
#include <ETH.h>
|
||||
#include <WiFi.h>
|
||||
#include <FRAM.h>
|
||||
|
||||
struct NetworkConfig
|
||||
{
|
||||
IPAddress ip;
|
||||
IPAddress gateway;
|
||||
IPAddress subnet;
|
||||
IPAddress dns1;
|
||||
IPAddress dns2;
|
||||
char hostname[32];
|
||||
bool useStaticIp;
|
||||
bool useWifi;
|
||||
bool wifiUseAuth;
|
||||
char ssid[32];
|
||||
char password[32];
|
||||
};
|
||||
|
||||
struct MqttConfig
|
||||
{
|
||||
char mqtt_server[32];
|
||||
uint16_t mqtt_port;
|
||||
char mqtt_user[32];
|
||||
char mqtt_password[32];
|
||||
bool mqtt_useauth;
|
||||
};
|
||||
|
||||
class ESPMegaIoT
|
||||
{
|
||||
|
@ -28,6 +54,15 @@ public:
|
|||
void connectToWifi(char *ssid);
|
||||
void disconnectFromWifi();
|
||||
bool wifiConnected();
|
||||
void ethernetBegin();
|
||||
void loadNetworkConfig();
|
||||
void saveNetworkConfig();
|
||||
void setMqttConfig(MqttConfig mqtt_config);
|
||||
void saveMqttConfig();
|
||||
void loadMqttConfig();
|
||||
void connectNetwork();
|
||||
void setNetworkConfig(NetworkConfig network_config);
|
||||
void connectToMqtt();
|
||||
bool connectToMqtt(char *client_id, char *mqtt_server, uint16_t mqtt_port, char *mqtt_user, char *mqtt_password);
|
||||
bool connectToMqtt(char *client_id, char *mqtt_server, uint16_t mqtt_port);
|
||||
void disconnectFromMqtt();
|
||||
|
@ -39,6 +74,11 @@ public:
|
|||
IPAddress getETHIp();
|
||||
|
||||
private:
|
||||
FRAM *fram;
|
||||
bool useWifi;
|
||||
bool WifiUseAuth;
|
||||
char ssid[32];
|
||||
char password[32];
|
||||
WiFiClient tcpClient;
|
||||
void sessionKeepAlive();
|
||||
bool mqttReconnect();
|
||||
|
@ -64,4 +104,5 @@ private:
|
|||
char *client_id;
|
||||
bool mqtt_useauth;
|
||||
bool mqtt_connected;
|
||||
NetworkConfig network_config;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue