Files
SpotMicroESP32-Leika/esp32/lib/ESP32-sveltekit/ntp_service.h
T
2024-11-07 16:57:59 +01:00

31 lines
779 B
C++

#ifndef NTPService_h
#define NTPService_h
#include <filesystem.h>
#include <FSPersistence.h>
#include <WiFi.h>
#include <stateful_service_endpoint.h>
#include <domain/ntp_settings.h>
#include <lwip/apps/sntp.h>
#include <time.h>
class NTPService : public StatefulService<NTPSettings> {
public:
NTPService();
void begin();
static esp_err_t getStatus(PsychicRequest *request);
static esp_err_t handleTime(PsychicRequest *request, JsonVariant &json);
StatefulHttpEndpoint<NTPSettings> endpoint;
private:
FSPersistence<NTPSettings> _persistence;
void onStationModeGotIP(WiFiEvent_t event, WiFiEventInfo_t info);
void onStationModeDisconnected(WiFiEvent_t event, WiFiEventInfo_t info);
void configureNTP();
};
#endif // end NTPService_h