🪄 Formats APStatus
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user