CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
host_api_wifi.cpp File Reference

WiFi host API - hold-counted acquire/release. More...

#include "cdc_hal/IWifiController.h"
#include "cdc_os_ui/WifiHandlers.h"
#include "plugin_manager/host_api.h"
#include <cstring>

Go to the source code of this file.

Functions

void plg_log_warn (const char *msg)
int host_wifi_request (uint32_t)
 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)
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

WiFi host API - hold-counted acquire/release.

Plugins call host_wifi_request() to ask the host to establish a connection, and host_wifi_release() to give it back. WifiHandlers tracks outstanding holders (plugin code + PluginManager prerequisites) and the user/system WiFi intent, so concurrent users don't tear down a connection another holder or the user still needs.

The prerequisite system also acquires a hold for a plugin that declares wifi_connected, so such a plugin gets WiFi up before plugin_on_enter without calling host_wifi_request itself.

Definition in file host_api_wifi.cpp.

Function Documentation

◆ host_wifi_mac()

int host_wifi_mac ( uint8_t * out)

Definition at line 77 of file host_api_wifi.cpp.

References HOST_ERR_GENERIC, HOST_ERR_INVALID_ARG, HOST_ERR_NOT_FOUND, and HOST_OK.

◆ plg_log_warn()

void plg_log_warn ( const char * msg)

Definition at line 20 of file plugin_log_bridge.cpp.