Skip to main content

WifiSnifferConfig

Struct WifiSnifferConfig 

Source
pub struct WifiSnifferConfig { /* private fields */ }
Expand description

Configuration for Wi-Fi Promiscuous Sniffer mode.

Construct with WifiSnifferConfig::default() then chain with_channel to override defaults.

Implementations§

Source§

impl WifiSnifferConfig

Source

pub fn with_channel(self, channel: u8) -> Self

Override the channel the sniffer locks to.

Must be a valid IEEE 802.11 primary channel number — pass the primary, not the wider-channel center notation that routers commonly display:

  • 2.4 GHz: 114
  • 5 GHz: 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165 (regulatory-domain dependent — some restricted by country_info)

Center-channel labels (38, 46, ... for HT40; 42, 58, 106, ... for VHT80; 50, 114 for VHT160; 154 for the 153/157 HT40 pair) are not accepted here — esp_wifi_set_channel panics with InvalidArguments. For example, a router showing “channel 154” is using primary 153 (or 157); pass that primary and the chip will sniff the full 40 MHz block automatically per 802.11.

On dual-band chips (currently ESP32-C5), the band is auto-selected from the channel number — channels >= 36 switch the radio to BandMode::_5G, otherwise BandMode::_2_4G. On 2.4-GHz-only chips, passing any 5 GHz channel will fail at runtime.

Source

pub fn channel(&self) -> u8

Configured channel (2.4 GHz: 1–14, 5 GHz: 36–165).

Trait Implementations§

Source§

impl Clone for WifiSnifferConfig

Source§

fn clone(&self) -> WifiSnifferConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WifiSnifferConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WifiSnifferConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.