#ifndef NETWORK_H #define NETWORK_H #include "esp_log.h" #include #include #ifdef ESP32 #include #include #include #include #elif defined(ESP8266) #include #include #include #endif //#include //#include //#include //#include // OTA #include #include #include // OTA class WiFiManager { public: WiFiManager(); void begin(); void connectToWiFi(); void setupAccessPoint(const char *newSSID, const char *newPassword); void checkWiFiConnection(); void updateLED(); void setupMDNS(); void ReadConnection(); bool isConnected(); // Zwraca stan połączenia bool convertCharToIPAddress(const char *str, IPAddress& ip); void ledBlink(); // Z innego projektu - niepotrzebne, bo nie ma LED WiFi... bool isWiFiOK(); // True, gdy WiFi połączone i false, gdy brak połączenia int rssiToPercent(int rssi); // rssi na procenty int8_t getRSSI(); void handleClient(); void startCaptivePortal(); void handleRoot(); void handleSave(); void handleNotFound(); /** * Aktualizacja systemu przez internet z adresu config.updateUrl. * @param allowInsecureTLS true => dla https wyłącz weryfikację certyfikatu. * @param progressCb callback progress (opcjonalnie) (bytes, total). * @return true, jeśli update zakończony sukcesem (urządzenie się zrestartuje). */ bool performOTAUpdate(bool allowInsecureTLS = true, std::function progressCb = nullptr); int8_t rssi = 0; bool useDHCP = true; IPAddress local_IP; IPAddress gateway; IPAddress subnet; IPAddress dns; String ssidAP = "ACCEL666"; String passwordAP = "12345678"; private: bool isAccessPoint = false; bool captivePortalActive = false; WebServer server{80}; DNSServer dnsServer; int expectedCaptchaAnswer = 0; }; #endif // WIFIMANAGER_H