feat(adr-105): n_aps_used in enhanced_motion/enhanced_breathing

Uniform u8 field on both enhanced_* JSON objects so downstream
consumers can decide whether to trust a multi-AP enhancement
that, on a single sensor, may have run with only 1 AP. Mirrors
the existing contributing_bssids / bssid_count counts under a
single name across motion and breathing.

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
arsen 2026-05-17 14:13:57 +07:00
parent 8431674a6a
commit 598a4b2f6b
1 changed files with 6 additions and 0 deletions

View File

@ -2716,10 +2716,15 @@ async fn windows_wifi_task(state: SharedState, tick_ms: u64) {
drop(s_write_pre);
// ── Step 5: Build enhanced fields from pipeline result ───────
// ADR-105: n_aps_used is a uniform u8 indicator across both
// enhanced_motion and enhanced_breathing so downstream consumers
// can decide whether to trust a multi-AP enhancement that, on a
// single sensor, may have run with only 1 contributing AP.
let enhanced_motion = Some(serde_json::json!({
"score": enhanced.motion.score,
"level": format!("{:?}", enhanced.motion.level),
"contributing_bssids": enhanced.motion.contributing_bssids,
"n_aps_used": enhanced.motion.contributing_bssids.min(u8::MAX as usize) as u8,
}));
let enhanced_breathing = enhanced.breathing.as_ref().map(|b| {
@ -2727,6 +2732,7 @@ async fn windows_wifi_task(state: SharedState, tick_ms: u64) {
"rate_bpm": b.rate_bpm,
"confidence": b.confidence,
"bssid_count": b.bssid_count,
"n_aps_used": b.bssid_count.min(u8::MAX as usize) as u8,
})
});