mirror of
https://github.com/lumapu/ahoy.git
synced 2025-08-06 09:58:23 +02:00
refactored directory structure
This commit is contained in:
parent
58bc1f1d8a
commit
fbad251236
46 changed files with 47 additions and 66 deletions
83
src/web/webApi.h
Normal file
83
src/web/webApi.h
Normal file
|
@ -0,0 +1,83 @@
|
|||
#ifndef __WEB_API_H__
|
||||
#define __WEB_API_H__
|
||||
|
||||
#include "../utils/dbg.h"
|
||||
#ifdef ESP32
|
||||
#include "AsyncTCP.h"
|
||||
#else
|
||||
#include "ESPAsyncTCP.h"
|
||||
#endif
|
||||
#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);
|
||||
|
||||
uint32_t getTimezoneOffset() {
|
||||
return mTimezoneOffset;
|
||||
}
|
||||
|
||||
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 onDwnldSetup(AsyncWebServerRequest *request);
|
||||
|
||||
void getSysInfo(JsonObject obj);
|
||||
void getHtmlSystem(JsonObject obj);
|
||||
void getHtmlLogout(JsonObject obj);
|
||||
void getHtmlSave(JsonObject obj);
|
||||
void getReboot(JsonObject obj);
|
||||
void getStatistics(JsonObject obj);
|
||||
void getInverterList(JsonObject obj);
|
||||
void getMqtt(JsonObject obj);
|
||||
void getNtp(JsonObject obj);
|
||||
void getSun(JsonObject obj);
|
||||
void getPinout(JsonObject obj);
|
||||
void getRadio(JsonObject obj);
|
||||
void getSerial(JsonObject obj);
|
||||
void getStaticIp(JsonObject obj);
|
||||
|
||||
void getMenu(JsonObject obj);
|
||||
void getIndex(JsonObject obj);
|
||||
void getSetup(JsonObject obj);
|
||||
void getNetworks(JsonObject obj);
|
||||
void getLive(JsonObject obj);
|
||||
void getRecord(JsonObject obj, record_t<> *rec);
|
||||
|
||||
bool setCtrl(JsonObject jsonIn, JsonObject jsonOut);
|
||||
bool setSetup(JsonObject jsonIn, JsonObject jsonOut);
|
||||
|
||||
Inverter<> *getInverter(JsonObject jsonIn, JsonObject jsonOut);
|
||||
|
||||
double round3(double value) {
|
||||
return (int)(value * 1000 + 0.5) / 1000.0;
|
||||
}
|
||||
|
||||
String ip2String(uint8_t ip[]) {
|
||||
char str[16];
|
||||
snprintf(str, 16, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
|
||||
return String(str);
|
||||
}
|
||||
|
||||
AsyncWebServer *mSrv;
|
||||
app *mApp;
|
||||
|
||||
config_t *mConfig;
|
||||
sysConfig_t *mSysCfg;
|
||||
statistics_t *mStat;
|
||||
char *mVersion;
|
||||
|
||||
uint32_t mTimezoneOffset;
|
||||
};
|
||||
|
||||
#endif /*__WEB_API_H__*/
|
Loading…
Add table
Add a link
Reference in a new issue