Document Flipper Zero BLE RPC recipe over the GATT tools - #33
Merged
Conversation
Add a "Flipper Zero over BLE" worked example to README.md mapping the real Flipper serial BLE-RPC sequence (pair/connect, MTU 517, subscribe RX indicate + status notify, write 01000000 session activation, write_wait the protobuf frame to TX, poll RX length_delimited, storage_read) onto the shipped bt_* GATT tools from #31. Prominently documents the two operational gotchas: never send the USB-only start_rpc_session string over BLE, and disconnect the official Flipper app (single BLE client). Notes the module is protocol-agnostic - the calling agent encodes/decodes PB.Main. Also replaces the earlier inline Flipper snippet (which used inconsistent UUIDs and an RX/TX mapping that disagreed with real-device testing) with a pointer to the authoritative section, and adds a CLAUDE.md pointer. Docs-only: verified #31's tools already carry the full sequence - indicate subscription (CCCD 0x0002), independent per-characteristic queues, connection pinned across calls, exact-bytes write path (no start_rpc_session injection), and length_delimited reassembly of frames spanning indications all check out. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NgN7YdfLT41kWnWqe1MPZa
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Docs-only. Adds a Flipper Zero over BLE worked example to
README.md(plus a pointer inCLAUDE.md) that maps the real Flipper serial BLE-RPC sequence onto thebt_*GATT tools shipped in #31 — no module code changes were needed.The recipe covers: pair/connect →
bt_gatt_request_mtu517 → subscribe RX…61feindicate + status…64fenotify → write01000000session-activation to…64fe→bt_gatt_write_waitthe app_start/NFC protobuf to TX…62fe→ poll RXdecode:"length_delimited"→storage_read /ext/nfc/.... It uses the authoritative service8fe5b3d5-2e7f-4a98-2a48-7acc60fe0000and characteristic UUIDs from real-device testing (Pixel 6 ↔ Flipper80:E1:27:66:36:CB), and prominently states the two gotchas: (1) never send the USB-onlystart_rpc_sessionstring over BLE, (2) the official Flipper app must be disconnected (single BLE client). It also notes the module is protocol-agnostic — the calling agent encodes/decodesPB.Main.I also replaced the earlier inline Flipper snippet, whose UUIDs and RX/TX mapping disagreed with real-device testing, with a pointer to the new authoritative section.
Verification of #31's tools (all pass — no code gap)
AndroidBluetoothSource.doSubscriberesolvesmode:indicate→ checksPROPERTY_INDICATEand writesENABLE_INDICATION_VALUE(CCCD0x0002);notify→ENABLE_NOTIFICATION_VALUE(0x0001);auto→ prefers indicate when advertised, else notify. Exactly the RX…61fe(indicate) +…63fe/…64fe(notify) split. Pass.GattConnection.subscriptionsis aConcurrentHashMap<subKey, Subscription>, eachSubscriptionowning its ownArrayBlockingQueue;onCharacteristicChangedroutes bysubKey(characteristic). RX indicate + two notify chars each get an independent queue on one connection. Pass.gattConnectionsis keyed by address and held in a single long-lived source instance; subscribe/write/poll all reuse the one liveBluetoothGatt.gattWritesends exactly the caller'svalue(testgattWriteSucceedsasserts01ff→[0x01,0xff]);gattWriteWaitpasses the raw value straight through. Nostart_rpc_sessionor implicit framing anywhere in the repo (grep: 0 hits). Pass.Subscription.reassemblekeeps a persistentreassemblybuffer, concatenates event values, runsparseLengthDelimited(varint LEB128 length + payload), and carries the incomplete remainder to the next call — soPB.Mainframes spanning several indications come back whole. Covered bylengthDelimitedReassemblyAcrossTwoEventsYieldsOneFrameandparseLengthDelimitedBuffersIncompleteRemainder. Pass.gattWriteWaitauto-subscribes RX, clears stale events, writes TX, thencollectUntilbounded byidle_timeout_ms/max_bytes/ overalltimeout_ms. The module correctly can't know protobufhas_next, so the agent bounds collection with idle_timeout/max_bytes and repeats poll untilhas_next = 0— documented in the recipe. Pass.Conclusion: #31 already provides the full subscribe/notify/indicate/write-wait capability for the Flipper BLE RPC sequence. No code change was warranted; this PR is documentation only.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NgN7YdfLT41kWnWqe1MPZa
Generated by Claude Code
Summary by cubic
Adds a real-device-tested Flipper Zero over BLE worked example to
README.md, with a pointer inCLAUDE.md. It replaces the earlier inline snippet, whose UUIDs and RX/TX mapping disagreed with real-device testing, and requires no module code changes — the existingbt_*GATT tools already support the full sequence.Recipe coverage
01000000), protobuf writes to TX, andlength_delimitedpolling.start_rpc_sessionstring over BLE, and the official Flipper app must be disconnected (single BLE client).Written for commit 69a1fb9. Summary will update on new commits.