2019-12-01 08:28:40 +00:00
|
|
|
#ifndef RestartService_h
|
|
|
|
#define RestartService_h
|
|
|
|
|
2019-12-24 11:19:19 +00:00
|
|
|
#ifdef ESP32
|
|
|
|
#include <WiFi.h>
|
|
|
|
#include <AsyncTCP.h>
|
|
|
|
#elif defined(ESP8266)
|
2019-12-03 23:16:06 +00:00
|
|
|
#include <ESP8266WiFi.h>
|
|
|
|
#include <ESPAsyncTCP.h>
|
2019-12-01 08:28:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <ESPAsyncWebServer.h>
|
|
|
|
#include <SecurityManager.h>
|
|
|
|
|
|
|
|
#define RESTART_SERVICE_PATH "/rest/restart"
|
|
|
|
|
|
|
|
class RestartService {
|
2019-12-03 23:16:06 +00:00
|
|
|
public:
|
|
|
|
RestartService(AsyncWebServer* server, SecurityManager* securityManager);
|
2019-12-01 08:28:40 +00:00
|
|
|
|
2020-06-28 23:25:58 +00:00
|
|
|
static void restartNow() {
|
|
|
|
WiFi.disconnect(true);
|
|
|
|
delay(500);
|
|
|
|
ESP.restart();
|
|
|
|
}
|
|
|
|
|
2019-12-03 23:16:06 +00:00
|
|
|
private:
|
|
|
|
void restart(AsyncWebServerRequest* request);
|
2019-12-01 08:28:40 +00:00
|
|
|
};
|
|
|
|
|
2020-06-09 20:57:44 +00:00
|
|
|
#endif // end RestartService_h
|