2019-07-14 21:13:26 +00:00
|
|
|
#ifndef ESP8266React_h
|
|
|
|
#define ESP8266React_h
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
2019-12-24 11:19:19 +00:00
|
|
|
#ifdef ESP32
|
2019-12-03 23:16:06 +00:00
|
|
|
#include <AsyncTCP.h>
|
2019-12-29 17:54:12 +00:00
|
|
|
#include <WiFi.h>
|
2019-12-24 11:19:19 +00:00
|
|
|
#elif defined(ESP8266)
|
|
|
|
#include <ESP8266WiFi.h>
|
|
|
|
#include <ESPAsyncTCP.h>
|
2019-07-14 21:13:26 +00:00
|
|
|
#endif
|
|
|
|
|
2020-06-09 20:57:44 +00:00
|
|
|
#include <FeaturesService.h>
|
2019-07-14 21:13:26 +00:00
|
|
|
#include <APSettingsService.h>
|
2019-12-03 23:16:06 +00:00
|
|
|
#include <APStatus.h>
|
|
|
|
#include <AuthenticationService.h>
|
2020-05-19 23:32:49 +00:00
|
|
|
#include <FactoryResetService.h>
|
2020-05-14 22:23:45 +00:00
|
|
|
#include <MqttSettingsService.h>
|
|
|
|
#include <MqttStatus.h>
|
2019-07-14 21:13:26 +00:00
|
|
|
#include <NTPSettingsService.h>
|
2019-12-03 23:16:06 +00:00
|
|
|
#include <NTPStatus.h>
|
2019-07-14 21:13:26 +00:00
|
|
|
#include <OTASettingsService.h>
|
2020-06-28 23:25:58 +00:00
|
|
|
#include <UploadFirmwareService.h>
|
2019-12-03 23:16:06 +00:00
|
|
|
#include <RestartService.h>
|
|
|
|
#include <SecuritySettingsService.h>
|
|
|
|
#include <SystemStatus.h>
|
2019-07-14 21:13:26 +00:00
|
|
|
#include <WiFiScanner.h>
|
2019-12-03 23:16:06 +00:00
|
|
|
#include <WiFiSettingsService.h>
|
2019-07-14 21:13:26 +00:00
|
|
|
#include <WiFiStatus.h>
|
|
|
|
|
2019-12-29 17:54:12 +00:00
|
|
|
#ifdef PROGMEM_WWW
|
|
|
|
#include <WWWData.h>
|
|
|
|
#endif
|
|
|
|
|
2019-07-14 21:13:26 +00:00
|
|
|
class ESP8266React {
|
2019-12-03 23:16:06 +00:00
|
|
|
public:
|
|
|
|
ESP8266React(AsyncWebServer* server, FS* fs);
|
|
|
|
|
|
|
|
void begin();
|
|
|
|
void loop();
|
|
|
|
|
|
|
|
SecurityManager* getSecurityManager() {
|
|
|
|
return &_securitySettingsService;
|
|
|
|
}
|
|
|
|
|
2020-06-09 20:57:44 +00:00
|
|
|
#if FT_ENABLED(FT_SECURITY)
|
2020-05-14 22:23:45 +00:00
|
|
|
StatefulService<SecuritySettings>* getSecuritySettingsService() {
|
2020-02-01 08:44:26 +00:00
|
|
|
return &_securitySettingsService;
|
|
|
|
}
|
2020-06-09 20:57:44 +00:00
|
|
|
#endif
|
2020-02-01 08:44:26 +00:00
|
|
|
|
2020-05-14 22:23:45 +00:00
|
|
|
StatefulService<WiFiSettings>* getWiFiSettingsService() {
|
2020-02-01 08:44:26 +00:00
|
|
|
return &_wifiSettingsService;
|
|
|
|
}
|
|
|
|
|
2020-05-14 22:23:45 +00:00
|
|
|
StatefulService<APSettings>* getAPSettingsService() {
|
2020-02-01 08:44:26 +00:00
|
|
|
return &_apSettingsService;
|
|
|
|
}
|
|
|
|
|
2020-06-09 20:57:44 +00:00
|
|
|
#if FT_ENABLED(FT_NTP)
|
2020-05-14 22:23:45 +00:00
|
|
|
StatefulService<NTPSettings>* getNTPSettingsService() {
|
2020-02-01 08:44:26 +00:00
|
|
|
return &_ntpSettingsService;
|
|
|
|
}
|
2020-06-09 20:57:44 +00:00
|
|
|
#endif
|
2020-02-01 08:44:26 +00:00
|
|
|
|
2020-06-09 20:57:44 +00:00
|
|
|
#if FT_ENABLED(FT_OTA)
|
2020-05-14 22:23:45 +00:00
|
|
|
StatefulService<OTASettings>* getOTASettingsService() {
|
2020-02-01 08:44:26 +00:00
|
|
|
return &_otaSettingsService;
|
|
|
|
}
|
2020-06-09 20:57:44 +00:00
|
|
|
#endif
|
2020-02-01 08:44:26 +00:00
|
|
|
|
2020-06-09 20:57:44 +00:00
|
|
|
#if FT_ENABLED(FT_MQTT)
|
2020-05-14 22:23:45 +00:00
|
|
|
StatefulService<MqttSettings>* getMqttSettingsService() {
|
|
|
|
return &_mqttSettingsService;
|
|
|
|
}
|
|
|
|
|
|
|
|
AsyncMqttClient* getMqttClient() {
|
|
|
|
return _mqttSettingsService.getMqttClient();
|
|
|
|
}
|
2020-06-09 20:57:44 +00:00
|
|
|
#endif
|
2020-05-14 22:23:45 +00:00
|
|
|
|
2020-05-19 23:32:49 +00:00
|
|
|
void factoryReset() {
|
|
|
|
_factoryResetService.factoryReset();
|
|
|
|
}
|
|
|
|
|
2019-12-03 23:16:06 +00:00
|
|
|
private:
|
2020-06-09 20:57:44 +00:00
|
|
|
FeaturesService _featureService;
|
2019-12-03 23:16:06 +00:00
|
|
|
SecuritySettingsService _securitySettingsService;
|
|
|
|
WiFiSettingsService _wifiSettingsService;
|
2020-06-09 20:57:44 +00:00
|
|
|
WiFiScanner _wifiScanner;
|
|
|
|
WiFiStatus _wifiStatus;
|
2019-12-03 23:16:06 +00:00
|
|
|
APSettingsService _apSettingsService;
|
2020-06-09 20:57:44 +00:00
|
|
|
APStatus _apStatus;
|
|
|
|
#if FT_ENABLED(FT_NTP)
|
2019-12-03 23:16:06 +00:00
|
|
|
NTPSettingsService _ntpSettingsService;
|
2020-06-09 20:57:44 +00:00
|
|
|
NTPStatus _ntpStatus;
|
|
|
|
#endif
|
|
|
|
#if FT_ENABLED(FT_OTA)
|
2019-12-03 23:16:06 +00:00
|
|
|
OTASettingsService _otaSettingsService;
|
2020-06-09 20:57:44 +00:00
|
|
|
#endif
|
2020-06-28 23:25:58 +00:00
|
|
|
#if FT_ENABLED(FT_UPLOAD_FIRMWARE)
|
|
|
|
UploadFirmwareService _uploadFirmwareService;
|
|
|
|
#endif
|
2020-06-09 20:57:44 +00:00
|
|
|
#if FT_ENABLED(FT_MQTT)
|
2020-05-14 22:23:45 +00:00
|
|
|
MqttSettingsService _mqttSettingsService;
|
2020-06-09 20:57:44 +00:00
|
|
|
MqttStatus _mqttStatus;
|
|
|
|
#endif
|
|
|
|
#if FT_ENABLED(FT_SECURITY)
|
|
|
|
AuthenticationService _authenticationService;
|
|
|
|
#endif
|
2019-12-03 23:16:06 +00:00
|
|
|
RestartService _restartService;
|
2020-05-19 23:32:49 +00:00
|
|
|
FactoryResetService _factoryResetService;
|
2019-12-03 23:16:06 +00:00
|
|
|
SystemStatus _systemStatus;
|
2019-07-14 21:13:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|