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>
impl<'a> CsiNode<'a>
Sourcepub fn new(
mode: Mode,
setup: MeasurementSetup,
hardware: NodeHardware<'a>,
) -> Self
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.
Sourcepub fn esp_now(
config: EspNowConfig,
setup: MeasurementSetup,
hardware: NodeHardware<'a>,
) -> Self
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.
Sourcepub fn esp_now_simplex_source(
config: EspNowConfig,
setup: MeasurementSetup,
hardware: NodeHardware<'a>,
) -> Self
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.
Sourcepub fn esp_now_simplex_peer(
channel: u8,
setup: MeasurementSetup,
hardware: NodeHardware<'a>,
) -> Self
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.
Sourcepub fn sniffer(
config: WifiSnifferConfig,
setup: MeasurementSetup,
hardware: NodeHardware<'a>,
) -> Self
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.
Sourcepub fn station(
config: WifiStationConfig,
setup: MeasurementSetup,
hardware: NodeHardware<'a>,
) -> Self
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).
Sourcepub fn access_point(
config: WifiApConfig,
setup: MeasurementSetup,
hardware: NodeHardware<'a>,
) -> Self
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.
Sourcepub fn emitter(config: EmitterConfig, hardware: NodeHardware<'a>) -> Self
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.
Sourcepub fn session_role(&self) -> Option<SessionRole>
pub fn session_role(&self) -> Option<SessionRole>
The node’s IEEE 802.11bf session role, or None for an observer. Computed from the mode.
Sourcepub fn sensing_role(&self) -> SensingRole
pub fn sensing_role(&self) -> SensingRole
The node’s IEEE 802.11bf sensing role. Computed from the mode.
Sourcepub fn reporting(&self) -> Reporting
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.
Sourcepub fn measurement_setup(&self) -> &MeasurementSetup
pub fn measurement_setup(&self) -> &MeasurementSetup
The node’s measurement setup.
Sourcepub fn get_emitter_config(&self) -> Option<&EmitterConfig>
pub fn get_emitter_config(&self) -> Option<&EmitterConfig>
If this is an emitter, return its configuration.
Sourcepub fn apply_measurement_setup(
&mut self,
setup: &MeasurementSetup,
) -> Result<(), SetupError>
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:
idis stamped on every controlled sounding’sStimulus; each ESP-NOW control frame is one measurement instance.acquisition.channelreplaces the mode’s channel (the station’s channel hint).acquisition.transmitterbecomes 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.bandwidthandstimulus.bandwidthmust match the mode’s configured width.stimulus.periodicity_usbecomes 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/nbother than 1/8, and trigger-based sounding are refused: the radio produces raw estimates from non-TB soundings only.
Sourcepub fn set_measurement_setup(&mut self, setup: MeasurementSetup)
pub fn set_measurement_setup(&mut self, setup: MeasurementSetup)
Replace the measurement setup.
Sourcepub fn set_csi_config(&mut self, config: CsiConfig)
pub fn set_csi_config(&mut self, config: CsiConfig)
Replace the acquisition (CSI configuration) of the measurement setup.
Sourcepub fn set_station_config(&mut self, config: WifiStationConfig)
pub fn set_station_config(&mut self, config: WifiStationConfig)
Update Wi-Fi Station configuration (only applies to a station node).
Sourcepub fn set_periodicity_hz(&mut self, hz: u16)
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.
Sourcepub fn set_io_tasks(&mut self, io_tasks: IOTaskConfig)
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.
Sourcepub fn set_tx_enabled(&mut self, enabled: bool)
pub fn set_tx_enabled(&mut self, enabled: bool)
Enable or disable TX task work.
Sourcepub fn set_rx_enabled(&mut self, enabled: bool)
pub fn set_rx_enabled(&mut self, enabled: bool)
Enable or disable RX task work.
Sourcepub fn get_io_tasks(&self) -> IOTaskConfig
pub fn get_io_tasks(&self) -> IOTaskConfig
Get current TX/RX task configuration.
Sourcepub fn set_mode(&mut self, mode: Mode)
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.
Sourcepub fn set_protocol(&mut self, protocol: Protocol)
pub fn set_protocol(&mut self, protocol: Protocol)
Set Wi-Fi protocol (overrides default).
Sourcepub fn set_radio_profile(&mut self, profile: &'static dyn RadioProfile)
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);.
Sourcepub fn set_flood_unsolicited_reply(&mut self, enabled: bool)
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.
Sourcepub async fn run_duration(&mut self, duration: u64, client: &mut CsiNodeClient)
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.