Rename Directory
This commit is contained in:
parent
4fd8a0a761
commit
74c37e3747
63 changed files with 2 additions and 4 deletions
58
ESPMegaPRO-OS-SDK/lib/ESPMegaPRO/ESPMegaWebServer.hpp
Normal file
58
ESPMegaPRO-OS-SDK/lib/ESPMegaPRO/ESPMegaWebServer.hpp
Normal file
|
@ -0,0 +1,58 @@
|
|||
#pragma once
|
||||
#include <FS.h>
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include <ESPMegaIoT.hpp>
|
||||
#include <Update.h>
|
||||
#include <FRAM.h>
|
||||
#include <ArduinoJson.h>
|
||||
#include <AsyncJson.h>
|
||||
#include <html/all.h>
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provides a web server for ESPMegaPRO
|
||||
*
|
||||
* This class provides a web server for ESPMegaPRO. It is used to configure the device and to update the firmware.
|
||||
* This class also allows to save the credentials to access the web server in the FRAM memory.
|
||||
* User can also add custom endpoints to the web server.
|
||||
*
|
||||
* 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();
|
||||
AsyncWebServer* getServer();
|
||||
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);
|
||||
AsyncCallbackJsonWebHandler *saveConfigHandler;
|
||||
void saveConfigJSONHandler(AsyncWebServerRequest *request, JsonVariant &json);
|
||||
void otaRequestHandler(AsyncWebServerRequest *request);
|
||||
void otaUploadHandler(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final);
|
||||
void restAPIHandler(AsyncWebServerRequest *request);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue