🪄 Formats APStatus

This commit is contained in:
Rune Harlyk
2024-07-09 20:02:02 +02:00
committed by Rune Harlyk
parent aa23377774
commit ac022094ed
2 changed files with 8 additions and 17 deletions
+5 -13
View File
@@ -14,25 +14,17 @@
#include <APStatus.h> #include <APStatus.h>
APStatus::APStatus(PsychicHttpServer *server, APStatus::APStatus(PsychicHttpServer *server, SecurityManager *securityManager, APSettingsService *apSettingsService)
SecurityManager *securityManager, : _server(server), _securityManager(securityManager), _apSettingsService(apSettingsService) {}
APSettingsService *apSettingsService) : _server(server), void APStatus::begin() {
_securityManager(securityManager), _server->on(AP_STATUS_SERVICE_PATH, HTTP_GET,
_apSettingsService(apSettingsService)
{
}
void APStatus::begin()
{
_server->on(AP_STATUS_SERVICE_PATH,
HTTP_GET,
_securityManager->wrapRequest(std::bind(&APStatus::apStatus, this, std::placeholders::_1), _securityManager->wrapRequest(std::bind(&APStatus::apStatus, this, std::placeholders::_1),
AuthenticationPredicates::IS_AUTHENTICATED)); AuthenticationPredicates::IS_AUTHENTICATED));
ESP_LOGV("APStatus", "Registered GET endpoint: %s", AP_STATUS_SERVICE_PATH); ESP_LOGV("APStatus", "Registered GET endpoint: %s", AP_STATUS_SERVICE_PATH);
} }
esp_err_t APStatus::apStatus(PsychicRequest *request) esp_err_t APStatus::apStatus(PsychicRequest *request) {
{
PsychicJsonResponse response = PsychicJsonResponse(request, false); PsychicJsonResponse response = PsychicJsonResponse(request, false);
JsonObject root = response.getRoot(); JsonObject root = response.getRoot();
+1 -2
View File
@@ -25,8 +25,7 @@
#define AP_STATUS_SERVICE_PATH "/api/apStatus" #define AP_STATUS_SERVICE_PATH "/api/apStatus"
class APStatus class APStatus {
{
public: public:
APStatus(PsychicHttpServer *server, SecurityManager *securityManager, APSettingsService *apSettingsService); APStatus(PsychicHttpServer *server, SecurityManager *securityManager, APSettingsService *apSettingsService);