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

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include <ESP8266WebServer.h>
  3. #include <stdarg.h>
  4. #include "filesys.h"
  5. // debug log <ESP8266WebServer.h>
  6. // #define DEBUGV(f,...) do { Serial.printf(PSTR(f), ##__VA_ARGS__); } while (0)
  7. #define LOG_STR "[HTTPServer]"
  8. class HTTPServer : public ESP8266WebServer {
  9. private:
  10. const char* rootDir = "/";
  11. void listRoot() {
  12. ls(rootDir);
  13. }
  14. void logf(const char *format, ...) {
  15. va_list args;
  16. va_start(args, format);
  17. Serial.print(LOG_STR);
  18. Serial.printf(format, args);
  19. va_end(args);
  20. }
  21. public:
  22. HTTPServer(const int _port, const char* _rootDir) :
  23. ESP8266WebServer(_port), rootDir(_rootDir)
  24. { }
  25. ~HTTPServer()
  26. {
  27. Serial.printf("[HTTPServer] shut down ...\n\r");
  28. }
  29. bool start();
  30. };