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
46private:
47
49 DeviceCallbackFunction pAlexaCallback = nullptr;
50 EspalexaDevice * pAlexaDevice = nullptr;
51 bool HasBeenInitialized = false;
52 JsonDocument WebJsonDoc;
53 String XjResult = emptyString;
54
55#ifdef ARDUINO_ARCH_ESP32
56# define STATUS_DOC_SIZE 4000
57#else
58# define STATUS_DOC_SIZE 2500
59#endif // def ARDUINO_ARCH_ESP32
60
61 void init ();
62 void processCmdGet (JsonObject & jsonCmd);
63 bool processCmdSet (JsonObject & jsonCmd);
64 void processCmdOpt (JsonObject & jsonCmd);
65 void processCmdDelete (JsonObject & jsonCmd);
66 void processCmdSetTime (JsonObject & jsonCmd);
67
69 void GetOptions ();
70
71 void ProcessXJRequest (AsyncWebServerRequest * client);
72 void ProcessSetTimeRequest (time_t DateTime);
73
77
78 using WebJsonDocument = JsonDocument;
79
80}; // c_WebMgr
81
82extern c_WebMgr WebMgr;
c_WebMgr WebMgr
Definition WebMgr.cpp:863
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:100
void GetInputOptions()
void ProcessSetTimeRequest(time_t DateTime)
Definition WebMgr.cpp:741
void processCmdGet(JsonObject &jsonCmd)
EspalexaDevice * pAlexaDevice
Definition WebMgr.hpp:50
void init()
Definition WebMgr.cpp:132
void Process()
Definition WebMgr.cpp:850
DeviceCallbackFunction pAlexaCallback
Definition WebMgr.hpp:49
String XjResult
Definition WebMgr.hpp:53
void FirmwareUpload(AsyncWebServerRequest *request, String filename, uint32_t index, uint8_t *data, uint32_t len, bool final)
Definition WebMgr.cpp:754
c_WebMgr()
< Start up the driver and put it into a safe mode
Definition WebMgr.cpp:82
bool IsAlexaCallbackValid()
Definition WebMgr.hpp:40
void onAlexaMessage(EspalexaDevice *pDevice)
Definition WebMgr.cpp:620
void GetDriverName(String &Name)
Definition WebMgr.hpp:43
void processCmdDelete(JsonObject &jsonCmd)
void CreateAdminInfoFile()
Definition WebMgr.cpp:660
void GetConfiguration()
bool processCmdSet(JsonObject &jsonCmd)
void NetworkStateChanged(bool NewNetworkState)
Definition WebMgr.cpp:118
void GetDeviceOptions()
void RegisterAlexaCallback(DeviceCallbackFunction cb)
Definition WebMgr.cpp:609
JsonDocument WebJsonDocument
Definition WebMgr.hpp:78
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:692
void GetOutputOptions()
void GetOptions()
EFUpdate efupdate
Definition WebMgr.hpp:48
bool HasBeenInitialized
Definition WebMgr.hpp:51
void processCmdSetTime(JsonObject &jsonCmd)
JsonDocument WebJsonDoc
Definition WebMgr.hpp:52
char filename[250]
Definition fseq.h:7
Core configuration structure.
Definition ESPixelStick.h:73