feat(ble): Add support for FromRadioSync characteristic#4609
Merged
jamesarich merged 2 commits intomainfrom Feb 21, 2026
Merged
feat(ble): Add support for FromRadioSync characteristic#4609jamesarich merged 2 commits intomainfrom
FromRadioSync characteristic#4609jamesarich merged 2 commits intomainfrom
Conversation
This commit introduces support for the new `FromRadioSync` BLE characteristic, which uses `INDICATE` properties to provide a more efficient and reliable method for receiving data from the radio. The connection logic now prioritizes `FromRadioSync` if the peripheral advertises it. When available, the app subscribes to indications from this characteristic, and each indication contains the full data packet. This eliminates the legacy two-step process of getting a `NOTIFY` on `FromNum` and then performing a `READ` on `FromRadio`. If `FromRadioSync` is not present, the system gracefully falls back to the original `FromNum`/`FromRadio` notification and read mechanism, ensuring backward compatibility with older device firmware. The `BluetoothBroadcastReceiver` has been removed as its functionality is now handled directly by the `kotlin-ble` library, simplifying the codebase. Additionally, several improvements have been made to the BLE testing infrastructure: - New tests have been added for `BleScanner` and the `retryBleOperation` utility. - Existing tests have been updated to use `advanceUntilIdle()` instead of `delay()`, making them more robust and faster. - A specific test case for the `FromRadioSync` characteristic has been included to validate the new logic. - The service discovery logic in `BleConnection` has been refined to better handle optional characteristics. Signed-off-by: James Rich <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4609 +/- ##
==========================================
+ Coverage 15.92% 16.08% +0.16%
==========================================
Files 84 84
Lines 4133 4152 +19
Branches 737 745 +8
==========================================
+ Hits 658 668 +10
- Misses 3356 3359 +3
- Partials 119 125 +6 ☔ View full report in Codecov by Sentry. |
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.
This commit introduces support for the new
FromRadioSyncBLE characteristic, which usesINDICATEproperties to provide a more efficient and reliable method for receiving data from the radio.The connection logic now prioritizes
FromRadioSyncif the peripheral advertises it. When available, the app subscribes to indications from this characteristic, and each indication contains the full data packet. This eliminates the legacy two-step process of getting aNOTIFYonFromNumand then performing aREADonFromRadio.If
FromRadioSyncis not present, the system gracefully falls back to the originalFromNum/FromRadionotification and read mechanism, ensuring backward compatibility with older device firmware.The
BluetoothBroadcastReceiverhas been removed as its functionality is now handled directly by thekotlin-blelibrary, simplifying the codebase.Additionally, several improvements have been made to the BLE testing infrastructure:
BleScannerand theretryBleOperationutility.advanceUntilIdle()instead ofdelay(), making them more robust and faster.FromRadioSynccharacteristic has been included to validate the new logic.BleConnectionhas been refined to better handle optional characteristics.replaces #4584