Updated WIFI on esp and svelte side to use proto
This commit is contained in:
@@ -3,15 +3,18 @@
|
||||
#include <esp_http_server.h>
|
||||
#include <WiFi.h>
|
||||
#include <ESPmDNS.h>
|
||||
#include <ArduinoJson.h>
|
||||
#include <string>
|
||||
|
||||
#include <filesystem.h>
|
||||
#include <utils/timing.h>
|
||||
#include <template/stateful_service.h>
|
||||
#include <template/stateful_persistence.h>
|
||||
#include <template/stateful_endpoint.h>
|
||||
#include <template/stateful_persistence_pb.h>
|
||||
#include <template/stateful_proto_endpoint.h>
|
||||
#include <settings/wifi_settings.h>
|
||||
|
||||
#define WIFI_SETTINGS_FILE "/config/wifiSettings.pb"
|
||||
|
||||
class WiFiService : public StatefulService<WiFiSettings> {
|
||||
private:
|
||||
static void getNetworks(JsonObject &root);
|
||||
@@ -20,12 +23,12 @@ class WiFiService : public StatefulService<WiFiSettings> {
|
||||
void onStationModeStop(WiFiEvent_t event, WiFiEventInfo_t info);
|
||||
static void onStationModeGotIP(WiFiEvent_t event, WiFiEventInfo_t info);
|
||||
|
||||
FSPersistence<WiFiSettings> _persistence;
|
||||
FSPersistencePB<WiFiSettings> _persistence;
|
||||
|
||||
void reconfigureWiFiConnection();
|
||||
void manageSTA();
|
||||
void connectToWiFi();
|
||||
void configureNetwork(wifi_settings_t &network);
|
||||
void configureNetwork(WiFiNetwork &network);
|
||||
|
||||
unsigned long _lastConnectionAttempt;
|
||||
bool _stopping;
|
||||
@@ -41,11 +44,11 @@ class WiFiService : public StatefulService<WiFiSettings> {
|
||||
|
||||
void setupMDNS(const char *hostname);
|
||||
|
||||
const char *getHostname() { return state().hostname.c_str(); }
|
||||
const char *getHostname() { return state().hostname; }
|
||||
|
||||
static esp_err_t handleScan(httpd_req_t *request);
|
||||
static esp_err_t getNetworks(httpd_req_t *request);
|
||||
static esp_err_t getNetworkStatus(httpd_req_t *request);
|
||||
|
||||
StatefulHttpEndpoint<WiFiSettings> endpoint;
|
||||
StatefulProtoEndpoint<WiFiSettings, api_WifiSettings> protoEndpoint;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user