Static class providing Wi-Fi and network control on the Pico W. More...
#include <Network.h>
Static Public Member Functions | |
static bool | initialize () |
Start Wi-Fi with resilience, retrying connection if it fails. | |
static bool | startWifiWithResilience () |
Start Wi-Fi with resilience, retrying connection if it fails. | |
static bool | checkAndReconnect () |
Attempt to connect to Wi-Fi with retries. | |
static bool | tryConnect (int attempts) |
Try to connect to Wi-Fi network. | |
static bool | restart_wifi () |
Restart the Wi-Fi interface. | |
static void | wifi_deinit () |
Deinitialize the CYW43 Wi-Fi stack. | |
static int | getLinkStatus (int lastStatus) |
Get the current link status from the Wi-Fi interface. | |
static bool | isConnected () |
Check whether the device is connected to Wi-Fi. | |
static char * | getIpAddress () |
Get the IP address. | |
Static Private Attributes | |
static bool | wifiConnected = false |
Make the Wi-Fi connection in station mode Requires WIFI_SSID and WIFI_PASSWORD to be set in the environment. | |
static bool | wifiInitialized = false |
|
static |
This method will try to connect to the Wi-Fi network defined by WIFI_SSID and WIFI_PASSWORD. It will retry up to a maximum number of attempts defined by WIFI_MAX_RETRIES.
attempts | Number of connection attempts to make. |
Definition at line 84 of file Network.cpp.
References getLinkStatus(), isConnected(), and tryConnect().
Referenced by FrameworkManager::poll().
|
inlinestatic |
|
static |
Get the current link status from the Wi-Fi interface.
Definition at line 173 of file Network.cpp.
Referenced by checkAndReconnect(), and tryConnect().
|
static |
Uses a static method to handle retries and connection status.
Definition at line 41 of file Network.cpp.
References wifiInitialized.
Referenced by FrameworkManager::onStart(), and startWifiWithResilience().
|
static |
Check whether the device is connected to Wi-Fi.
Definition at line 144 of file Network.cpp.
References wifiConnected.
Referenced by checkAndReconnect(), and PicoModel::restoreState().
|
static |
This method will deinitialize and reinitialize the Wi-Fi stack.
Definition at line 149 of file Network.cpp.
References startWifiWithResilience(), and wifiConnected.
Referenced by FrameworkManager::poll().
|
static |
Uses a static method to handle retries and connection status.
Definition at line 63 of file Network.cpp.
References initialize(), tryConnect(), WIFI_MAX_RETRIES, and wifiInitialized.
Referenced by FrameworkManager::onStart(), and restart_wifi().
|
static |
This method will attempt to connect to the Wi-Fi network defined by WIFI_SSID and WIFI_PASSWORD. It will retry up to a maximum number of attempts defined by WIFI_MAX_RETRIES.
attempts | Number of connection attempts to make. |
Definition at line 97 of file Network.cpp.
References getLinkStatus(), WIFI_RETRY_TIMEOUT_MS, and wifiConnected.
Referenced by checkAndReconnect(), and startWifiWithResilience().
|
static |
Deinitialize the CYW43 Wi-Fi stack.
Definition at line 160 of file Network.cpp.
|
staticprivate |
Make the Wi-Fi connection in station mode Requires WIFI_SSID and WIFI_PASSWORD to be set in the environment.
Definition at line 104 of file Network.h.
Referenced by isConnected(), restart_wifi(), and tryConnect().
|
staticprivate |
Definition at line 105 of file Network.h.
Referenced by initialize(), and startWifiWithResilience().