Skip to content

ZeroTrace AirLeak

Stream Emit Policy

How the capture stream is coalesced so the radio isn't wasted on noise

AirLeak's BLE radio time-slices between scanning and the phone connection, and BLE notify bandwidth is finite. So the firmware does not stream a raw per-advertisement firehose. Instead it keeps a device-centric table and pushes a coalesced delta only when a device meaningfully changes. This page explains that emit policy (shouldEmit() in src/enrichment/device_aggregator.cpp, spec §7).

Replaces the old USB throttle

Earlier (WiFi-era) AirLeak had a per-(MAC, event-type) USB-stream throttle. The BLE-only firmware has no USB stream; this coalescing emit policy is its equivalent, and it's tuned by config rather than a CLI flag.


What triggers a delta

After the aggregator updates a device record, it emits a delta to the capture stream when any of these is true:

  • New device, the MAC was just seen for the first time (always emitted).
  • RSSI moved, the smoothed RSSI EMA moved by at least rssi_delta_emit dBm (default 6).
  • New protocol bit, the device started broadcasting a BLE event type it hadn't before (e.g. it began emitting Find My frames).
  • Tracked flag flipped, a tracked privacy flag changed (e.g. AirDrop went discoverable, Find My separated, random-MAC).
  • Severity moved, the leakage score moved by at least sev_delta_emit (default 5).
  • Heartbeat, the device is still present but unchanged for ~10 seconds, a liveness tick so the app's "last seen" stays fresh.

Everything else (e.g. yet another identical Nearby Info advertisement) just bumps last_seen and is coalesced away.

Both thresholds are tunable via config.set (rssi_delta_emit, sev_delta_emit), see Settings.


Coalescing and minimum interval

A short minimum-emit interval gate prevents a single jittery device from emitting many deltas back to back, changes inside that window are folded into the next delta. The 10-second heartbeat is exempt so liveness ticks are never suppressed. The streamer also dedups by MAC within each drain batch, so a burst collapses into one frame per device carrying the latest state.

The result: the phone sees a smooth, low-rate stream that still reflects every meaningful change, while the radio spends its time scanning rather than transmitting redundant notifications.


Wire format and self-healing

Deltas are length-prefixed CBOR frames with a sequence number. The app applies frames in sequence order; a gap (detected by a sequence discontinuity) triggers a capture.since backfill, and a ring wrap returns a fresh snapshot. If the device's delta ring overflows under backpressure it drops the oldest entry, bumps drop_count, and signals the app to re-capture.snapshot. So a dropped notification self-heals rather than corrupting the table. See State & Health Fields for the drop counters.


Fox Hunt exception

When you lock onto a device in the app's Hunt tab, the firmware sets a focus MAC that bypasses the emit gate for that one device, so its RSSI updates on every observation and the proximity gauge stays responsive. Clearing the lock restores normal coalescing.


Tuning

The defaults (6 dBm / 5 points) are a good balance for typical environments. Lowering them makes the live list more reactive at the cost of more BLE traffic; raising them quiets the stream in very dense areas. These are set through the app's settings, not by hand.