Skip to content

feat(ble): Add support for FromRadioSync characteristic#4609

Merged
jamesarich merged 2 commits intomainfrom
feat/fromradiosync
Feb 21, 2026
Merged

feat(ble): Add support for FromRadioSync characteristic#4609
jamesarich merged 2 commits intomainfrom
feat/fromradiosync

Conversation

@jamesarich
Copy link
Copy Markdown
Collaborator

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.

replaces #4584

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]>
@github-actions github-actions bot added the enhancement New feature or request label Feb 20, 2026
@jamesarich jamesarich enabled auto-merge February 20, 2026 21:52
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 51.42857% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.08%. Comparing base (5d2336c) to head (1ede399).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...sville/mesh/repository/radio/NordicBleInterface.kt 51.42% 6 Missing and 11 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

@jamesarich jamesarich added this pull request to the merge queue Feb 20, 2026
@jamesarich jamesarich removed this pull request from the merge queue due to a manual request Feb 20, 2026
@jamesarich jamesarich enabled auto-merge February 20, 2026 23:52
@jamesarich jamesarich added this pull request to the merge queue Feb 21, 2026
Merged via the queue into main with commit 96d4027 Feb 21, 2026
7 checks passed
@jamesarich jamesarich deleted the feat/fromradiosync branch February 21, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant