Skip to main content

Crate wifi_ctrl

Crate wifi_ctrl 

Source
Expand description

Tokio-based runtimes for communicating with hostapd and wpa-supplicant.

Use sta to run a WiFi station (network client) against wpa_supplicant, and ap to run an access point against hostapd.

§Quick Start

use wifi_ctrl::sta;

#[tokio::main]
async fn main() -> wifi_ctrl::Result {
    let mut setup = sta::WifiSetup::new();
    setup.set_socket_path("/var/run/wpa_supplicant/wlan0");
    let requester = setup.get_request_client();
    let mut runtime = setup.complete();
    tokio::spawn(async move { runtime.run().await });

    let scan = requester.get_scan().await?;
    for network in scan.iter() {
        println!("{} {}", network.signal, network.name);
    }
    requester.shutdown().await
}

See the examples on Github for complete station and access-point programs.

Modules§

ap
WiFi Access Point runtime and types
error
Crate-wide error types
sta
WiFi Station (network client) runtime and types

Type Aliases§

ParseResult
Result
SocketResult