From e0256939141ab8e4670f58e87886d0266c1d462c Mon Sep 17 00:00:00 2001 From: Frostie314159 Date: Mon, 28 Aug 2023 21:34:14 +0200 Subject: [PATCH] cyw43: Create leave function on Control struct. Create a function, which disassociates us, from the currently connected infra. --- cyw43/src/consts.rs | 1 + cyw43/src/control.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/cyw43/src/consts.rs b/cyw43/src/consts.rs index 1f6551589..4e2836f3b 100644 --- a/cyw43/src/consts.rs +++ b/cyw43/src/consts.rs @@ -96,6 +96,7 @@ pub(crate) const IOCTL_CMD_UP: u32 = 2; pub(crate) const IOCTL_CMD_DOWN: u32 = 3; pub(crate) const IOCTL_CMD_SET_SSID: u32 = 26; pub(crate) const IOCTL_CMD_SET_CHANNEL: u32 = 30; +pub(crate) const IOCTL_CMD_DISASSOC: u32 = 52; pub(crate) const IOCTL_CMD_ANTDIV: u32 = 64; pub(crate) const IOCTL_CMD_SET_AP: u32 = 118; pub(crate) const IOCTL_CMD_SET_VAR: u32 = 263; diff --git a/cyw43/src/control.rs b/cyw43/src/control.rs index d2f6e4a03..a6d1f0bf5 100644 --- a/cyw43/src/control.rs +++ b/cyw43/src/control.rs @@ -433,6 +433,11 @@ impl<'a> Control<'a> { events: &self.events, } } + /// Leave the wifi, with which we are currently associated. + pub async fn leave(&mut self) { + self.ioctl(IoctlType::Set, IOCTL_CMD_DISASSOC, 0, &mut []).await; + info!("Disassociated") + } } pub struct Scanner<'a> {