21 #ifndef EMBAJAXOUTPUTDRIVERESPASYNC_H
22 #define EMBAJAXOUTPUTDRIVERESPASYNC_H
24 #if defined (EMBAJAX_OUTUPUTDRIVER_IMPLEMENTATION)
25 #error Duplicate definition of output driver. Fix your include-directives.
27 #define EMBAJAX_OUTUPUTDRIVER_IMPLEMENTATION
32 #include <ESPAsyncWebServer.h>
34 #define EmbAJAXOutputDriverWebServerClass AsyncWebServer
49 void printHeader(
bool html)
override {
50 _response = _request->beginResponseStream(html ?
"text/html" :
"text/json");
52 void printContent(
const char *content)
override {
53 _response->print(content);
55 const char* getArg(
const char* name,
char* buf,
int buflen)
override {
56 _request->arg(name).toCharArray (buf, buflen);
60 _server->on(path, [=](AsyncWebServerRequest* request) {
63 if (_request->method() == HTTP_POST) {
64 page->handleRequest(change_callback);
68 _request->send(_response);
74 EmbAJAXOutputDriverWebServerClass *_server;
75 AsyncWebServerRequest *_request;
76 AsyncResponseStream *_response;
static void setDriver(EmbAJAXOutputDriverBase *driver)
Definition: EmbAJAX.h:77
Abstract base class for output drivers/server implementations.
Definition: EmbAJAX.h:147
Output driver implementation. This implementation works with ESPAsyncWebServer (https://github....
Definition: EmbAJAXOutputDriverESPAsync.h:40
EmbAJAXOutputDriverESPAsync(AsyncWebServer *server)
Definition: EmbAJAXOutputDriverESPAsync.h:44
void loopHook() override
Definition: EmbAJAXOutputDriverESPAsync.h:72
void installPage(EmbAJAXPageBase *page, const char *path, void(*change_callback)()=0) override
Definition: EmbAJAXOutputDriverESPAsync.h:59
Absrract internal helper class.
Definition: EmbAJAX.h:709