2021-07-02 17:51:16 +02:00

43 lines
868 B
C++

// Wrapper for ESP8266WebServer with Filesystem as HTTP source
#pragma once
#include <ESP8266WebServer.h>
#include <stdarg.h>
#include "filesys.h"
// debug log <ESP8266WebServer.h>
// #define DEBUGV(f,...) do { Serial.printf(PSTR(f), ##__VA_ARGS__); } while (0)
#define TBUF_LEN 256
class HTTPServer : public ESP8266WebServer {
private:
const char* rootDir = "/";
const char* log_prefix = "[HTTPServer] ";
size_t tbuf_head = 0;
char tbuf[TBUF_LEN];
void listRoot() {
ls(rootDir);
}
public:
HTTPServer(const int _port, const char* _rootDir) :
ESP8266WebServer(_port), rootDir(_rootDir)
{ }
~HTTPServer()
{
Serial.printf("[HTTPServer] shut down ...\n\r");
}
bool start();
void start_apps();
void logf(const char *format, ...);
void logt(const char *format, ...);
};