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

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef __HTTPSERVER_H
  2. #define __HTTPSERVER_H
  3. // Wrapper for ESP8266WebServer with Filesystem as HTTP source
  4. #include <ESP8266WebServer.h>
  5. #include <stdarg.h>
  6. #include "filesys.h"
  7. #include "treppe.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() {
  18. ls(rootDir);
  19. }
  20. Treppe* treppe;
  21. public:
  22. HTTPServer(const int _port, const char* _rootDir, Treppe* _treppe) :
  23. ESP8266WebServer(_port), rootDir(_rootDir), treppe(_treppe)
  24. { }
  25. ~HTTPServer()
  26. {
  27. Serial.printf("[HTTPServer] shut down ...\n\r");
  28. }
  29. bool start();
  30. void start_apps();
  31. void logf(const char *format, ...);
  32. void logt(const char *format, ...);
  33. };
  34. #endif // __HTTPSERVER_H