Skip to content

feat(ble): decode the c490 protobuf device-summary (C1000 G2 / C2000 G2)#50

Open
kb1ibt wants to merge 3 commits into
flip-dots:mainfrom
kb1ibt:pr/c490
Open

feat(ble): decode the c490 protobuf device-summary (C1000 G2 / C2000 G2)#50
kb1ibt wants to merge 3 commits into
flip-dots:mainfrom
kb1ibt:pr/c490

Conversation

@kb1ibt

@kb1ibt kb1ibt commented Jul 21, 2026

Copy link
Copy Markdown

Split out of #45 per review — the c490 protobuf device-summary decode.

Adds walk_protobuf (parsing.py) + _protobuf_body to decode the protobuf device-summary frame (the C2000 G2's c490) into a .path field map exposed via summary, rather than mis-reading it as the 1-byte-tag TLV the base parser expects (which garbles the varint tags). Adds the C2000 G2 (A1783) device on top of the C1000 G2.

Stacked on #49 (negotiation) → #48 (reassembly). GitHub shows the cumulative diff until those merge; this PR's own contribution is the last commit (the c490 decode). 106 tests pass.

kb1ibt and others added 3 commits July 20, 2026 13:29
…flip-dots#42)

Fragment reassembly lived inside _process_telemetry_packet and only ran for
_TELEMETRY_COMMANDS, so any other multi-fragment session frame (e.g. the C2000 G2
c490 device-info blob) had only its first fragment decrypted and the rest dropped
(flip-dots#42).

Extract it into a shared _reassemble()/_join_fragments() that runs in
_process_notification ahead of the cipher split, so telemetry and unknown session
frames share one reassembler regardless of the AES variant (GCM vs CBC). Single vs
fragment is decided by the live notification length (ATT_MTU - 3, via the ff09
_FRAME_OVERHEAD) rather than the frag byte, so families that put no frag byte on
singles (the A91B2 station) need no per-device override; a short single keeps a
0x11 frag byte only when it is a valid single marker. Runs start only on index 1
and terminate on the <index><total> count (so an exact multiple of the cap, with
no short tail, still completes); a partial/cold fragment that cannot decrypt is
dropped rather than crashing the notification handler.

Adds tests/test_reassembly.py (single-no-frag, 0x11 single, two-fragment,
exact-multiple-no-tail, cold index!=1) and gives the mock client a realistic
256-byte MTU so the length gate exercises as it does on device.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…mware

Replace the fixed-replay negotiation frames with live/dynamic frames -- each
carries the current timestamp (and the stage-5 confer the local timezone), which
newer firmware requires and rejects a stale one -- and add the account
owner_user_id binding that hardened Prime devices need before they arm telemetry
(without it they ack 09 and withhold updates).

This is the shared connection layer that lets the C1000 G2 / C2000 G2 and
hardened Prime chargers complete negotiation and stream, rather than being
dropped mid-handshake (addresses flip-dots#22).

Split out of flip-dots#45 per review; the c490 summary decode, Prime device support,
and docs follow as separate PRs. Based on the reassembly PR (flip-dots#48).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add walk_protobuf (parsing.py) + _protobuf_body to decode the protobuf
device-summary frame (the C2000 G2's c490) into a `.path` field map exposed via
`summary`, rather than mis-reading it as 1-byte-tag TLV (which garbles the varint
tags). Add the C2000 G2 (A1783) device on top of the C1000 G2.

Split out of flip-dots#45 per review; stacked on the negotiation PR. Prime device support
and docs follow as separate PRs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant