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

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