refactor(ble): improve connection lifecycle and enhance OTA reliability#4721
Merged
jamesarich merged 3 commits intomainfrom Mar 5, 2026
Merged
refactor(ble): improve connection lifecycle and enhance OTA reliability#4721jamesarich merged 3 commits intomainfrom
jamesarich merged 3 commits intomainfrom
Conversation
- Update `nordic-ble` dependency to `2.0.0-alpha16`. - Refactor `BleConnection` to introduce a `profile` helper for streamlined service discovery and characteristic setup. - Remove the `BleError` sealed class in favor of explicit disconnection reasons and boolean permanent failure flags in `RadioInterfaceService`. - Implement MTU-aware fragmentation in `BleOtaTransport` to improve reliability and prevent buffer overflows during firmware updates. - Introduce `MeshtasticRadioServiceImpl` to encapsulate GATT characteristic logic, supporting both legacy (Notify/Read) and modern (Indicate) packet flows. - Add unit tests for BLE OTA service discovery and permission handling in `BluetoothRepository`. - Centralize OTA-related UUIDs in `MeshtasticBleConstants`. - Improve error handling in `NordicBleInterface` by mapping GATT and Bluetooth exceptions to user-friendly disconnection messages. Signed-off-by: James Rich <[email protected]>
1 task
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4721 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 3 3
Lines 231 231
Branches 34 34
=====================================
Misses 231 231 ☔ View full report in Codecov by Sentry. |
…eImpl - Update the legacy `fromRadio` path to use `channelFlow` and a `MutableSharedFlow` for more robust packet draining. - Implement a loop to read from the `FROMRADIO` characteristic until an empty packet is received, rather than relying solely on the count from `FROMNUM`. - Trigger a drain operation automatically after writing to the radio when the sync characteristic is unavailable. - Suppress `CyclomaticComplexMethod` lint warning for the `streamFirmware` function in `BleOtaTransport`. Signed-off-by: James Rich <[email protected]>
Signed-off-by: James Rich <[email protected]>
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.
nordic-bledependency to2.0.0-alpha16.BleConnectionto introduce aprofilehelper for streamlined service discovery and characteristic setup.BleErrorsealed class in favor of explicit disconnection reasons and boolean permanent failure flags inRadioInterfaceService.BleOtaTransportto improve reliability and prevent buffer overflows during firmware updates.MeshtasticRadioServiceImplto encapsulate GATT characteristic logic, supporting both legacy (Notify/Read) and modern (Indicate) packet flows.BluetoothRepository.MeshtasticBleConstants.NordicBleInterfaceby mapping GATT and Bluetooth exceptions to user-friendly disconnection messages.