mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-05-02 20:16:59 +00:00
refactor network code
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user