Skip to content

refactor(ble): Migrate to Nordic BLE Library for scanning and bonding#3712

Merged
jamesarich merged 1 commit into
mainfrom
feat/nordic-scanning
Nov 16, 2025
Merged

refactor(ble): Migrate to Nordic BLE Library for scanning and bonding#3712
jamesarich merged 1 commit into
mainfrom
feat/nordic-scanning

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

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:

  • 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.

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>
@github-actions github-actions Bot added the enhancement New feature or request label Nov 16, 2025
@codecov

codecov Bot commented Nov 16, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 126 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.56%. Comparing base (e06a598) to head (63b09ac).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...main/java/com/geeksville/mesh/model/BTScanModel.kt 0.00% 57 Missing ⚠️
...e/mesh/repository/bluetooth/BluetoothRepository.kt 0.00% 42 Missing ⚠️
.../java/com/geeksville/mesh/model/DeviceListEntry.kt 0.00% 18 Missing ⚠️
...eeksville/mesh/ui/connections/ConnectionsScreen.kt 0.00% 6 Missing ⚠️
.../repository/bluetooth/BluetoothRepositoryModule.kt 0.00% 2 Missing ⚠️
...sville/mesh/repository/bluetooth/BluetoothState.kt 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@jamesarich jamesarich added this pull request to the merge queue Nov 16, 2025
Merged via the queue into main with commit 0f8e475 Nov 16, 2025
6 checks passed
@jamesarich jamesarich deleted the feat/nordic-scanning branch November 16, 2025 04:36
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>
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