137 userEnabled_ = enabled;
138 persistUserEnabled(enabled);
181 bool syncNtp(
bool disconnectAfter =
true);
194 const char* lastError_ =
nullptr;
196 bool userEnabled_ =
false;
199 static bool isValidIpOctet(
int val);
200 uint32_t parseIpAddress(
const char* ip)
const;
202 void persistUserEnabled(
bool enabled);
bool setUserEnabled(bool enabled)
Sets the user/system WiFi intent and applies it immediately.
bool connect()
Connects to Wi-Fi using saved configuration.
static bool isValidIpAddress(const char *ip)
Validates dotted IPv4 address string.
bool syncNtp(bool disconnectAfter=true)
Synchronizes system time via NTP.
void saveCredentials(const char *ssid, const char *password)
Stores credentials directly (WPA2-PSK, DHCP) and persists them.
bool ensureConnected()
Ensures the device is connected to WiFi and optionally syncs time, leaving the connection up for the ...
void persistUserIntent(bool enabled)
Persists the user/system WiFi intent without bringing the radio up or down.
bool setConnectTimeoutMs(uint32_t ms)
Persists the connect timeout to NVS.
void release()
Releases a previously acquired WiFi hold.
const char * getLastError() const
void saveConfig()
Saves current wizard Wi-Fi configuration to NVS.
bool acquire()
Acquires a hold on the WiFi connection for a plugin/host caller.
void restoreOnBoot()
Restores the persisted WiFi intent at boot.
static WifiHandlers & instance()
Returns singleton Wi-Fi handlers instance.
uint32_t getConnectTimeoutMs() const
Reads the persisted connect timeout (NVS key "tout").
bool isUserEnabled() const
Returns the persisted user/system WiFi intent.
void loadConfig()
Loads Wi-Fi configuration from NVS.
void disconnect()
Disconnects and disables Wi-Fi if active.
void clearConfig()
Erases the entire "wifi" NVS namespace and invalidates the cached configuration.
bool isConnected() const
Returns whether Wi-Fi is currently connected.
Centralized key-code constants for cdc_views.
static constexpr uint32_t WIFI_CONNECT_TIMEOUT_DEFAULT_MS
static constexpr uint32_t WIFI_SCAN_TIMEOUT_MS
static constexpr uint32_t WIFI_CONNECT_TIMEOUT_MIN_MS
static constexpr uint32_t NTP_SYNC_TIMEOUT_MS
static constexpr uint32_t WIFI_CONNECT_TIMEOUT_MAX_MS
hal::WifiSecurity security
void reset()
Resets Wi-Fi wizard state to defaults.