Skip to main content

CsiFrame

Struct CsiFrame 

Source
pub struct CsiFrame {
Show 21 fields pub frame_id: FrameId, pub session_id: SessionId, pub source_id: SourceId, pub adapter_kind: AdapterKind, pub timestamp_ns: u64, pub channel: u16, pub bandwidth_mhz: u16, pub rssi_dbm: Option<i16>, pub noise_floor_dbm: Option<i16>, pub antenna_index: Option<u8>, pub tx_chain: Option<u8>, pub rx_chain: Option<u8>, pub subcarrier_count: u16, pub i_values: Vec<f32>, pub q_values: Vec<f32>, pub amplitude: Vec<f32>, pub phase: Vec<f32>, pub validation: ValidationStatus, pub quality_score: f32, pub quality_reasons: Vec<String>, pub calibration_version: Option<String>,
}
Expand description

One CSI observation at a timestamp, normalized across all sources.

Invariants enforced by crate::validate_frame:

  • i_values.len() == q_values.len() == amplitude.len() == phase.len() == subcarrier_count
  • all of i_values/q_values/amplitude/phase are finite
  • subcarrier_count is within the source’s crate::AdapterProfile
  • rssi_dbm, when present, is within plausible device bounds

Fields§

§frame_id: FrameId

Monotonic id within the session.

§session_id: SessionId

Owning capture session.

§source_id: SourceId

Human-readable source id.

§adapter_kind: AdapterKind

Which adapter produced this frame.

§timestamp_ns: u64

Source timestamp in nanoseconds.

§channel: u16

WiFi channel number.

§bandwidth_mhz: u16

Channel bandwidth in MHz (20, 40, 80, 160).

§rssi_dbm: Option<i16>

Received signal strength, dBm, if reported.

§noise_floor_dbm: Option<i16>

Noise floor, dBm, if reported.

§antenna_index: Option<u8>

Receive-antenna index, if reported.

§tx_chain: Option<u8>

Transmit chain index, if reported.

§rx_chain: Option<u8>

Receive chain index, if reported.

§subcarrier_count: u16

Number of subcarriers (== length of the four vectors below).

§i_values: Vec<f32>

In-phase components, one per subcarrier.

§q_values: Vec<f32>

Quadrature components, one per subcarrier.

§amplitude: Vec<f32>

Magnitude sqrt(i^2 + q^2), one per subcarrier.

§phase: Vec<f32>

Phase atan2(q, i) in radians, one per subcarrier (unwrapped by DSP later).

§validation: ValidationStatus

Validation outcome.

§quality_score: f32

Quality / usability confidence in [0.0, 1.0].

§quality_reasons: Vec<String>

Reasons a frame was degraded (empty when Accepted).

§calibration_version: Option<String>

Calibration version this frame was processed against, if any.

Implementations§

Source§

impl CsiFrame

Source

pub fn from_iq( frame_id: FrameId, session_id: SessionId, source_id: SourceId, adapter_kind: AdapterKind, timestamp_ns: u64, channel: u16, bandwidth_mhz: u16, i_values: Vec<f32>, q_values: Vec<f32>, ) -> Self

Build a raw (un-validated) frame from interleaved-free I/Q vectors.

amplitude and phase are derived from i_values/q_values. The frame is returned with validation = Pending and quality_score = 0.0; run crate::validate_frame before exposing it.

Source

pub fn with_rssi(self, rssi_dbm: i16) -> Self

Builder-style setter for RSSI.

Source

pub fn with_noise_floor(self, noise_floor_dbm: i16) -> Self

Builder-style setter for noise floor.

Source

pub fn with_chains( self, antenna: Option<u8>, tx: Option<u8>, rx: Option<u8>, ) -> Self

Builder-style setter for antenna / chain metadata.

Source

pub fn mean_amplitude(&self) -> f32

Mean amplitude across subcarriers (0.0 for an empty frame).

Source

pub fn is_exposable(&self) -> bool

Whether this frame may be exposed across a language boundary.

Trait Implementations§

Source§

impl Clone for CsiFrame

Source§

fn clone(&self) -> CsiFrame

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 CsiFrame

Source§

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

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

impl<'de> Deserialize<'de> for CsiFrame

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for CsiFrame

Source§

fn eq(&self, other: &CsiFrame) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CsiFrame

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CsiFrame

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> 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,