wifi-densepose/v2/crates/wifi-densepose-wifiscan
ruv a0e72eef50 feat(wifiscan,sensing): native wlanapi.dll FFI + real Matter manual code
wifiscan (Tier 2 wlanapi adapter ONLY):
- Real native wlanapi.dll BSS-list FFI (new adapter/wlanapi_native.rs):
  WlanOpenHandle -> WlanEnumInterfaces -> WlanGetNetworkBssList ->
  WlanFreeMemory/WlanCloseHandle via windows-sys 0.59 (already in lock
  tree). Per-BSSID RSSI(dBm)/channel/band/radio-type/SSID + CSI-capable
  filter. #[cfg(windows)] real path; #[cfg(not(windows))] returns typed
  WifiScanError::Unsupported (honest, never fabricated).
- wlanapi_scanner now native-first with documented netsh fallback,
  native_scans metric, scan_native()/scan_native_csi_capable(), and a
  benchmark() that MEASURES real Hz (no hardcoded "10x" claim).
- MEASURED 9.74 Hz native on ruvzen (30 iters, Native backend) vs netsh
  ~2 Hz baseline. Live measurement kept as an #[ignore] test.
- Cargo.toml: unsafe_code forbid->deny so only the audited wlan_ffi
  module opts into unsafe; all unsafe confined + null-checked + freed.

sensing-server (Matter commissioning):
- Replaced the lossy modulo placeholder in matter/commissioning.rs with
  the real Matter Core Spec 1.3 §5.1.4.1.1 field-packing. Canonical
  vector (20202021, 3840) now encodes to the published 34970112332.
- Added ManualPairingCode::decode + DecodedManualCode proving the code
  is real/lossless (passcode round-trips bit-for-bit; short
  discriminator = top 4 bits) with Verhoeff integrity, incl. proptest.

Tests: wifi-densepose-wifiscan 145 passed (real FFI exercised on
Windows); wifi-densepose-sensing-server 614 passed. 0 failed.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-11 21:39:42 -04:00
..
src feat(wifiscan,sensing): native wlanapi.dll FFI + real Matter manual code 2026-06-11 21:39:42 -04:00
Cargo.toml feat(wifiscan,sensing): native wlanapi.dll FFI + real Matter manual code 2026-06-11 21:39:42 -04:00
README.md chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427) 2026-04-25 21:28:13 -04:00

README.md

wifi-densepose-wifiscan

Crates.io Documentation License

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=bssid output into structured BssidObservation records. Zero platform dependencies.
  • WLAN API scanner (Tier 2, wlanapi feature) -- Async scanning via the Windows WLAN API with tokio integration.
  • Multi-AP frame -- MultiApFrame aggregates observations from multiple BSSIDs into a single timestamped frame for downstream processing.
  • Sensing pipeline (pipeline feature) -- WindowsWifiPipeline orchestrates 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
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