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, 2024 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 void GetFseqFileListHandler(AsyncWebServerRequest *request);
46
47private:
48
50 DeviceCallbackFunction pAlexaCallback = nullptr;
51 EspalexaDevice * pAlexaDevice = nullptr;
52 bool HasBeenInitialized = false;
53
54#ifdef ARDUINO_ARCH_ESP32
55# define STATUS_DOC_SIZE 4000
56#else
57# define STATUS_DOC_SIZE 2500
58#endif // def ARDUINO_ARCH_ESP32
59
60 void init ();
61 void processCmdGet (JsonObject & jsonCmd);
62 bool processCmdSet (JsonObject & jsonCmd);
63 void processCmdOpt (JsonObject & jsonCmd);
64 void processCmdDelete (JsonObject & jsonCmd);
65 void processCmdSetTime (JsonObject & jsonCmd);
66
68 void GetOptions ();
69
70 void ProcessXJRequest (AsyncWebServerRequest * client);
71 void ProcessSetTimeRequest (time_t DateTime);
72
76
77 using WebJsonDocument = JsonDocument;
78
80 size_t GetFseqFileListChunk(uint8_t *buffer, size_t maxlen, size_t index);
84}; // c_WebMgr
85
86extern c_WebMgr WebMgr;
c_WebMgr WebMgr
Definition WebMgr.cpp:938
Definition EFUpdate.h:27
static const FileId INVALID_FILE_HANDLE
Definition FileMgr.hpp:51
uint32_t FileId
Definition FileMgr.hpp:50
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:100
void GetInputOptions()
void ProcessSetTimeRequest(time_t DateTime)
Definition WebMgr.cpp:816
void processCmdGet(JsonObject &jsonCmd)
void GetFseqFileListHandler(AsyncWebServerRequest *request)
Definition WebMgr.cpp:656
size_t NumberOfBytesTransfered
Definition WebMgr.hpp:83
EspalexaDevice * pAlexaDevice
Definition WebMgr.hpp:51
void init()
Definition WebMgr.cpp:132
void Process()
Definition WebMgr.cpp:925
DeviceCallbackFunction pAlexaCallback
Definition WebMgr.hpp:50
void FirmwareUpload(AsyncWebServerRequest *request, String filename, uint32_t index, uint8_t *data, uint32_t len, bool final)
Definition WebMgr.cpp:829
c_WebMgr()
< Start up the driver and put it into a safe mode
Definition WebMgr.cpp:82
bool IsAlexaCallbackValid()
Definition WebMgr.hpp:40
WebJsonDocument * WebJsonDoc
Definition WebMgr.hpp:79
void onAlexaMessage(EspalexaDevice *pDevice)
Definition WebMgr.cpp:584
void GetDriverName(String &Name)
Definition WebMgr.hpp:43
size_t TotalFileSizeToTransfer
Definition WebMgr.hpp:82
void processCmdDelete(JsonObject &jsonCmd)
void CreateAdminInfoFile()
Definition WebMgr.cpp:624
void GetConfiguration()
size_t GetFseqFileListChunk(uint8_t *buffer, size_t maxlen, size_t index)
Definition WebMgr.cpp:672
bool processCmdSet(JsonObject &jsonCmd)
void NetworkStateChanged(bool NewNetworkState)
Definition WebMgr.cpp:118
void GetDeviceOptions()
c_FileMgr::FileId FileHandle
Definition WebMgr.hpp:81
void RegisterAlexaCallback(DeviceCallbackFunction cb)
Definition WebMgr.cpp:573
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:90
void ProcessXJRequest(AsyncWebServerRequest *client)
Definition WebMgr.cpp:760
void GetOutputOptions()
void GetOptions()
EFUpdate efupdate
Definition WebMgr.hpp:49
bool HasBeenInitialized
Definition WebMgr.hpp:52
void processCmdSetTime(JsonObject &jsonCmd)
char filename[250]
Definition fseq.h:7
Core configuration structure.
Definition ESPixelStick.h:69