Files
SpotMicroESP32-Leika/esp32/lib/ESP32-sveltekit/ntp_service.h
T
Rune Harlyk 24d39e540e 📦 Moves templates
2024-11-14 15:56:23 +01:00

31 lines
798 B
C++

#ifndef NTPService_h
#define NTPService_h
#include <filesystem.h>
#include <template/stateful_persistence.h>
#include <WiFi.h>
#include <template/stateful_endpoint.h>
#include <settings/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