Skip to main content

CsiNode

Struct CsiNode 

Source
pub struct CsiNode<'a> { /* private fields */ }
Expand description

Primary orchestration object for a CSI node.

Construct with a per-mode constructor — CsiNode::sniffer, CsiNode::station, CsiNode::access_point, CsiNode::emitter, CsiNode::esp_now, CsiNode::esp_now_simplex_source or CsiNode::esp_now_simplex_peer — or with CsiNode::new and a Mode. Every constructor except the emitter’s takes a MeasurementSetup (periodicity, bandwidth, acquisition); configure an optional protocol, then call run().

Implementations§

Source§

impl<'a> CsiNode<'a>

Source

pub fn new( mode: Mode, setup: MeasurementSetup, hardware: NodeHardware<'a>, ) -> Self

Create a node that reaches the channel through mode, measuring under setup.

The node’s session role, sensing role and reporting come from the mode’s config — see the per-mode constructors below, which are the ergonomic way in.

Source

pub fn esp_now( config: EspNowConfig, setup: MeasurementSetup, hardware: NodeHardware<'a>, ) -> Self

A node in the symmetric ESP-NOW exchange. Initiator or responder, reporting or not — set both on the EspNowConfig; every combination is meaningful. The setup’s periodicity is the initiator’s control-packet rate and the responder’s reply pacing.

Source

pub fn esp_now_simplex_source( config: EspNowConfig, setup: MeasurementSetup, hardware: NodeHardware<'a>, ) -> Self

The flooding end of the asymmetric ESP-NOW exchange: an initiator and sensing transmitter that reports nothing. It owns all the transmit airtime and measures nothing, so the setup’s acquisition is ignored; its periodicity paces the flood.

Source

pub fn esp_now_simplex_peer( channel: u8, setup: MeasurementSetup, hardware: NodeHardware<'a>, ) -> Self

The measuring end of the asymmetric ESP-NOW exchange: a responder and sensing receiver that reports every measurement. It beacons until it is found, then goes receive-only; it sounds nothing, so the setup’s periodicity is ignored.

Source

pub fn sniffer( config: WifiSnifferConfig, setup: MeasurementSetup, hardware: NodeHardware<'a>, ) -> Self

A promiscuous sniffer: an observer (no session role) and sensing receiver, always. It never transmits, and a sniffer that does not report observes nothing. It sounds nothing, so the setup’s periodicity is ignored.

Source

pub fn station( config: WifiStationConfig, setup: MeasurementSetup, hardware: NodeHardware<'a>, ) -> Self

A Wi-Fi station associated to an access point or a commercial router. The setup’s periodicity is its gateway ping rate; it is the session’s initiator when that ping is the traffic being measured (see WifiStationConfig::session).

Source

pub fn access_point( config: WifiApConfig, setup: MeasurementSetup, hardware: NodeHardware<'a>, ) -> Self

A self-contained softAP with DHCP. Always the session’s initiator and a sensing receiver; reporting is configurable. The setup’s periodicity is its downlink flood rate.

Source

pub fn emitter(config: EmitterConfig, hardware: NodeHardware<'a>) -> Self

An unassociated transmit-only sounding node: a sensing transmitter that reports nothing, with no session role, always. It measures nothing and takes its period from the EmitterConfig, so it takes no measurement setup.

Source

pub fn mode(&self) -> &Mode

How this node reaches the channel.

Source

pub fn session_role(&self) -> Option<SessionRole>

The node’s IEEE 802.11bf session role, or None for an observer. Computed from the mode.

Source

pub fn sensing_role(&self) -> SensingRole

The node’s IEEE 802.11bf sensing role. Computed from the mode.

Source

pub fn reporting(&self) -> Reporting

Whether, and how often, this node’s measurements leave it, as configured. A responder paired with a silent initiator promotes itself mid-run without rewriting its configuration, so this and runtime_reporting can legitimately differ.

Source

pub fn measurement_setup(&self) -> &MeasurementSetup

The node’s measurement setup.

Source

pub fn get_emitter_config(&self) -> Option<&EmitterConfig>

If this is an emitter, return its configuration.

Source

pub fn apply_measurement_setup( &mut self, setup: &MeasurementSetup, ) -> Result<(), SetupError>

Take on an IEEE 802.11bf-style MeasurementSetup.

The setup is mapped onto what this mode actually does, and refused — with nothing changed — if any parameter cannot be honoured:

  • id is stamped on every controlled sounding’s Stimulus; each ESP-NOW control frame is one measurement instance.
  • acquisition.channel replaces the mode’s channel (the station’s channel hint).
  • acquisition.transmitter becomes the CSI peer filter (crate::set_csi_peer_filter).
  • acquisition.ppdu_formats: every format, HE only (ESP32-C5/C6 HE-LTF acquisition), or no legacy formats. Other subsets are refused.
  • acquisition.bandwidth and stimulus.bandwidth must match the mode’s configured width.
  • stimulus.periodicity_us becomes the node’s periodicity — the ESP-NOW initiator’s control-packet rate, the station’s or access point’s ping rate — or the emitter’s frame period. A mode that does not sound the channel (a sniffer, an ESP-NOW responder or simplex peer) refuses any stimulus.
  • stimulus.responders: none, or exactly one, which becomes the CSI peer filter.
  • Grouped reports, ng/nb other than 1/8, and trigger-based sounding are refused: the radio produces raw estimates from non-TB soundings only.
Source

pub fn set_measurement_setup(&mut self, setup: MeasurementSetup)

Replace the measurement setup.

Source

pub fn set_csi_config(&mut self, config: CsiConfig)

Replace the acquisition (CSI configuration) of the measurement setup.

Source

pub fn set_station_config(&mut self, config: WifiStationConfig)

Update Wi-Fi Station configuration (only applies to a station node).

Source

pub fn set_periodicity_hz(&mut self, hz: u16)

Set the periodicity of the measurement setup, in Hz. See MeasurementSetup::periodicity_hz for which modes read it.

Source

pub fn set_io_tasks(&mut self, io_tasks: IOTaskConfig)

Replace the TX/RX task configuration. See IOTaskConfig; the two fields can also be set one at a time with set_tx_enabled and set_rx_enabled.

Source

pub fn set_tx_enabled(&mut self, enabled: bool)

Enable or disable TX task work.

Source

pub fn set_rx_enabled(&mut self, enabled: bool)

Enable or disable RX task work.

Source

pub fn get_io_tasks(&self) -> IOTaskConfig

Get current TX/RX task configuration.

Source

pub fn set_mode(&mut self, mode: Mode)

Replace how this node reaches the channel, and with it the roles and reporting the new mode implies. Used to run one node through several configurations without reconstructing it — see examples/runtime_config.rs.

Source

pub fn set_protocol(&mut self, protocol: Protocol)

Set Wi-Fi protocol (overrides default).

Source

pub fn set_radio_profile(&mut self, profile: &'static dyn RadioProfile)

Install a Wi-Fi bring-up profile (overrides the default StandardProfile). Pass a reference to a zero-sized profile value, e.g. node.set_radio_profile(&MyProfile);.

Source

pub fn set_flood_unsolicited_reply(&mut self, enabled: bool)

Make the ICMP traffic flood send unsolicited echo replies instead of echo requests.

The peer’s IP stack silently ignores an unsolicited reply, so the generated traffic becomes strictly one-directional: the peer still hardware-ACKs every data frame (rate control stays fed) and captures CSI per frame, but never transmits an IP-level response. This halves the on-air frame count versus request/reply and stabilizes the offered rate under CSMA contention. Trade-off: this node receives no CSI back from the peer’s replies.

Source

pub async fn run_duration(&mut self, duration: u64, client: &mut CsiNodeClient)

Run the node for duration seconds with internal draining of the measurements.

This initializes Wi-Fi, configures CSI, and starts mode-specific tasks.

Source

pub async fn run(&mut self)

Run the node until stopped.

This initializes Wi-Fi, configures CSI, and starts mode-specific tasks.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for CsiNode<'a>

§

impl<'a> !UnwindSafe for CsiNode<'a>

§

impl<'a> Freeze for CsiNode<'a>

§

impl<'a> Send for CsiNode<'a>

§

impl<'a> Sync for CsiNode<'a>

§

impl<'a> Unpin for CsiNode<'a>

§

impl<'a> UnsafeUnpin for CsiNode<'a>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.