#pragma once #include #include #include #include #include #include /** * @brief Provides a web server for ESPMegaPRO * * This class use FRAM address 301-400 */ class ESPMegaWebServer { public: ESPMegaWebServer(uint16_t port, ESPMegaIoT *iot); ~ESPMegaWebServer(); void begin(); void loop(); void resetCredentials(); char* getWebUsername(); char* getWebPassword(); void setWebUsername(const char* username); void setWebPassword(const char* password); void bindFRAM(FRAM *fram); void loadCredentialsFromFRAM(); void saveCredentialsToFRAM(); private: // FRAM FRAM *fram; // Credentials char webUsername[32]; char webPassword[32]; // Web Server AsyncWebServer *server; uint16_t port; // ESPMegaIoT ESPMegaIoT *iot; // Endpoints Handlers void dashboardHandler(AsyncWebServerRequest *request); String dashboardProcessor(const String& var); void configHandler(AsyncWebServerRequest *request); String configProcessor(const String& var); void saveConfigHandler(AsyncWebServerRequest *request); void otaHandler(AsyncWebServerRequest *request); void restAPIHandler(AsyncWebServerRequest *request); };