Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support configure() call on services and expose BluetoothScanner via APISupport SPI #50

Merged
merged 4 commits into from
Oct 20, 2024

Conversation

Supereg
Copy link
Member

@Supereg Supereg commented Sep 15, 2024

Support configure() call on services and expose BluetoothScanner via APISupport SPI

♻️ Current situation & Problem

Currently it is not possible for a BluetoothService implementation to provide steps for configuration (e.g., set up onChange handlers). Only the BluetoothDevice has a configure() method that can be used for these use cases. This PR adds a new configure() method to BluetoothServices such that their logic can be self-contained.
Additionally, the scanNearbyDevices has really useful logic for Bluetooth Scanners that was previously (< 2.0) accessible in the public interface, but is exclusively accessible to the Bluetooth module and the BluetoothManager. This PR exposes these interfaces as the APISupport SPI. This allows other library developers to reuse the scanNearbyDevices modifier for their custom Bluetooth scanner implementations (e.g., Muse SDK in NAMS).

⚙️ Release Notes

  • Added optional configure() method to the BluetoothService protocol to allow for self-container bluetooth service implementations.
  • Allow to implement your own BluetoothScanner.

📚 Documentation

Added documentation for newly exposed symbols.

✅ Testing

--

📝 Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

Copy link

codecov bot commented Sep 15, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Project coverage is 79.90%. Comparing base (8ee8ba9) to head (7e40b2c).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...uetooth/CoreBluetooth/Model/DiscoverySession.swift 50.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #50      +/-   ##
==========================================
- Coverage   80.92%   79.90%   -1.01%     
==========================================
  Files         108      109       +1     
  Lines        5958     5955       -3     
==========================================
- Hits         4821     4758      -63     
- Misses       1137     1197      +60     
Files with missing lines Coverage Δ
Sources/SpeziBluetooth/Bluetooth.swift 87.02% <100.00%> (-1.52%) ⬇️
...peziBluetooth/CoreBluetooth/BluetoothManager.swift 82.15% <100.00%> (-0.19%) ⬇️
...iBluetooth/CoreBluetooth/BluetoothPeripheral.swift 73.37% <100.00%> (-1.46%) ⬇️
...ources/SpeziBluetooth/Model/BluetoothService.swift 100.00% <100.00%> (ø)
...tooth/Model/SemanticModel/SetupDeviceVisitor.swift 86.21% <100.00%> (+0.76%) ⬆️
...Bluetooth/Modifier/ScanNearbyDevicesModifier.swift 71.12% <100.00%> (ø)
...uetooth/CoreBluetooth/Model/DiscoverySession.swift 75.79% <50.00%> (-13.00%) ⬇️

... and 13 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ee8ba9...7e40b2c. Read the comment docs.

Copy link
Member

@PSchmiedmayer PSchmiedmayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the updates! 🚀

@Supereg Supereg merged commit 977cc67 into main Oct 20, 2024
12 checks passed
@Supereg Supereg deleted the feature/service-configure branch October 20, 2024 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants