Struct esp_wifi::wifi::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.