Logo Pico-Framework A web-first embedded framework for C++
Loading...
Searching...
No Matches
Network.h
Go to the documentation of this file.
1
17#ifndef NETWORK_H
18#define NETWORK_H
19#pragma once
20
21#include <pico/cyw43_arch.h>
22
26 class Network
27 {
28 public:
29
36 static bool initialize();
37
44 static bool startWifiWithResilience();
45
54 static bool checkAndReconnect();
55
64 static bool tryConnect(int attempts);
65
72 static bool restart_wifi();
73
77 static void wifi_deinit();
78
84 static int getLinkStatus(int lastStatus);
85
91 static bool isConnected();
92
98 static char *getIpAddress()
99 {
100 return ip4addr_ntoa(netif_ip4_addr(netif_list));
101 }
102
103 private:
104 static bool wifiConnected;
105 static bool wifiInitialized;
106 };
107
108#endif /* NETWORK_H */
Static class providing Wi-Fi and network control on the Pico W.
Definition Network.h:27
static bool initialize()
Start Wi-Fi with resilience, retrying connection if it fails.
Definition Network.cpp:41
static bool wifiConnected
Make the Wi-Fi connection in station mode Requires WIFI_SSID and WIFI_PASSWORD to be set in the envir...
Definition Network.h:104
static char * getIpAddress()
Get the IP address.
Definition Network.h:98
static bool checkAndReconnect()
Attempt to connect to Wi-Fi with retries.
Definition Network.cpp:84
static bool wifiInitialized
Definition Network.h:105
static bool startWifiWithResilience()
Start Wi-Fi with resilience, retrying connection if it fails.
Definition Network.cpp:63
static bool tryConnect(int attempts)
Try to connect to Wi-Fi network.
Definition Network.cpp:97
static bool isConnected()
Check whether the device is connected to Wi-Fi.
Definition Network.cpp:144
static void wifi_deinit()
Deinitialize the CYW43 Wi-Fi stack.
Definition Network.cpp:160
static bool restart_wifi()
Restart the Wi-Fi interface.
Definition Network.cpp:149
static int getLinkStatus(int lastStatus)
Get the current link status from the Wi-Fi interface.
Definition Network.cpp:173