mirror of
https://gitlab.com/zwirbel/illucat.git
synced 2025-12-16 18:05:05 +01:00
uncouple generic web stuff into api plugin
This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
#ifndef __WSUTILS_H___
|
||||
#define __WSUTILS_H___
|
||||
#ifndef __WebUtils_H___
|
||||
#define __WebUtils_H___
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include <AsyncWebSocket.h>
|
||||
#include <ESPAsyncTCP.h>
|
||||
|
||||
class WsUtils {
|
||||
class WebUtils {
|
||||
public:
|
||||
static String getRequestParameterOrDefault(AsyncWebServerRequest *request, String param, String defaultValue, bool isPost = true){
|
||||
if(request->hasParam(param, isPost)) {
|
||||
return request->getParam(param, isPost)->value();
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
static String parseFrame(AwsEventType type, void * arg, uint8_t *data, size_t len) {
|
||||
String msg = "";
|
||||
if(type == WS_EVT_DATA){
|
||||
Reference in New Issue
Block a user