ESP8266 Treppenlichtsteuerung mit OTA zum Firmware Upload
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

httpserver.h 893B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Wrapper for ESP8266WebServer with Filesystem as HTTP source
  2. #pragma once
  3. #include <vector>
  4. #include <ESP8266WebServer.h>
  5. #include <stdarg.h>
  6. #include "filesys.h"
  7. // debug log <ESP8266WebServer.h>
  8. // #define DEBUGV(f,...) do { Serial.printf(PSTR(f), ##__VA_ARGS__); } while (0)
  9. #define TBUF_LEN 256
  10. class HTTPServer : public ESP8266WebServer {
  11. private:
  12. const char* rootDir = "/";
  13. const char* log_prefix = "[HTTPServer] ";
  14. size_t tbuf_head = 0;
  15. char tbuf[TBUF_LEN];
  16. void listRoot() {
  17. ls(rootDir);
  18. }
  19. public:
  20. HTTPServer(const int _port, const char* _rootDir) :
  21. ESP8266WebServer(_port), rootDir(_rootDir)
  22. { }
  23. ~HTTPServer()
  24. {
  25. Serial.printf("[HTTPServer] shut down ...\n\r");
  26. }
  27. bool start();
  28. void start_apps();
  29. void logf(const char *format, ...);
  30. void logt(const char *format, ...);
  31. };