Files
2026-01-31 19:32:43 +01:00

42 lines
986 B
C++

#pragma once
#include <template/stateful_service.h>
#include <template/stateful_proto_endpoint.h>
#include <template/stateful_persistence_pb.h>
#include <settings/ap_settings.h>
#include <utils/timing.h>
#include <wifi/wifi_idf.h>
#include <wifi/dns_server.h>
#include <esp_timer.h>
#include <string>
class APService : public StatefulService<APSettings> {
public:
APService();
~APService();
void begin();
void loop();
void recoveryMode();
esp_err_t getStatusProto(httpd_req_t *request);
void statusProto(api_APStatus &proto);
APNetworkStatus getAPNetworkStatus();
StatefulProtoEndpoint<APSettings, api_APSettings> protoEndpoint;
private:
FSPersistencePB<APSettings> _persistence;
DNSServer *_dnsServer;
volatile unsigned long _lastManaged;
volatile bool _reconfigureAp;
volatile bool _recoveryMode = false;
void reconfigureAP();
void manageAP();
void startAP();
void stopAP();
void handleDNS();
};