Make the BLE layer say what it actually received
Chasing a paddle that shifted on one platform and not the other cost several rebuilds, and most of that was spent unable to tell two very different situations apart: a pod that was sending nothing, and a pod whose frames we were receiving and quietly discarding. The logs looked identical because every decoder in this path fails by dropping. `click.rs` now logs every notification with its length and bytes before anything tries to interpret it, and the unhandled-frame line in `controller.rs` carries the payload rather than just the type byte — which is the least useful part of a frame you could not parse, since it is usually the framing that is wrong and not the content. The default log filter gains `bikecontrol_ble=debug`. It was `info`, which silenced the entire crate that owns every BLE conversation — subscribe failures included. Survivable on desktop where RUST_LOG can override it; not on Android, which has no environment to set and is exactly where the subscribe was failing. Adds `probe listen`, which decodes nothing on purpose: the GATT tree with descriptors (the CCCD value is where a subscribe goes wrong, and `inspect` stops short of it), then a subscribe to every notifying characteristic across all services, reporting each as ok or FAILED. Each notification prints characteristic, length and raw bytes, and the summary names the characteristics that stayed silent — the difference between a quiet device and listening in the wrong place. That last part is what settled this one: it recorded 304 button frames from a pod the app was reporting as dead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@ use tokio::sync::{broadcast, mpsc, oneshot};
|
||||
|
||||
use crate::client::{Backoff, InFlight, DISCONNECT_TIMEOUT};
|
||||
use crate::error::FtmsError;
|
||||
use crate::indoor_bike_data::hex;
|
||||
use crate::scan::{self, ScanKind};
|
||||
use crate::zwift::{self, Button, ButtonTracker, PodId};
|
||||
|
||||
@@ -541,6 +542,12 @@ impl Actor {
|
||||
|
||||
/// Decode one notification into events.
|
||||
fn handle(&mut self, raw: &[u8]) {
|
||||
// Every frame, before anything decides what it means (NFR-8). The
|
||||
// decoders below all fail by dropping, so without this a pod that is
|
||||
// talking and a pod that is silent produce identical logs — which is
|
||||
// exactly the ambiguity that made a working paddle look like dead
|
||||
// hardware.
|
||||
tracing::debug!(len = raw.len(), raw = %hex(raw), "click: frame");
|
||||
if zwift::is_ride_on_reply(raw) {
|
||||
tracing::debug!("click: RideOn acknowledged");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user