mirror of
https://github.com/ruvnet/RuView
synced 2026-08-03 19:21:42 +00:00
f49c722764
The Rust port lived two directories deep (rust-port/wifi-densepose-rs/) without any sibling under rust-port/ that warranted the extra level. Move the whole workspace up to v2/ to match v1/ (Python) at the same depth and shorten every cd / build command across the repo. git mv preserves history for all tracked files. 60 files updated for path references (CI workflows, ADRs, docs, scripts, READMEs, internal .claude-flow state). Two manual fixes for relative-cd paths in CLAUDE.md and ADR-043 that became wrong after the depth change (cd ../.. → cd ..). Validated: - cargo check --workspace --no-default-features → clean (after target/ nuke; the gitignored target/ was carried by the OS rename and had hard-coded old paths in build scripts) - cargo test --workspace --no-default-features → 1,539 passed, 0 failed, 8 ignored (same totals as pre-rename) - ESP32-S3 on COM7 → still streaming live CSI (cb #40300, RSSI -64 dBm) After-merge follow-up: contributors should `rm -rf v2/target` once and let cargo regenerate from the new path.
113 lines
3.4 KiB
Rust
113 lines
3.4 KiB
Rust
//! Error types for the wifi-densepose-wifiscan crate.
|
|
|
|
use std::fmt;
|
|
|
|
/// Errors that can occur during WiFi scanning and BSSID processing.
|
|
#[derive(Debug, Clone)]
|
|
pub enum WifiScanError {
|
|
/// The BSSID MAC address bytes are invalid (must be exactly 6 bytes).
|
|
InvalidMac {
|
|
/// The number of bytes that were provided.
|
|
len: usize,
|
|
},
|
|
|
|
/// Failed to parse a MAC address string (expected `aa:bb:cc:dd:ee:ff`).
|
|
MacParseFailed {
|
|
/// The input string that could not be parsed.
|
|
input: String,
|
|
},
|
|
|
|
/// The scan backend returned an error.
|
|
ScanFailed {
|
|
/// Human-readable description of what went wrong.
|
|
reason: String,
|
|
},
|
|
|
|
/// Too few BSSIDs are visible for multi-AP mode.
|
|
InsufficientBssids {
|
|
/// Number of BSSIDs observed.
|
|
observed: usize,
|
|
/// Minimum required for multi-AP mode.
|
|
required: usize,
|
|
},
|
|
|
|
/// A BSSID was not found in the registry.
|
|
BssidNotFound {
|
|
/// The MAC address that was not found.
|
|
bssid: [u8; 6],
|
|
},
|
|
|
|
/// The subcarrier map is full and cannot accept more BSSIDs.
|
|
SubcarrierMapFull {
|
|
/// Maximum capacity of the subcarrier map.
|
|
max: usize,
|
|
},
|
|
|
|
/// An RSSI value is out of the expected range.
|
|
RssiOutOfRange {
|
|
/// The invalid RSSI value in dBm.
|
|
value: f64,
|
|
},
|
|
|
|
/// The requested operation is not supported by this adapter.
|
|
Unsupported(String),
|
|
|
|
/// Failed to execute the scan subprocess.
|
|
ProcessError(String),
|
|
|
|
/// Failed to parse scan output.
|
|
ParseError(String),
|
|
}
|
|
|
|
impl fmt::Display for WifiScanError {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
Self::InvalidMac { len } => {
|
|
write!(f, "invalid MAC address: expected 6 bytes, got {len}")
|
|
}
|
|
Self::MacParseFailed { input } => {
|
|
write!(
|
|
f,
|
|
"failed to parse MAC address from '{input}': expected aa:bb:cc:dd:ee:ff"
|
|
)
|
|
}
|
|
Self::ScanFailed { reason } => {
|
|
write!(f, "WiFi scan failed: {reason}")
|
|
}
|
|
Self::InsufficientBssids { observed, required } => {
|
|
write!(
|
|
f,
|
|
"insufficient BSSIDs for multi-AP mode: {observed} observed, {required} required"
|
|
)
|
|
}
|
|
Self::BssidNotFound { bssid } => {
|
|
write!(
|
|
f,
|
|
"BSSID not found in registry: {:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}",
|
|
bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]
|
|
)
|
|
}
|
|
Self::SubcarrierMapFull { max } => {
|
|
write!(
|
|
f,
|
|
"subcarrier map is full at {max} entries; cannot add more BSSIDs"
|
|
)
|
|
}
|
|
Self::RssiOutOfRange { value } => {
|
|
write!(f, "RSSI value {value} dBm is out of expected range [-120, 0]")
|
|
}
|
|
Self::Unsupported(msg) => {
|
|
write!(f, "unsupported operation: {msg}")
|
|
}
|
|
Self::ProcessError(msg) => {
|
|
write!(f, "scan process error: {msg}")
|
|
}
|
|
Self::ParseError(msg) => {
|
|
write!(f, "scan output parse error: {msg}")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::error::Error for WifiScanError {}
|