I want to read a binary body datas from an HTTP POST request.
The context is that I'm making a LED strip controller and I'm currently using this code :
#include <WebServer.h>
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel strip = Adafruit_NeoPixel(LED_COUNT, STRIP_PIN, NEO_GRB | NEO_KHZ800);
WebServer server(80);
void handleSimpleWrite()
{
int r = 0, g = 0, b = 0;
if (server.hasArg("red"))
r = server.arg("red").toInt();
if (server.hasArg("green"))
g = server.arg("green").toInt();
if (server.hasArg("blue"))
b = server.arg("blue").toInt();
strip.setPixelColor(id, r, g, b);
strip.show()
server.send(200,"Ok");
}
It works, but it's clearly innefficient. I want to make an API endpoint that get a binary buffer with RGB states along the request body and I can't figure out how to read this body.
Any ideas ?
arg("plain")
. esp32 doesn't have it. can't you use plain WiFiServer? – Juraj Jan 25 '20 at 18:54arg("plain")
is stay working when looking in the source code. I will edit libraries/WebServer/src/Parsing.cpp to fit my needs. – Devilish Spirits Jan 25 '20 at 19:58