refactor network code

This commit is contained in:
proddy
2026-05-01 08:07:05 +02:00
parent 0e08334132
commit 751c540cb3
38 changed files with 999 additions and 852 deletions

View File

@@ -1,5 +1,7 @@
#include "APStatus.h"
#include <emsesp.h>
APStatus::APStatus(AsyncWebServer * server, SecurityManager * securityManager, APSettingsService * apSettingsService)
: _apSettingsService(apSettingsService) {
securityManager->addEndpoint(server, AP_STATUS_SERVICE_PATH, AuthenticationPredicates::IS_AUTHENTICATED, [this](AsyncWebServerRequest * request) {
@@ -12,9 +14,9 @@ void APStatus::apStatus(AsyncWebServerRequest * request) {
JsonObject root = response->getRoot();
root["status"] = _apSettingsService->getAPNetworkStatus();
root["ip_address"] = WiFi.softAPIP().toString();
root["mac_address"] = WiFi.softAPmacAddress();
root["station_num"] = WiFi.softAPgetStationNum();
root["ip_address"] = emsesp::EMSESP::network_.getLocalIP();
root["mac_address"] = emsesp::EMSESP::network_.getMacAddress();
root["station_num"] = emsesp::EMSESP::network_.getStationNum();
response->setLength();
request->send(response);