/// © MiroZ 2024 #ifndef __WIFI_H__ #define __WIFI_H__ #include #include #include "Settings.h" #include "TaskMgr.h" #define _USE_TIMER class Wifi { public: typedef enum { NOT_CONNECTED, PENDING, NOT_PROVISIONED, CONNECTED } WIFI_STATUS; protected: uint8_t m_ignored[SETTINGS_NUM_WIFI_ENTRIES]; WIFI_STATUS m_wifi_status = WIFI_STATUS::NOT_CONNECTED; #ifdef USE_TIMER esp_timer_handle_t m_timer; static void timerCallback(void* arg); #endif TaskHandle_t m_task = nullptr; void task(); WIFI_STATUS startConnecting(); WIFI_STATUS connectTo(int index); int scan(); bool m_pause = false; public: Wifi(); protected: void wifi_event(arduino_event_id_t event, arduino_event_info_t info); public: int start(); void pause(bool pause); WIFI_STATUS status() { return m_wifi_status; } WIFI_STATUS waitForConnection(); private: WIFI_STATUS connectToDefault(); }; #endif /* __WIFI_H__ */