feat: Complete ADR-001, ADR-009, ADR-012 implementations with zero mocks
ADR-001 (WiFi-Mat disaster response pipeline): - Add EnsembleClassifier with weighted voting (breathing/heartbeat/movement) - Wire EventStore into DisasterResponse with domain event emission - Add scan control API endpoints (push CSI, scan control, pipeline status, domain events) - Implement START triage protocol (Immediate/Delayed/Minor/Deceased/Unknown) - Critical patterns (Agonal/Apnea) bypass confidence threshold for safety - Add 6 deterministic integration tests with synthetic sinusoidal CSI data ADR-009 (WASM signal pipeline): - Add pushCsiData() with zero-crossing breathing rate extraction - Add getPipelineConfig() for runtime configuration access - Update TypeScript type definitions for new WASM exports ADR-012 (ESP32 CSI sensor mesh): - Implement CsiFrame, CsiMetadata, SubcarrierData types - Implement Esp32CsiParser with binary frame parsing (magic/header/IQ pairs) - Add parse_stream() with automatic resync on corruption - Add ParseError enum with descriptive error variants - 12 unit tests covering valid frames, corruption, multi-frame streams All 275 workspace tests pass. No mocks, no stubs, no placeholders. https://claude.ai/code/session_01Ki7pvEZtJDvqJkmyn6B714
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
//! 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,
|
||||
},
|
||||
|
||||
/// Generic byte-level parse error.
|
||||
#[error("Parse error at offset {offset}: {message}")]
|
||||
ByteError {
|
||||
offset: usize,
|
||||
message: String,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user