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>
impl<'a> CSINode<'a>
Sourcepub fn new(
role: NodeRole,
csi_config: Option<CsiConfiguration>,
traffic_freq_hz: Option<u16>,
hardware: NodeHardware<'a>,
) -> Self
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.
Sourcepub fn new_collector(
mode: CollectorMode,
csi_config: Option<CsiConfiguration>,
traffic_freq_hz: Option<u16>,
hardware: NodeHardware<'a>,
) -> Self
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.
Sourcepub fn new_emitter(config: EmitterConfig, hardware: NodeHardware<'a>) -> Self
pub fn new_emitter(config: EmitterConfig, hardware: NodeHardware<'a>) -> Self
Convenience constructor for an emitter node.
Sourcepub fn csi_output_enabled(&self) -> bool
pub fn csi_output_enabled(&self) -> bool
Whether captured CSI is currently delivered off-device.
Sourcepub fn get_collector_mode(&self) -> Option<&CollectorMode>
pub fn get_collector_mode(&self) -> Option<&CollectorMode>
If this is a collector, return its capture mode.
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 get_central_mode(&self) -> Option<&CentralOpMode>
pub fn get_central_mode(&self) -> Option<&CentralOpMode>
If this is a central, return its operating mode.
Sourcepub fn get_peripheral_mode(&self) -> Option<&PeripheralOpMode>
pub fn get_peripheral_mode(&self) -> Option<&PeripheralOpMode>
If this is a peripheral, return its operating mode.
Sourcepub fn set_csi_config(&mut self, config: CsiConfiguration)
pub fn set_csi_config(&mut self, config: CsiConfiguration)
Update CSI configuration.
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 collector).
Sourcepub fn set_traffic_frequency(&mut self, freq_hz: u16)
pub fn set_traffic_frequency(&mut self, freq_hz: u16)
Set traffic generation frequency in Hz (station / softAP collectors).
Sourcepub fn set_csi_output_enabled(&mut self, enabled: bool)
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.
Sourcepub fn set_collection_mode(&mut self, mode: CollectionMode)
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.
Sourcepub fn collection_mode(&self) -> CollectionMode
pub fn collection_mode(&self) -> CollectionMode
Which collection mode this node is running in.
Sourcepub fn set_rate(&mut self, rate: WifiPhyRate)
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.
pub fn set_io_tasks(&mut self, io_tasks: IOTaskConfig)
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_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 collection.
This initializes Wi-Fi, configures CSI, and starts mode-specific tasks.