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

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #include "treppe.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. Treppe* treppe;
  20. public:
  21. HTTPServer(const int _port, const char* _rootDir, Treppe* _treppe) :
  22. ESP8266WebServer(_port), rootDir(_rootDir), treppe(_treppe)
  23. { }
  24. ~HTTPServer()
  25. {
  26. Serial.printf("[HTTPServer] shut down ...\n\r");
  27. }
  28. bool start();
  29. void start_apps();
  30. void logf(const char *format, ...);
  31. void logt(const char *format, ...);
  32. };