the parameters to peform an HTTP request by the HTTP(S)+JSON power meter have been generalized by introducing a new config struct. this is now used for all values which the HTTP(S)+JSON power meter can retrieve, and also used by the HTTP+SML power meter implementation. we anticipate that other feature will use this config as well. generalizing also allows to share serialization and deserialization methods in the configuration handler and the web API handler, leading to de-duplication of code and reduced flash memory usage. a new web UI component is implemented to manage a set of HTTP request settings.
22 lines
609 B
C++
22 lines
609 B
C++
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
#pragma once
|
|
|
|
#include <ESPAsyncWebServer.h>
|
|
#include <TaskSchedulerDeclarations.h>
|
|
#include <ArduinoJson.h>
|
|
#include "Configuration.h"
|
|
|
|
class WebApiPowerMeterClass {
|
|
public:
|
|
void init(AsyncWebServer& server, Scheduler& scheduler);
|
|
|
|
private:
|
|
void onStatus(AsyncWebServerRequest* request);
|
|
void onAdminGet(AsyncWebServerRequest* request);
|
|
void onAdminPost(AsyncWebServerRequest* request);
|
|
void onTestHttpJsonRequest(AsyncWebServerRequest* request);
|
|
void onTestHttpSmlRequest(AsyncWebServerRequest* request);
|
|
|
|
AsyncWebServer* _server;
|
|
};
|