refactor(ble): Migrate to Nordic BLE Library for scanning and bonding#3712
Merged
Conversation
This commit refactors the Bluetooth Low Energy (BLE) implementation to use the Nordic Semiconductor BLE Library, replacing the native Android BLE APIs for scanning and bonding. Key changes include: - Replaced the native `BluetoothLeScanner` with `CentralManager` from the Nordic BLE Library. - Migrated device scanning logic to use the library's `scan` flow, simplifying the process and improving reliability. - Replaced the manual bond creation process with the library's `createBond()` suspend function. - Updated `BluetoothRepository` to manage BLE state, scanning, and bonding through the new library. - Removed the now-unused `BluetoothLeScanner.kt` extension file. - Renamed `BleUuidConstants` to `BleConstants` for clarity. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3712 +/- ##
=====================================
Coverage 0.56% 0.56%
=====================================
Files 378 378
Lines 21621 21605 -16
Branches 2662 2653 -9
=====================================
Hits 122 122
+ Misses 21478 21462 -16
Partials 21 21 ☔ View full report in Codecov by Sentry. |
mdecourcy
pushed a commit
to mdecourcy/Meshtastic-Android
that referenced
this pull request
Nov 19, 2025
…meshtastic#3712) Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
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 part 2: Scanning and Bonding
This refactors the Bluetooth Low Energy (BLE) implementation to use the Nordic Semiconductor BLE Library, replacing the native Android BLE APIs for scanning and bonding.
Key changes include:
BluetoothLeScannerwithCentralManagerfrom the Nordic BLE Library.scanflow, simplifying the process and improving reliability.createBond()suspend function.BluetoothRepositoryto manage BLE state, scanning, and bonding through the new library.BluetoothLeScanner.ktextension file.BleUuidConstantstoBleConstantsfor clarity.