8 #include "lwip/netif.h" 20 static const char *
const TAG =
"wifi_pico_w";
23 if (sta.has_value()) {
25 cyw43_wifi_set_up(&cyw43_state, CYW43_ITF_STA,
true, CYW43_COUNTRY_WORLDWIDE);
30 cyw43_wifi_set_up(&cyw43_state, CYW43_ITF_AP,
true, CYW43_COUNTRY_WORLDWIDE);
40 pm = CYW43_PERFORMANCE_PM;
43 pm = CYW43_DEFAULT_PM;
46 pm = CYW43_AGGRESSIVE_PM;
49 int ret = cyw43_wifi_pm(&cyw43_state, pm);
60 auto ret = WiFi.begin(ap.get_ssid().c_str(), ap.get_password().c_str());
61 if (ret != WL_CONNECTED)
70 if (!manual_ip.has_value()) {
74 IPAddress ip_address = manual_ip->static_ip;
75 IPAddress gateway = manual_ip->gateway;
76 IPAddress subnet = manual_ip->subnet;
78 IPAddress dns = manual_ip->dns1;
80 WiFi.config(ip_address, dns, gateway, subnet);
98 int status = cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA);
100 case CYW43_LINK_JOIN:
101 case CYW43_LINK_NOIP:
105 case CYW43_LINK_FAIL:
106 case CYW43_LINK_BADAUTH:
108 case CYW43_LINK_NONET:
121 std::copy(result->bssid, result->bssid + 6, bssid.begin());
122 std::string ssid(reinterpret_cast<const char *>(result->ssid));
123 WiFiScanResult res(bssid, ssid, result->channel, result->rssi, result->auth_mode != CYW43_AUTH_OPEN, ssid.empty());
132 cyw43_wifi_scan_options_t scan_options = {0};
133 scan_options.scan_type = passive ? 1 : 0;
136 ESP_LOGV(TAG,
"cyw43_wifi_scan failed!");
158 #endif // USE_WIFI_AP 161 int err = cyw43_wifi_leave(&cyw43_state, CYW43_ITF_STA);
167 uint8_t raw_bssid[6];
168 WiFi.BSSID(raw_bssid);
169 for (
size_t i = 0; i < bssid.size(); i++)
170 bssid[i] = raw_bssid[i];
180 for (
auto addr : addrList) {
181 addresses[index++] = addr.ipFromNetifNum();
188 const ip_addr_t *dns_ip = dns_getserver(num);
195 ESP_LOGV(TAG,
"Scan done!");
WiFiSTAConnectStatus wifi_sta_connect_status_()
std::array< uint8_t, 6 > bssid_t
const std::string & get_password() const
WiFiPowerSaveMode power_save_
WiFiComponentState state_
network::IPAddress wifi_dns_ip_(int num)
network::IPAddresses wifi_sta_ip_addresses()
bool wifi_mode_(optional< bool > sta, optional< bool > ap)
bool wifi_apply_output_power_(float output_power)
bool wifi_sta_ip_config_(optional< ManualIP > manual_ip)
network::IPAddress wifi_subnet_mask_()
bool wifi_apply_hostname_()
std::vector< WiFiScanResult > scan_result_
WiFi is in STA-only mode and currently scanning for APs.
bool wifi_start_ap_(const WiFiAP &ap)
const optional< uint8_t > & get_channel() const
BedjetMode mode
BedJet operating mode.
bool wifi_apply_power_save_()
Application App
Global storage of Application pointer - only one Application can exist.
bool wifi_ap_ip_config_(optional< ManualIP > manual_ip)
WiFiComponent * global_wifi_component
const std::string & get_name() const
Get the name of this Application set by pre_setup().
std::array< IPAddress, 5 > IPAddresses
network::IPAddress wifi_soft_ap_ip()
bool wifi_sta_pre_setup_()
const char * get_auth_mode_str(uint8_t mode)
network::IPAddress wifi_gateway_ip_()
bool wifi_scan_start_(bool passive)
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
const std::string & get_ssid() const
const char * get_disconnect_reason_str(uint8_t reason)
static int s_wifi_scan_result(void *env, const cyw43_ev_scan_result_t *result)
value_type value_or(U const &v) const
bool wifi_sta_connect_(const WiFiAP &ap)
void wifi_scan_result(void *env, const cyw43_ev_scan_result_t *result)