shared/message_keys.json plus C and Kotlin codegen #7
Labels
No labels
area:companion
area:docs
area:shared
area:tooling
area:watchapp
blocker
kind:chore
kind:feature
kind:spike
kind:test
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
robert/PedalPebble#7
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Define the AppMessage contract once and generate both sides. The Android side cannot read
package.jsonsymbolic keys, so numeric keys must be fixed and shared.Acceptance criteria
shared/message_keys.jsondefines every key with a fixed numeric id, direction and typewatchapp/src/c/proto.hwith the key constantsFiles
shared/message_keys.jsonwatchapp/src/c/proto.hcompanion/.../pebble/Proto.ktNotes
Speeds are mm/s and distances integer metres so the watch never needs floating point.
Update — 2026-08-31
The contract must also carry a protocol version field - see the dedicated issue. Add it here
rather than bolting it on later, since both generators need to emit it.
The contract must also carry
CONFIG_PAGES— page descriptors sent from the phone to the watch,so the display can be reconfigured without a new build. See
docs/DESIGN.mdsection 1.Update — 2026-09-01: the contract was missing half its keys
The AppMessage table in
docs/PLAN.mdpredates D16 (cadence and power) and D23 (configurable pages).It carries none of
MAX_SPEED,AVG_HR,HR_ZONE, the power keys, the cadence keys or the lap keys,and #61's
CONFIG_PAGESmessage does not exist in it at all.This issue lands in Phase 0. Generating both sides from a contract missing half its keys is
exactly the retrofit that #53 exists to make expensive.
The contract now lives in
docs/PROTOCOL.mdand that document is authoritative. PLAN.md's tableis marked as the superseded snapshot it is. Generate from PROTOCOL.md, not from PLAN.md (D28).
Added criteria:
shared/message_keys.jsoncovers every key in docs/PROTOCOL.md sections 2 and 3FieldIdin #58 either has a wire key or is documented as watch-local (HR,CLOCK)--is distinguishable from zeroCONFIG_PAGESandCONFIG_SEQincluded, so #61 needs no contract change laterHR_SAMPLESbatch format included (PROTOCOL.md section 5)NAV_CUE_CONFIDENCEincluded, so a geometric guess is distinguishable from a matched turn— rates are part of the contract, not an implementation detail
Update — 2026-09-02: generate from the revised contract
docs/PROTOCOL.mdchanged materially on 2026-09-02 (D39, D43, D44, D46). Generate from the currentdocument, not from any earlier copy:
0xFF/0xFFFF/0xFFFFFFFF/ zero-length), excludedfrom every declared range — the old text gave one generic
0xFFFF…whileSPEED_MMSsimultaneously advertised the sentinel as a legal speed
STATE_ACK(6) andCMD_TIME(74) — command queueing across a dropout (D43)SCREEN_W(75),SCREEN_H(76),SCREEN_SHAPE(77) — the phone was never told which displayit was drawing for (NFR-C12)
NAV_REJOIN_BEARING(48),NAV_REJOIN_M(49) — off-route bearing arrow (D42)MAP_ANCHOR_LAT(50),MAP_ANCHOR_LON(51),MAP_POLYLINE(52),MAP_SEQ(53),MAP_CUES(54),MAP_POS(55),MAP_HEADING(56).MAP_SCALE_Mis gone — scale is watch-local now (D39)HR_SAMPLEScarries(uint8 dt, uint8 bpm)pairs after auint32 base_timestamp, not afixed-cadence run (D46)
per group, not per key (D44)