Repository navigation
Conversation
Port the heart rate stream handling from Ripthulhu/librepods. - Ask the buds for their sensor descriptors after init and use the announced heart rate service number; fall back to 19/20/84 only until a descriptor was seen. A service counts as heart rate only when its HID descriptor dictionary matches the known layout exactly (SensorDescriptorLayout). - Start sequence: open services 0 and 4, HRM_STATE (0x30) on, then the SensorDataWX setting (log type 2, 1 s) to HEARTRATE_COMMAND and HEARTRATE. Stop sends interval 0 and HRM_STATE off. - Watchdog: no valid sample for 12 s restarts the stream once, then gives up and reports INACTIVE instead of staying in WAITING. - Samples need 18 bytes, 30-220 bpm, confidence >= 0x80 and one of the captured status tails. - Reassemble RTBuddy records across socket reads and raise the read buffer from 1 KiB, so descriptor announcements arrive whole. - sensor_descriptor is repeated in the proto. - One HeartRateSession per socket, so a stale connection cannot write. - Unit tests for parsing, framing and the start/stop wire sequence.
Dardrai
force-pushed
the
port/heart-rate
branch
from
November 13, 2026 08:06
dcb6aa8 to
9e668c7
Compare
Dardrai
marked this pull request as ready for review
November 13, 2026 08:23
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.
Ports the heart rate handling from Ripthulhu/librepods onto
android/rewrite. Only the core protocol code changes. The UI is untouched:startHr()/stopHr()keep their signatures.What changes
RequestAllDescriptorsand uses the heart rate service number the buds announce. A service counts only if its HID descriptor dictionary matches the known layout exactly (SensorDescriptorLayout). Legacy numbers 19/20/84 are used only until a descriptor arrives.HRM_STATE(control0x30) = 1 → SensorDataWX setting (log type 2, report 1,heartRateInterval) to HEARTRATE_COMMAND and HEARTRATE.HRM_STATE= 2.INACTIVEinstead of staying inWAITINGforever.0x80, and one of the six status tails seen in captures. This replaces thepayload[17] == 0check.SensorFrames), and the read buffer goes from 1 KiB to 64 KiB, so descriptor announcements arrive whole.sensor_descriptoris nowrepeated, because the buds announce several in one message.HeartRateSessionper socket, so a stale socket can't write or update state after a reconnect.BUDDY_COMMANDrecords now arrive through the reassembler beforehandleSensorData().Tests
Adds JUnit to
:corewith 9 unit tests: descriptor parsing (including every truncation), sample validation, service remapping and restart, framing across every read split, and the start/stop wire sequence../gradlew :core:testDebugUnitTestpasses.Not done yet
rewrite; the logic comes from the fork, where it runs on AirPods Pro 3. I'll mark this ready once it's verified here.:appnot built locally; only:corewas compiled and tested.🤖 Generated with Claude Code