From f17b220a384a9b3632abb333bab61271e1b9054b Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Sat, 30 Dec 2023 01:23:33 +0700 Subject: [PATCH] webserver header --- .../lib/ESPMegaPRO/ESPMegaWebServer.hpp | 24 +++++++++++++++++++ Template Project/platformio.ini | 1 + 2 files changed, 25 insertions(+) create mode 100644 Template Project/lib/ESPMegaPRO/ESPMegaWebServer.hpp diff --git a/Template Project/lib/ESPMegaPRO/ESPMegaWebServer.hpp b/Template Project/lib/ESPMegaPRO/ESPMegaWebServer.hpp new file mode 100644 index 0000000..708ea86 --- /dev/null +++ b/Template Project/lib/ESPMegaPRO/ESPMegaWebServer.hpp @@ -0,0 +1,24 @@ +#pragma once +#include +#include +#include + +class ESPMegaWebServer +{ + public: + ESPMegaWebServer(uint16_t port); + ~ESPMegaWebServer(); + void begin(ESPMegaIoT *iot); + void loop(); + private: + // Web Server + AsyncWebServer server; + uint16_t port; + // ESPMegaIoT + ESPMegaIoT *iot; + // Endpoints Handlers + void dashboardHandler(AsyncWebServerRequest *request); + void configHandler(AsyncWebServerRequest *request); + void saveConfigHandler(AsyncWebServerRequest *request); + void otaHandler(AsyncWebServerRequest *request); +}; \ No newline at end of file diff --git a/Template Project/platformio.ini b/Template Project/platformio.ini index 09cdb19..a0f53c1 100644 --- a/Template Project/platformio.ini +++ b/Template Project/platformio.ini @@ -26,5 +26,6 @@ lib_deps = adafruit/Adafruit PWM Servo Driver Library@^2.4.1 knolleary/pubsubclient@^2.8.0 seithan/Easy Nextion Library@^1.0.6 z3t0/IRremote@^4.2.0 + esphome/ESPAsyncWebServer-esphome@^3.1.0 monitor_speed = 115200