CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
WiFi

Request WiFi STA mode and inspect connection state. More...

Classes

struct  wifi_scan_result_t

Functions

int host_wifi_request (uint32_t timeout_ms)
 Request the shared WiFi radio and wait up to timeout_ms for join.
int host_wifi_release (void)
 Release the WiFi radio held by this plugin.
bool host_wifi_is_connected (void)
 True when WiFi STA is associated and has an IP.
int host_wifi_ssid (char *out, size_t out_size)
 Copy the currently joined SSID into out.
int host_wifi_ip (char *out, size_t out_size)
 Copy the current IPv4 address as dotted decimal into out.
int8_t host_wifi_rssi (void)
 Current AP signal strength in dBm.
int host_wifi_mac (uint8_t out[6])
 Read the station MAC address.
int host_wifi_start_scan (void)
 Start an asynchronous WiFi scan.
bool host_wifi_scan_done (void)
 True when the scan started by host_wifi_start_scan has finished.
int host_wifi_scan_results (wifi_scan_result_t *out, size_t *count)
 Read results from the last completed scan.

Detailed Description

Request WiFi STA mode and inspect connection state.

The WiFi radio is shared - acquire it with host_wifi_request before use and release it as early as possible. Requires manifest capability "wifi".

Function Documentation

◆ host_wifi_ip()

int host_wifi_ip ( char * out,
size_t out_size )

Copy the current IPv4 address as dotted decimal into out.

Definition at line 63 of file host_api_wifi.cpp.

References HOST_ERR_GENERIC, HOST_ERR_INVALID_ARG, HOST_ERR_NOT_FOUND, and HOST_OK.

Referenced by cdc::plugin_manager::w_host_wifi_ip().

◆ host_wifi_is_connected()

bool host_wifi_is_connected ( void )

True when WiFi STA is associated and has an IP.

Definition at line 45 of file host_api_wifi.cpp.

References cdc::ui::WifiHandlers::instance(), and cdc::ui::WifiHandlers::isConnected().

Referenced by cdc::plugin_manager::w_host_wifi_is_connected().

◆ host_wifi_mac()

int host_wifi_mac ( uint8_t out[6])

Read the station MAC address.

Referenced by cdc::plugin_manager::w_host_wifi_mac().

◆ host_wifi_release()

int host_wifi_release ( void )

Release the WiFi radio held by this plugin.

Definition at line 39 of file host_api_wifi.cpp.

References HOST_OK, cdc::ui::WifiHandlers::instance(), and cdc::ui::WifiHandlers::release().

Referenced by cdc::plugin_manager::w_host_wifi_release().

◆ host_wifi_request()

int host_wifi_request ( uint32_t timeout_ms)

Request the shared WiFi radio and wait up to timeout_ms for join.

Definition at line 34 of file host_api_wifi.cpp.

References cdc::ui::WifiHandlers::acquire(), HOST_ERR_TIMEOUT, HOST_OK, and cdc::ui::WifiHandlers::instance().

Referenced by cdc::plugin_manager::w_host_wifi_request().

◆ host_wifi_rssi()

int8_t host_wifi_rssi ( void )

Current AP signal strength in dBm.

Definition at line 71 of file host_api_wifi.cpp.

Referenced by cdc::plugin_manager::w_host_wifi_rssi().

◆ host_wifi_scan_done()

bool host_wifi_scan_done ( void )

True when the scan started by host_wifi_start_scan has finished.

Definition at line 92 of file host_api_wifi.cpp.

Referenced by cdc::plugin_manager::w_host_wifi_scan_done().

◆ host_wifi_scan_results()

int host_wifi_scan_results ( wifi_scan_result_t * out,
size_t * count )

◆ host_wifi_ssid()

int host_wifi_ssid ( char * out,
size_t out_size )

Copy the currently joined SSID into out.

Definition at line 50 of file host_api_wifi.cpp.

References HOST_ERR_INVALID_ARG, HOST_ERR_NOT_FOUND, and HOST_OK.

Referenced by cdc::plugin_manager::w_host_wifi_ssid().

◆ host_wifi_start_scan()

int host_wifi_start_scan ( void )

Start an asynchronous WiFi scan.

Definition at line 85 of file host_api_wifi.cpp.

References HOST_ERR_GENERIC, HOST_ERR_NOT_FOUND, and HOST_OK.

Referenced by cdc::plugin_manager::w_host_wifi_start_scan().