Struct esp_wifi::wifi::WifiController
source · pub struct WifiController<'d> { /* private fields */ }
Expand description
A wifi controller
Implementations§
source§impl WifiController<'_>
impl WifiController<'_>
sourcepub async fn scan_n_async<const N: usize>(
&mut self,
) -> Result<(Vec<AccessPointInfo, N>, usize), WifiError>
pub async fn scan_n_async<const N: usize>( &mut self, ) -> Result<(Vec<AccessPointInfo, N>, usize), WifiError>
Async version of crate::wifi::WifiController
’s scan_n
method
sourcepub async fn scan_with_config_async<const N: usize>(
&mut self,
config: ScanConfig<'_>,
) -> Result<(Vec<AccessPointInfo, N>, usize), WifiError>
pub async fn scan_with_config_async<const N: usize>( &mut self, config: ScanConfig<'_>, ) -> Result<(Vec<AccessPointInfo, N>, usize), WifiError>
An async wifi network scan with caller-provided scanning options.
sourcepub async fn start_async(&mut self) -> Result<(), WifiError>
pub async fn start_async(&mut self) -> Result<(), WifiError>
Async version of crate::wifi::WifiController
’s start
method
sourcepub async fn stop_async(&mut self) -> Result<(), WifiError>
pub async fn stop_async(&mut self) -> Result<(), WifiError>
Async version of crate::wifi::WifiController
’s stop
method
sourcepub async fn connect_async(&mut self) -> Result<(), WifiError>
pub async fn connect_async(&mut self) -> Result<(), WifiError>
Async version of crate::wifi::WifiController
’s connect
method
sourcepub async fn disconnect_async(&mut self) -> Result<(), WifiError>
pub async fn disconnect_async(&mut self) -> Result<(), WifiError>
Async version of crate::wifi::WifiController
’s Disconnect
method
sourcepub async fn wait_for_event(&mut self, event: WifiEvent)
pub async fn wait_for_event(&mut self, event: WifiEvent)
Wait for one WifiEvent
.
sourcepub async fn wait_for_events(
&mut self,
events: EnumSet<WifiEvent>,
clear_pending: bool,
) -> EnumSet<WifiEvent>
pub async fn wait_for_events( &mut self, events: EnumSet<WifiEvent>, clear_pending: bool, ) -> EnumSet<WifiEvent>
Wait for one of multiple WifiEvent
s. Returns the events that
occurred while waiting.
sourcepub async fn wait_for_all_events(
&mut self,
events: EnumSet<WifiEvent>,
clear_pending: bool,
)
pub async fn wait_for_all_events( &mut self, events: EnumSet<WifiEvent>, clear_pending: bool, )
Wait for multiple WifiEvent
s.
source§impl<'d> WifiController<'d>
impl<'d> WifiController<'d>
sourcepub fn take_sniffer(&self) -> Option<Sniffer>
pub fn take_sniffer(&self) -> Option<Sniffer>
Attempts to take the sniffer, returns Some(Sniffer)
if successful,
otherwise None
.
sourcepub fn set_protocol(
&mut self,
protocols: EnumSet<Protocol>,
) -> Result<(), WifiError>
pub fn set_protocol( &mut self, protocols: EnumSet<Protocol>, ) -> Result<(), WifiError>
sourcepub fn set_power_saving(&mut self, ps: PowerSaveMode) -> Result<(), WifiError>
pub fn set_power_saving(&mut self, ps: PowerSaveMode) -> Result<(), WifiError>
Configures modem power saving
sourcepub fn is_sta_enabled(&self) -> Result<bool, WifiError>
pub fn is_sta_enabled(&self) -> Result<bool, WifiError>
Checks if Wi-Fi is enabled as a station.
sourcepub fn is_ap_enabled(&self) -> Result<bool, WifiError>
pub fn is_ap_enabled(&self) -> Result<bool, WifiError>
Checks if Wi-Fi is enabled as an access p.
sourcepub fn scan_with_config_sync<const N: usize>(
&mut self,
config: ScanConfig<'_>,
) -> Result<(Vec<AccessPointInfo, N>, usize), WifiError>
pub fn scan_with_config_sync<const N: usize>( &mut self, config: ScanConfig<'_>, ) -> Result<(Vec<AccessPointInfo, N>, usize), WifiError>
A blocking wifi network scan with caller-provided scanning options.
sourcepub fn scan_n<const N: usize>(
&mut self,
) -> Result<(Vec<AccessPointInfo, N>, usize), WifiError>
pub fn scan_n<const N: usize>( &mut self, ) -> Result<(Vec<AccessPointInfo, N>, usize), WifiError>
A blocking wifi network scan with default scanning options.
sourcepub fn disconnect(&mut self) -> Result<(), WifiError>
pub fn disconnect(&mut self) -> Result<(), WifiError>
Disconnects the WiFi controller from a network.
source§impl WifiController<'_>
impl WifiController<'_>
sourcepub fn capabilities(&self) -> Result<EnumSet<Capability>, WifiError>
pub fn capabilities(&self) -> Result<EnumSet<Capability>, WifiError>
Get the supported capabilities of the controller.
sourcepub fn configuration(&self) -> Result<Configuration, WifiError>
pub fn configuration(&self) -> Result<Configuration, WifiError>
Get the currently used configuration.
sourcepub fn set_configuration(
&mut self,
conf: &Configuration,
) -> Result<(), WifiError>
pub fn set_configuration( &mut self, conf: &Configuration, ) -> Result<(), WifiError>
Set the configuration, you need to use Wifi::connect() for connecting to an AP.
This will replace any previously set configuration
sourcepub fn is_started(&self) -> Result<bool, WifiError>
pub fn is_started(&self) -> Result<bool, WifiError>
Checks if the WiFi controller has started.
This function should be called after the start
method to verify if the
WiFi has started successfully.
sourcepub fn is_connected(&self) -> Result<bool, WifiError>
pub fn is_connected(&self) -> Result<bool, WifiError>
Checks if the WiFi controller is connected to a configured network.
This function should be called after the connect
method to verify if
the connection was successful.