🪄 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>
APStatus::APStatus(PsychicHttpServer *server,
SecurityManager *securityManager,
APSettingsService *apSettingsService) : _server(server),
_securityManager(securityManager),
_apSettingsService(apSettingsService)
{
}
void APStatus::begin()
{
_server->on(AP_STATUS_SERVICE_PATH,
HTTP_GET,
APStatus::APStatus(PsychicHttpServer *server, SecurityManager *securityManager, APSettingsService *apSettingsService)
: _server(server), _securityManager(securityManager), _apSettingsService(apSettingsService) {}
void APStatus::begin() {
_server->on(AP_STATUS_SERVICE_PATH, HTTP_GET,
_securityManager->wrapRequest(std::bind(&APStatus::apStatus, this, std::placeholders::_1),
AuthenticationPredicates::IS_AUTHENTICATED));
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);
JsonObject root = response.getRoot();
+3 -4
View File
@@ -25,14 +25,13 @@
#define AP_STATUS_SERVICE_PATH "/api/apStatus"
class APStatus
{
public:
class APStatus {
public:
APStatus(PsychicHttpServer *server, SecurityManager *securityManager, APSettingsService *apSettingsService);
void begin();
private:
private:
PsychicHttpServer *_server;
SecurityManager *_securityManager;
APSettingsService *_apSettingsService;