Skip to content

Commit

Permalink
add method to set the bssid for a network
Browse files Browse the repository at this point in the history
  • Loading branch information
aj-bagwell authored and lthiery committed May 22, 2024
1 parent b58eb3b commit 4a86d84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/sta/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ impl ShutdownSignal for Request {
#[derive(Debug)]
pub(crate) enum SetNetwork {
Ssid(String),
Bssid(String),
Psk(String),
KeyMgmt(KeyMgmt),
}
Expand Down Expand Up @@ -161,6 +162,17 @@ impl RequestClient {
request.await?
}

pub async fn set_network_bssid(&self, network_id: usize, bssid: String) -> Result {
let (response, request) = oneshot::channel();
self.send_request(Request::SetNetwork(
network_id,
SetNetwork::Bssid(bssid),
response,
))
.await?;
request.await?
}

pub async fn set_network_keymgmt(&self, network_id: usize, mgmt: KeyMgmt) -> Result {
let (response, request) = oneshot::channel();
self.send_request(Request::SetNetwork(
Expand Down
1 change: 1 addition & 0 deletions src/sta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ impl WifiStation {
"SET_NETWORK {id} {}",
match param {
SetNetwork::Ssid(ssid) => format!("ssid \"{ssid}\""),
SetNetwork::Bssid(bssid) => format!("bssid \"{bssid}\""),
SetNetwork::Psk(psk) => format!("psk \"{psk}\""),
SetNetwork::KeyMgmt(mgmt) => format!("key_mgmt {}", mgmt.to_string()),
}
Expand Down

0 comments on commit 4a86d84

Please sign in to comment.