Files
wifi-densepose/rust-port/wifi-densepose-rs/crates/wifi-densepose-hardware/src/error.rs
rUv 92a5182dc3 feat(adr-018): ESP32-S3 firmware, Rust aggregator, and live CSI pipeline
Complete end-to-end WiFi CSI capture pipeline verified on real hardware:

- ESP32-S3 firmware: WiFi STA + promiscuous mode CSI collection,
  ADR-018 binary serialization, UDP streaming at ~20 Hz
- Rust aggregator CLI binary (clap): receives UDP frames, parses with
  Esp32CsiParser, prints per-frame summary (node, seq, rssi, amp)
- UDP aggregator module with per-node sequence tracking and drop detection
- CsiFrame bridge to detection pipeline (amplitude/phase/SNR conversion)
- Python ESP32 binary parser with UDP reader
- Presence detection confirmed: motion score 10/10 from live CSI variance

Hardware verified: ESP32-S3-DevKitC-1 (CP2102, MAC 3C:0F:02:EC:C2:28),
Docker ESP-IDF v5.2 build, esptool 5.1.0 flash, 20 Rust + 6 Python tests pass.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-02-28 13:22:04 -05:00

55 lines
1.5 KiB
Rust

//! Error types for hardware parsing.
use thiserror::Error;
/// Errors that can occur when parsing CSI data from hardware.
#[derive(Debug, Error)]
pub enum ParseError {
/// Not enough bytes in the buffer to parse a complete frame.
#[error("Insufficient data: need {needed} bytes, got {got}")]
InsufficientData {
needed: usize,
got: usize,
},
/// The frame header magic bytes don't match expected values.
#[error("Invalid magic: expected {expected:#06x}, got {got:#06x}")]
InvalidMagic {
expected: u32,
got: u32,
},
/// The frame indicates more subcarriers than physically possible.
#[error("Invalid subcarrier count: {count} (max {max})")]
InvalidSubcarrierCount {
count: usize,
max: usize,
},
/// The I/Q data buffer length doesn't match expected size.
#[error("I/Q data length mismatch: expected {expected}, got {got}")]
IqLengthMismatch {
expected: usize,
got: usize,
},
/// RSSI value is outside the valid range.
#[error("Invalid RSSI value: {value} dBm (expected -100..0)")]
InvalidRssi {
value: i32,
},
/// Invalid antenna count (must be 1-4 for ESP32).
#[error("Invalid antenna count: {count} (expected 1-4)")]
InvalidAntennaCount {
count: u8,
},
/// Generic byte-level parse error.
#[error("Parse error at offset {offset}: {message}")]
ByteError {
offset: usize,
message: String,
},
}