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 CSINode::new (or CSINode::new_collector for the common case), configure optional protocol / traffic frequency, then call run().

Implementations§

Source§

impl<'a> CSINode<'a>

Source

pub fn new( role: NodeRole, csi_config: Option<CsiConfiguration>, traffic_freq_hz: Option<u16>, hardware: NodeHardware<'a>, ) -> Self

Create a node in the given role.

CSI output is enabled by default. An NodeRole::Emitter captures no CSI, so the setting has no effect there.

Source

pub fn new_collector( mode: CollectorMode, csi_config: Option<CsiConfiguration>, traffic_freq_hz: Option<u16>, hardware: NodeHardware<'a>, ) -> Self

Convenience constructor for a collector node.

Source

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

Convenience constructor for an emitter node.

Source

pub fn get_role(&self) -> &NodeRole

Get the node’s role.

Source

pub fn csi_output_enabled(&self) -> bool

Whether captured CSI is currently delivered off-device.

Source

pub fn get_collector_mode(&self) -> Option<&CollectorMode>

If this is a collector, return its capture mode.

Source

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

If this is an emitter, return its configuration.

Source

pub fn get_central_mode(&self) -> Option<&CentralOpMode>

If this is a central, return its operating mode.

Source

pub fn get_peripheral_mode(&self) -> Option<&PeripheralOpMode>

If this is a peripheral, return its operating mode.

Source

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

Update CSI configuration.

Source

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

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

Source

pub fn set_traffic_frequency(&mut self, freq_hz: u16)

Set traffic generation frequency in Hz (station / softAP collectors).

Source

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

Enable or disable delivery of captured CSI off-device.

When disabled the radio still captures CSI — keeping the RX path and its timing identical — but nothing is decoded, logged, or handed to a callback. Useful for a node whose only job is to keep traffic on air, or for measuring capture overhead without the delivery cost.

Has no effect on an NodeRole::Emitter, which captures nothing.

Source

pub fn set_collection_mode(&mut self, mode: CollectionMode)

Set TX/RX task enablement for the node. Set how much this node does with the CSI it collects.

A separate call rather than a fifth argument to CSINode::new: the four-argument form is what the open-source CLI calls, and widening it would break every existing caller to serve a mode most of them never set.

Source

pub fn collection_mode(&self) -> CollectionMode

Which collection mode this node is running in.

Source

pub fn set_rate(&mut self, rate: WifiPhyRate)

Force the ESP-NOW peer PHY rate.

ESP-NOW only, by design — a station derives its rate from the AP it associated with, and a sniffer from whatever it overhears, so neither has a rate to force. Stored here and applied when the ESP-NOW roles are wired into the run loop; until then it is recorded and unused rather than silently dropped.

Source

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

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_role(&mut self, role: NodeRole)

Replace the node’s role.

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 collection.

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, <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.