WebServer.h 598 B

1234567891011121314151617181920212223242526
  1. #ifndef _WEBSERVER_H
  2. #define _WEBSERVER_H
  3. #include <Arduino.h>
  4. #include <ArduinoJson.h>
  5. #include <ESP8266WebServer.h>
  6. #include <PatternHandler.h>
  7. class WebServer : public ESP8266WebServer {
  8. public:
  9. WebServer(int port) : ESP8266WebServer(port) { }
  10. bool matchesPattern(const String& pattern, const String& url);
  11. void onPattern(const String& pattern, const HTTPMethod method, PatternHandler::TPatternHandlerFn fn);
  12. inline bool clientConnected() {
  13. return _currentClient && _currentClient.connected();
  14. }
  15. private:
  16. void resetPathMatches();
  17. void checkPatterns();
  18. };
  19. #endif