:beacon · the sensor hub
:beacon — the sensor hub
Package org.pureagave.zodiac.beacon. A headless foreground-service app that
turns a spare Android phone into the vehicle's shared sensor. minSdk 29, because the XCover Pro
it runs on is Android 10. One foreground service, one debug activity, no resources — the
UI is built in code.
What it broadcasts
It forwards the phone's raw GNSS NMEA verbatim and adds seven synthesized sentence types.
| Sentence | Carries | Rate |
|---|---|---|
$GPHDT | True compass heading (magnetometer, declination-corrected once a fix exists) | ~4 Hz |
$ZTLM | IMU pitch/roll + ground speed | ~4 Hz |
$ZAUD | Mic level — rms, peak, beat flag | ~15 Hz |
$ZENV | Ambient lux | ~0.5 Hz |
$ZSHK | Shock / impact peak g | On impact |
$ZBCN | Health — battery %, fix quality, satellites, uptime | ~0.2 Hz |
$ZODO | Trip + lifetime odometer (persisted) | ~0.5 Hz |
Every sentence goes to multicast group 239.7.7.10:10110 and a
subnet-directed broadcast. Field-by-field definitions →
Separately, the beacon announces its build as $ZVER on
239.7.7.40:10140 every 10 s, so the tablets' FLEET roster can spot a stale hub.
$ZVER grammar →
GPS test mode, armed over adb only, makes the beacon synthesize
$GPGGA/$GPRMC/$GPHDT for any point or moving track in place of
real GNSS, marked honestly as fix quality 8 (NMEA “Simulation mode”) with a
red ⚠ GPS SIMULATED banner on the phone. It is memory-only, so a reboot always
restores real GNSS. How it works →
Design rules that matter operationally
No audio is recorded, buffered to disk, or transmitted — the PCM buffer is reduced to three scalars in place and discarded. The microphone is optional at every layer, and a boot-started service never requests it at all.
- Every sentence is sent twice, because some access points drop multicast. That
is why the tablet de-duplicates byte-identical
$ZSHKlines inside a 200 ms window. - GPS failure is never fatal. If location permission is missing or wiring throws, every other channel keeps broadcasting and the notification says so.
- A sensor the phone does not have emits nothing rather than a fabricated zero — for heading and lux. A fabricated 0.0 lux would pin the whole fleet to 5 % brightness in daylight. A genuine 0.0 lux or 0.0° heading is still emitted.
- The odometer refuses implausible steps — inaccurate (> 20 m), below a 5 m jitter floor, or implying more than 160 kph — so GPS multipath cannot inflate the trip.
Where it runs
On the XCover Pro (SM-G715U) today, headless with the screen off, holding a partial
wake lock. It has a debug activity showing the live status readout, but that is for bring-up
only.
Planned replacement: a Raspberry Pi Zero 2 W with a u-blox USB GNSS receiver and a roof antenna. The travel router keeps the AP and DHCP role in both cases. Device notes →
Status
- GPS + compass end to endVerified Proven against real tablets on the fleet bus, and ran on the vehicle at Black Rock City 2026 over the vehicle WiFi, feeding position to the hero cockpit.
- All seven sentence typesUnder test
180 unit tests;
Nmea.checksumvalidated against published NMEA 0183 vectors after anxor→ormutation passed all 35 of the older tests. - The five sensor channels on the vehicleSeen live
The beacon’s sensor readings were seen live on the vehicle at Black Rock City 2026. Auto-dim from
$ZENVend to end on the tablets is still an open check. - Production Pi + u-blox hubNot built The XCover Pro is the current hub.
None of these can be proven in CI — the phone is API 29 and Robolectric models the API contract, not real OS scheduling.
- Reboot test — start the beacon,
adb reboot, confirm$ZBCNreaches a tablet within ~90 s with zero phone interaction. - Sideloaded update — install a new signed APK over a running beacon and
confirm
MY_PACKAGE_REPLACEDrestarts it. - No lock-screen credential on the beacon phone.
BOOT_COMPLETEDonly fires after first unlock on file-based-encryption devices. - Battery-optimization prompt appears once and never re-nags after a decline.
- Doze / charger-loss soak — confirm the wake lock actually prevents the tick-loop stall. Cannot be simulated.
- API 30+ two-step background-location grant. Untestable on API 29.
- API 34/35 typed
startForeground. Argued from documentation, not observed. The biggest untested-on-hardware risk in this module.
On a file-based-encryption device with a secure lock screen the boot receiver never fires, so a 3am thermal reboot would leave the fleet blind until someone physically unlocks the phone. Either confirm the beacon phone has no secure lock credential, or make the receiver and service direct-boot-aware (which also moves the auto-start preference to device-protected storage).
Broadcast targets are re-resolved every 5 s, but the socket is never bound to the WiFi
Network, so traffic can still leave the wrong interface silently.
Converted fromREADME.md · ARCHITECTURE.md §5