ESPMegaPRO-v3-SDK/ESPMegaPRO-firmware/lib/ESPMegaPRO/ESPMegaWebServer.hpp

29 lines
875 B
C++
Raw Normal View History

2023-12-29 18:23:33 +00:00
#pragma once
2023-12-31 08:53:39 +00:00
#include <FS.h>
2023-12-29 18:23:33 +00:00
#include <ESPAsyncWebServer.h>
#include <ESPMegaIoT.hpp>
#include <Update.h>
2024-01-01 09:38:14 +00:00
#include <html/all.h>
2023-12-29 18:23:33 +00:00
class ESPMegaWebServer
{
public:
2024-01-01 06:28:15 +00:00
ESPMegaWebServer(uint16_t port, ESPMegaIoT *iot);
2023-12-29 18:23:33 +00:00
~ESPMegaWebServer();
2024-01-01 06:28:15 +00:00
void begin();
2023-12-29 18:23:33 +00:00
void loop();
private:
// Web Server
2024-01-01 06:28:15 +00:00
AsyncWebServer *server;
2023-12-29 18:23:33 +00:00
uint16_t port;
// ESPMegaIoT
ESPMegaIoT *iot;
// Endpoints Handlers
void dashboardHandler(AsyncWebServerRequest *request);
2024-01-01 09:38:14 +00:00
String dashboardProcessor(const String& var);
2023-12-29 18:23:33 +00:00
void configHandler(AsyncWebServerRequest *request);
String configProcessor(const String& var);
2023-12-29 18:23:33 +00:00
void saveConfigHandler(AsyncWebServerRequest *request);
void otaHandler(AsyncWebServerRequest *request);
2023-12-31 08:53:39 +00:00
void restAPIHandler(AsyncWebServerRequest *request);
2023-12-29 18:23:33 +00:00
};