#include "APStatus.h" #include APStatus::APStatus(AsyncWebServer * server, SecurityManager * securityManager, APSettingsService * apSettingsService) : _apSettingsService(apSettingsService) { securityManager->addEndpoint(server, AP_STATUS_SERVICE_PATH, AuthenticationPredicates::IS_AUTHENTICATED, [this](AsyncWebServerRequest * request) { apStatus(request); }); } void APStatus::apStatus(AsyncWebServerRequest * request) { auto * response = new AsyncJsonResponse(false); JsonObject root = response->getRoot(); root["status"] = _apSettingsService->getAPNetworkStatus(); 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); }