esp_wifi::wifi

Struct WifiController

Source
pub struct WifiController<'d> { /* private fields */ }
Expand description

A wifi controller

Implementations§

Source§

impl WifiController<'_>

Source

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

Source

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.

Source

pub async fn start_async(&mut self) -> Result<(), WifiError>

Async version of crate::wifi::WifiController’s start method

Source

pub async fn stop_async(&mut self) -> Result<(), WifiError>

Async version of crate::wifi::WifiController’s stop method

Source

pub async fn connect_async(&mut self) -> Result<(), WifiError>

Async version of crate::wifi::WifiController’s connect method

Source

pub async fn disconnect_async(&mut self) -> Result<(), WifiError>

Async version of crate::wifi::WifiController’s Disconnect method

Source

pub async fn wait_for_event(&mut self, event: WifiEvent)

Wait for one WifiEvent.

Source

pub async fn wait_for_events( &mut self, events: EnumSet<WifiEvent>, clear_pending: bool, ) -> EnumSet<WifiEvent>

Wait for one of multiple WifiEvents. Returns the events that occurred while waiting.

Source

pub async fn wait_for_all_events( &mut self, events: EnumSet<WifiEvent>, clear_pending: bool, )

Wait for multiple WifiEvents.

Source§

impl<'d> WifiController<'d>

Source

pub fn take_sniffer(&self) -> Option<Sniffer>

Attempts to take the sniffer, returns Some(Sniffer) if successful, otherwise None.

Source

pub fn set_protocol( &mut self, protocols: EnumSet<Protocol>, ) -> Result<(), WifiError>

Set the wifi protocol.

This will set the wifi protocol to the desired protocol, the default for this is: WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N

§Arguments:
  • protocols - The desired protocols
§Example:
wifi_controller.set_protocol(Protocol::P802D11BGNLR.into());
Source

pub fn set_power_saving(&mut self, ps: PowerSaveMode) -> Result<(), WifiError>

Configures modem power saving

Source

pub fn is_sta_enabled(&self) -> Result<bool, WifiError>

Checks if Wi-Fi is enabled as a station.

Source

pub fn is_ap_enabled(&self) -> Result<bool, WifiError>

Checks if Wi-Fi is enabled as an access p.

Source

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.

Source

pub fn scan_n<const N: usize>( &mut self, ) -> Result<(Vec<AccessPointInfo, N>, usize), WifiError>

A blocking wifi network scan with default scanning options.

Source

pub fn start(&mut self) -> Result<(), WifiError>

Starts the WiFi controller.

Source

pub fn stop(&mut self) -> Result<(), WifiError>

Stops the WiFi controller.

Source

pub fn connect(&mut self) -> Result<(), WifiError>

Connects the WiFi controller to a network.

Source

pub fn disconnect(&mut self) -> Result<(), WifiError>

Disconnects the WiFi controller from a network.

Source§

impl WifiController<'_>

Source

pub fn capabilities(&self) -> Result<EnumSet<Capability>, WifiError>

Get the supported capabilities of the controller.

Source

pub fn configuration(&self) -> Result<Configuration, WifiError>

Get the currently used configuration.

Source

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

Source

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.

Source

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.

Trait Implementations§

Source§

impl Drop for WifiController<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'d> !Freeze for WifiController<'d>

§

impl<'d> RefUnwindSafe for WifiController<'d>

§

impl<'d> Send for WifiController<'d>

§

impl<'d> Sync for WifiController<'d>

§

impl<'d> Unpin for WifiController<'d>

§

impl<'d> !UnwindSafe for WifiController<'d>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.