ahoy/tools/esp8266/webApi.h
lumapu 6bd7e01f1a * started to implement POST api
* improved web serial console
* added multi inverter total values (published through MQTT)
* fixed: after boot there were transferred wrong data because of incorrect assignment (mqtt, visualization)
  -> not tested with sun
2022-09-10 02:19:25 +02:00

52 lines
1.4 KiB
C++

#ifndef __WEB_API_H__
#define __WEB_API_H__
#include "dbg.h"
#include "ESPAsyncTCP.h"
#include "ESPAsyncWebServer.h"
#include "AsyncJson.h"
#include "app.h"
class app;
class webApi {
public:
webApi(AsyncWebServer *srv, app *app, sysConfig_t *sysCfg, config_t *config, statistics_t *stat, char version[]);
void setup(void);
void loop(void);
private:
void onApi(AsyncWebServerRequest *request);
void onApiPost(AsyncWebServerRequest *request);
void onApiPostBody(AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total);
void getNotFound(JsonObject obj, String url);
void getSystem(JsonObject obj);
void getStatistics(JsonObject obj);
void getInverterList(JsonObject obj);
void getMqtt(JsonObject obj);
void getNtp(JsonObject obj);
void getPinout(JsonObject obj);
void getRadio(JsonObject obj);
void getSerial(JsonObject obj);
void getIndex(JsonObject obj);
void getSetup(JsonObject obj);
void getLive(JsonObject obj);
bool setCtrl(DynamicJsonDocument jsonIn, JsonObject jsonOut);
Inverter<> *getInverter(DynamicJsonDocument jsonIn, JsonObject jsonOut);
AsyncWebServer *mSrv;
app *mApp;
config_t *mConfig;
sysConfig_t *mSysCfg;
statistics_t *mStat;
char *mVersion;
};
#endif /*__WEB_API_H__*/