WordClockESP/src/WiFiSettingsService.h

46 lines
1.1 KiB
C
Raw Normal View History

#ifndef WiFiSettingsService_h
#define WiFiSettingsService_h
#include <SettingsService.h>
2018-11-11 16:36:41 +00:00
#include <IPAddress.h>
#define WIFI_SETTINGS_FILE "/config/wifiSettings.json"
2018-04-01 09:35:23 +00:00
#define WIFI_SETTINGS_SERVICE_PATH "/rest/wifiSettings"
2019-05-29 22:48:16 +00:00
class WiFiSettingsService : public AdminSettingsService {
public:
2019-05-29 22:48:16 +00:00
WiFiSettingsService(AsyncWebServer* server, FS* fs, SecurityManager* securityManager);
~WiFiSettingsService();
void begin();
protected:
void readFromJsonObject(JsonObject& root);
void writeToJsonObject(JsonObject& root);
void onConfigUpdated();
void reconfigureWiFiConnection();
private:
// connection settings
String _ssid;
String _password;
String _hostname;
bool _staticIPConfig;
// optional configuration for static IP address
IPAddress _localIP;
IPAddress _gatewayIP;
IPAddress _subnetMask;
IPAddress _dnsIP1;
IPAddress _dnsIP2;
void readIP(JsonObject& root, String key, IPAddress& _ip);
void writeIP(JsonObject& root, String key, IPAddress& _ip);
2018-04-01 09:35:23 +00:00
};
#endif // end WiFiSettingsService_h