first commit using PsychicHttp

This commit is contained in:
Proddy
2023-12-25 13:27:02 +01:00
parent 68cb94547e
commit 73a51ae4ad
169 changed files with 7162 additions and 12208 deletions

View File

@@ -1,6 +1,8 @@
#ifndef NTPSettingsService_h
#define NTPSettingsService_h
#include <WiFi.h>
#include <HttpEndpoint.h>
#include <FSPersistence.h>
@@ -26,7 +28,6 @@
#define NTP_SETTINGS_FILE "/config/ntpSettings.json"
#define NTP_SETTINGS_SERVICE_PATH "/rest/ntpSettings"
#define MAX_TIME_SIZE 256
#define TIME_PATH "/rest/time"
class NTPSettings {
@@ -54,20 +55,26 @@ class NTPSettings {
class NTPSettingsService : public StatefulService<NTPSettings> {
public:
NTPSettingsService(AsyncWebServer * server, FS * fs, SecurityManager * securityManager);
NTPSettingsService(PsychicHttpServer * server, FS * fs, SecurityManager * securityManager);
void begin();
void registerURI();
void begin();
static void ntp_received(struct timeval * tv);
private:
HttpEndpoint<NTPSettings> _httpEndpoint;
FSPersistence<NTPSettings> _fsPersistence;
AsyncCallbackJsonWebHandler _timeHandler;
SecurityManager * _securityManager;
PsychicHttpServer * _server;
HttpEndpoint<NTPSettings> _httpEndpoint;
FSPersistence<NTPSettings> _fsPersistence;
bool connected_ = false;
void WiFiEvent(WiFiEvent_t event);
void configureNTP();
void configureTime(AsyncWebServerRequest * request, JsonVariant & json);
// POST
esp_err_t configureTime(PsychicRequest * request, JsonVariant & json);
};
#endif