pub struct Interface { /* private fields */ }wifi only.Expand description
Wi-Fi interface.
This implements the embassy-net-driver trait for up to three latest versions of that crate,
and the xarxa-driver trait.
While those crates aren’t stable we make an exception here from the API Guidelines
in exposing unstable dependencies.
Each interface mode (station, access point) is a singleton — only one
instance of each can exist at a time. Create interfaces via
Interface::station() or Interface::access_point() before or after
calling WifiController::new(). Dropping the interface releases the singleton so it can
be created again.
Implementations§
Source§impl Interface
impl Interface
Sourcepub fn station() -> Self
pub fn station() -> Self
Creates the station-mode interface.
§Panics
Panics if a station interface already exists. Use try_station()
for a non-panicking alternative.
Sourcepub fn try_station() -> Option<Self>
pub fn try_station() -> Option<Self>
Tries to create the station-mode interface.
Returns None if a station interface already exists.
Sourcepub fn access_point() -> Self
pub fn access_point() -> Self
Creates the access-point-mode interface.
§Panics
Panics if an access-point interface already exists.
Use try_access_point() for a non-panicking alternative.
Sourcepub fn try_access_point() -> Option<Self>
pub fn try_access_point() -> Option<Self>
Tries to create the access-point-mode interface.
Returns None if an access-point interface already exists.
Sourcepub fn mac_address(&self) -> [u8; 6]
pub fn mac_address(&self) -> [u8; 6]
Retrieves the MAC address of the Wi-Fi device.
§Example
let _controller = esp_radio::wifi::WifiController::new(peripherals.WIFI, Default::default())?;
let station = esp_radio::wifi::Interface::station();
let mac = station.mac_address();
println!("Station MAC: {:02x?}", mac);Trait Implementations§
Source§impl Driver for Interface
impl Driver for Interface
Source§fn receive(
&mut self,
cx: &mut Context<'_>,
) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)>
fn receive( &mut self, cx: &mut Context<'_>, ) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)>
Source§fn transmit(&mut self, cx: &mut Context<'_>) -> Option<Self::TxToken<'_>>
fn transmit(&mut self, cx: &mut Context<'_>) -> Option<Self::TxToken<'_>>
Source§fn link_state(&mut self, cx: &mut Context<'_>) -> LinkState
fn link_state(&mut self, cx: &mut Context<'_>) -> LinkState
Source§fn capabilities(&self) -> Capabilities
fn capabilities(&self) -> Capabilities
Source§fn hardware_address(&self) -> HardwareAddress
fn hardware_address(&self) -> HardwareAddress
Source§impl Driver for Interface
impl Driver for Interface
Source§fn capabilities(&self) -> Capabilities
fn capabilities(&self) -> Capabilities
Source§fn hardware_address(&self) -> HardwareAddress
fn hardware_address(&self) -> HardwareAddress
Source§fn link_state(&mut self) -> LinkState
fn link_state(&mut self) -> LinkState
Source§fn register_waker(&mut self, waker: &Waker) -> Result<(), NotSupported>
fn register_waker(&mut self, waker: &Waker) -> Result<(), NotSupported>
async only.