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.
While that crate isn’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);