Replace Vec::remove(0) (O(n) per-sample buffer shift -> O(n^2) full-window sweep) with VecDeque push_back/pop_front (O(1) eviction) in the fixed-length sliding/ring buffers of the vital-sign and wifiscan extractors. Where the autocorrelation / zero-crossing / Pearson loop needs a contiguous slice, make_contiguous() is called once per extract(), matching the idiom already used in wifiscan/pipeline/orchestrator.rs. Output is bit-identical. Sites: anomaly.rs (rr/hr history), store.rs (readings ring; history() now takes &mut self to hand back a contiguous slice, no external callers), wifiscan breathing_extractor.rs (filtered history), wifiscan correlator.rs (per-BSSID histories -> Vec<VecDeque<f32>>). (heartrate.rs/breathing.rs windows land with the §A2/§A3 fixes in a separate commit.) New criterion bench crates/wifi-densepose-vitals/benches/vitals_bench.rs drives each extractor over a full-window fill. Honest MEASURED result: end-to-end win is NULL within noise at realistic ESP32 window sizes (1500-3000) because the per-frame DSP dominates the eviction (heartrate 42.8ms->44.4ms, breathing 7.95ms->7.86ms, overlapping CIs). In isolation the eviction collapses O(n^2) -> O(n) (34.6x at window=3000, 3158x at window=100000); A1 lands as the correct data structure removing a latent O(n^2), NOT a claimed hot-path speedup. Reproduce: cargo bench -p wifi-densepose-vitals --bench vitals_bench Co-Authored-By: claude-flow <ruv@ruv.net> |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| README.md | ||
README.md
wifi-densepose-wifiscan
Multi-BSSID WiFi scanning for Windows-enhanced DensePose sensing (ADR-022).
Overview
wifi-densepose-wifiscan implements the BSSID Acquisition bounded context for the WiFi-DensePose
system. It discovers and tracks nearby WiFi access points, parses platform-specific scan output,
and feeds multi-AP signal data into a sensing pipeline that performs motion detection, breathing
estimation, attention weighting, and fingerprint matching.
The crate uses #[forbid(unsafe_code)] and is designed as a pure-Rust domain layer with
pluggable platform adapters.
Features
- BSSID registry -- Tracks observed access points with running RSSI statistics, band/radio
type classification, and metadata. Types:
BssidId,BssidObservation,BssidRegistry,BssidEntry. - Netsh adapter (Tier 1) -- Parses
netsh wlan show networks mode=bssidoutput into structuredBssidObservationrecords. Zero platform dependencies. - WLAN API scanner (Tier 2,
wlanapifeature) -- Async scanning via the Windows WLAN API withtokiointegration. - Multi-AP frame --
MultiApFrameaggregates observations from multiple BSSIDs into a single timestamped frame for downstream processing. - Sensing pipeline (
pipelinefeature) --WindowsWifiPipelineorchestrates motion detection, breathing estimation, attention-weighted AP selection, and location fingerprint matching.
Feature flags
| Flag | Default | Description |
|---|---|---|
serde |
yes | Serialization for domain types |
pipeline |
yes | WindowsWifiPipeline sensing orchestration |
wlanapi |
no | Tier 2 async scanning via tokio (Windows WLAN API) |
Quick Start
use wifi_densepose_wifiscan::{
NetshBssidScanner, BssidRegistry, WlanScanPort,
};
// Parse netsh output (works on any platform for testing)
let netsh_output = "..."; // output of `netsh wlan show networks mode=bssid`
let observations = wifi_densepose_wifiscan::parse_netsh_output(netsh_output);
// Register observations
let mut registry = BssidRegistry::new();
for obs in &observations {
registry.update(obs);
}
println!("Tracking {} access points", registry.len());
With the pipeline feature enabled:
use wifi_densepose_wifiscan::WindowsWifiPipeline;
let pipeline = WindowsWifiPipeline::new();
// Feed MultiApFrame data into the pipeline for sensing...
Architecture
wifi-densepose-wifiscan/src/
lib.rs -- Re-exports, feature gates
domain/
bssid.rs -- BssidId, BssidObservation, BandType, RadioType
registry.rs -- BssidRegistry, BssidEntry, BssidMeta, RunningStats
frame.rs -- MultiApFrame (multi-BSSID aggregated frame)
result.rs -- EnhancedSensingResult
port.rs -- WlanScanPort trait (platform abstraction)
adapter.rs -- NetshBssidScanner (Tier 1), WlanApiScanner (Tier 2)
pipeline.rs -- WindowsWifiPipeline (motion, breathing, attention, fingerprint)
error.rs -- WifiScanError
Related Crates
| Crate | Role |
|---|---|
wifi-densepose-signal |
Advanced CSI signal processing |
wifi-densepose-vitals |
Vital sign extraction from CSI |
wifi-densepose-hardware |
ESP32 and other hardware interfaces |
wifi-densepose-mat |
Disaster detection using multi-AP data |
License
MIT OR Apache-2.0