mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
working wersion with elements
This commit is contained in:
@@ -14,4 +14,6 @@ String jsonWriteInt(String& json, String name, int value);
|
||||
|
||||
String jsonWriteFloat(String& json, String name, float value);
|
||||
|
||||
String jsonWriteBool(String& json, String name, boolean value);
|
||||
String jsonWriteBool(String& json, String name, boolean value);
|
||||
|
||||
void saveConfig();
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "Utils\StringUtils.h"
|
||||
#include "Utils\TimeUtils.h"
|
||||
#include "Errors.h"
|
||||
#include "Global.h"
|
||||
|
||||
|
||||
#define pm PrintMessage(MODULE)
|
||||
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "Global.h"
|
||||
|
||||
const String getChipId();
|
||||
|
||||
void setLedStatus(LedStatus_t status);
|
||||
|
||||
const String getUniqueId(const String& name);
|
||||
|
||||
const String printMemoryStatus();
|
||||
|
||||
const String getHeapStats();
|
||||
|
||||
const String getMacAddress();
|
||||
const String getMacAddress();
|
||||
|
||||
void setChipId();
|
||||
@@ -1,73 +1,7 @@
|
||||
#pragma once
|
||||
#include "HttpServer.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "ESPAsyncWebServer.h"
|
||||
|
||||
const String getMethodName(AsyncWebServerRequest* request) {
|
||||
String res = F("UNKNOWN");
|
||||
if (request->method() == HTTP_GET)
|
||||
res = F("GET");
|
||||
else if (request->method() == HTTP_POST)
|
||||
res = F("POST");
|
||||
else if (request->method() == HTTP_DELETE)
|
||||
res = F("DELETE");
|
||||
else if (request->method() == HTTP_PUT)
|
||||
res = F("PUT");
|
||||
else if (request->method() == HTTP_PATCH)
|
||||
res = F("PATCH");
|
||||
else if (request->method() == HTTP_HEAD)
|
||||
res = F("HEAD");
|
||||
else if (request->method() == HTTP_OPTIONS)
|
||||
res = F("OPTIONS");
|
||||
return res;
|
||||
}
|
||||
|
||||
const String getRequestInfo(AsyncWebServerRequest* request) {
|
||||
String res = getMethodName(request);
|
||||
res += ' ';
|
||||
res += "http://";
|
||||
res += request->host();
|
||||
res += request->url();
|
||||
res += '\n';
|
||||
if (request->contentLength()) {
|
||||
res += "content-type: ";
|
||||
res += request->contentType();
|
||||
res += " content-lenght: ";
|
||||
res += prettyBytes(request->contentLength());
|
||||
res += '\n';
|
||||
}
|
||||
|
||||
if (request->headers()) {
|
||||
res += "headers:\n";
|
||||
for (size_t i = 0; i < request->headers(); i++) {
|
||||
AsyncWebHeader* h = request->getHeader(i);
|
||||
res += h->name();
|
||||
res += '=';
|
||||
res += h->value();
|
||||
res += '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (request->params()) {
|
||||
res += "params:\n";
|
||||
for (size_t i = 0; i < request->params(); i++) {
|
||||
AsyncWebParameter* p = request->getParam(i);
|
||||
if (p->isFile()) {
|
||||
res += "FILE";
|
||||
} else if (p->isPost()) {
|
||||
res += "POST";
|
||||
} else {
|
||||
res += "GET";
|
||||
}
|
||||
res += ' ';
|
||||
res += p->name();
|
||||
res += ':';
|
||||
res += p->value();
|
||||
if (p->isFile()) {
|
||||
res += " size:";
|
||||
res += p->size();
|
||||
}
|
||||
res += '\n';
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
extern String getURL(const String& urls);
|
||||
extern const String getMethodName(AsyncWebServerRequest* request);
|
||||
extern const String getRequestInfo(AsyncWebServerRequest* request);
|
||||
Reference in New Issue
Block a user