ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
WebMgr.hpp
Go to the documentation of this file.
1#pragma once
2/*
3* WebMgr.hpp
4*
5* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
6* Copyright (c) 2021, 2025 Shelby Merrick
7* http://www.forkineye.com
8*
9* This program is provided free for you to use in any way that you wish,
10* subject to the laws and regulations where you are using it. Due diligence
11* is strongly suggested before using this code. Please give credit where due.
12*
13* The Author makes no warranty of any kind, express or implied, with regard
14* to this program or the documentation contained in this document. The
15* Author shall not be liable in any event for incidental or consequential
16* damages in connection with, or arising out of, the furnishing, performance
17* or use of these programs.
18*
19*/
20
21#include "ESPixelStick.h"
22#include "EFUpdate.h"
23#include "output/OutputMgr.hpp"
24#include <ESPAsyncWebServer.h>
25#include <EspalexaDevice.h>
26
27
29{
30public:
31 c_WebMgr ();
32 virtual ~c_WebMgr ();
33
34 void Begin (config_t * NewConfig);
35 void ValidateConfig (config_t * NewConfig);
36 void Process ();
37
38 void onAlexaMessage (EspalexaDevice * pDevice);
39 void RegisterAlexaCallback (DeviceCallbackFunction cb);
40 bool IsAlexaCallbackValid () { return (nullptr != pAlexaCallback); }
41 void FirmwareUpload (AsyncWebServerRequest* request, String filename, uint32_t index, uint8_t* data, uint32_t len, bool final);
42 void NetworkStateChanged (bool NewNetworkState);
43 void GetDriverName (String & Name) { Name = "WebMgr"; }
44 void CreateAdminInfoFile ();
45
46private:
47
49 DeviceCallbackFunction pAlexaCallback = nullptr;
50 EspalexaDevice * pAlexaDevice = nullptr;
51 bool HasBeenInitialized = false;
52
53#ifdef ARDUINO_ARCH_ESP32
54# define STATUS_DOC_SIZE 4000
55#else
56# define STATUS_DOC_SIZE 2500
57#endif // def ARDUINO_ARCH_ESP32
58
59 void init ();
60 void processCmdGet (JsonObject & jsonCmd);
61 bool processCmdSet (JsonObject & jsonCmd);
62 void processCmdOpt (JsonObject & jsonCmd);
63 void processCmdDelete (JsonObject & jsonCmd);
64 void processCmdSetTime (JsonObject & jsonCmd);
65
67 void GetOptions ();
68
69 void ProcessXJRequest (AsyncWebServerRequest * client);
70 void ProcessSetTimeRequest (time_t DateTime);
71
75 bool RequestReadConfigFile (String & fileName);
76
77 using WebJsonDocument = JsonDocument;
78
79}; // c_WebMgr
80
81extern c_WebMgr WebMgr;
c_WebMgr WebMgr
Definition WebMgr.cpp:965
Definition EFUpdate.h:27
Definition WebMgr.hpp:29
void ValidateConfig(config_t *NewConfig)
void Begin(config_t *NewConfig)
set up the operating environment based on the current config (or defaults)
Definition WebMgr.cpp:104
void GetInputOptions()
void ProcessSetTimeRequest(time_t DateTime)
Definition WebMgr.cpp:810
void processCmdGet(JsonObject &jsonCmd)
EspalexaDevice * pAlexaDevice
Definition WebMgr.hpp:50
void init()
Definition WebMgr.cpp:136
void Process()
Definition WebMgr.cpp:952
DeviceCallbackFunction pAlexaCallback
Definition WebMgr.hpp:49
bool RequestReadConfigFile(String &fileName)
Definition WebMgr.cpp:823
void FirmwareUpload(AsyncWebServerRequest *request, String filename, uint32_t index, uint8_t *data, uint32_t len, bool final)
Definition WebMgr.cpp:856
c_WebMgr()
< Start up the driver and put it into a safe mode
Definition WebMgr.cpp:86
bool IsAlexaCallbackValid()
Definition WebMgr.hpp:40
void onAlexaMessage(EspalexaDevice *pDevice)
Definition WebMgr.cpp:672
void GetDriverName(String &Name)
Definition WebMgr.hpp:43
void processCmdDelete(JsonObject &jsonCmd)
void CreateAdminInfoFile()
Definition WebMgr.cpp:712
void GetConfiguration()
bool processCmdSet(JsonObject &jsonCmd)
void NetworkStateChanged(bool NewNetworkState)
Definition WebMgr.cpp:122
void GetDeviceOptions()
void RegisterAlexaCallback(DeviceCallbackFunction cb)
Definition WebMgr.cpp:661
JsonDocument WebJsonDocument
Definition WebMgr.hpp:77
void processCmdOpt(JsonObject &jsonCmd)
virtual ~c_WebMgr()
< deallocate any resources and put the output channels into a safe state
Definition WebMgr.cpp:94
void ProcessXJRequest(AsyncWebServerRequest *client)
Definition WebMgr.cpp:745
void GetOutputOptions()
void GetOptions()
EFUpdate efupdate
Definition WebMgr.hpp:48
bool HasBeenInitialized
Definition WebMgr.hpp:51
void processCmdSetTime(JsonObject &jsonCmd)
char filename[250]
Definition fseq.h:7
Core configuration structure.
Definition ESPixelStick.h:74