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 868B

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