Add system_profiler alternative method for paired device queries#101
Add system_profiler alternative method for paired device queries#101
Conversation
0c83667 to
88b16c8
Compare
|
This change with the use of the new method should address #87 Unfortunately I don't have many devices with multi-point connection so I can't test it thoroughly. |
|
Right away noticed the point about usage of private APIs, but |
Ah soz, I'll update the copy. |
ad87836 to
ee001a3
Compare
|
@toy updated the PR with the correct wording, could you take another look when you have a moment, please? |
toy
left a comment
There was a problem hiding this comment.
First thank you for creating the PR
I think it is better at first to add only environment variable way of switching to system_profile method of listing devices. Also it maybe better (not sure about this) to use variable like BLUEUTIL_DEVICE_LISTING=system_profile, what do you think?
And please run clang-format, I'll add a runner for that
This allows the correct connection reporting for some devices with multi-point connection capability (e.g. Bose QC Ultra)
My pleasure and thanks for writing the utility, it's an indispensable part of my workflow, such convenience!
No worries, I'll remove the argument.
I think, if we had 3 or more options for device listings, this would have worked really well but since we only have one alternative, I'm leaning towards |
ee001a3 to
a166dee
Compare
|
I remembered also few things that I thought about: please mark the option in readme and help output as experimental and I think enabling the feature will break part of other calls, so the mock object should probably use |
a166dee to
91b30c3
Compare
91b30c3 to
84af1da
Compare
|
Thanks for the feedback @toy , I've addressed them to the best of my ability (I'm fairly new to Objective-C), please let me know if you have any other feedback for me.
Good call. I've mark the new method experimental and mock now falls back to the actual object. |
toy
left a comment
There was a problem hiding this comment.
I'll try to check how it behaves in the next few days
toy
left a comment
There was a problem hiding this comment.
I tried to use system_profiler way and few methods I checked seem to work well. And I looked over the code again
|
Thank you so much for reviewing it again and your continued support! I have addressed your most recent feedback, let me know what you think! |
toy
left a comment
There was a problem hiding this comment.
I just added a changelog entry and did a bit of cleanup
Maybe check how it works for you and I can merge'n'release
Thanks @toy , I've been using the modified version for the past week, works fine from my end; my headphone connection is detected correctly with this approach |
|
Released as v2.13.0 |
Summary
This PR introduces an alternative method for querying paired Bluetooth devices using the public system_profiler command instead of private IOBluetooth framework APIs. This provides the same functionality while using only documented system interfaces and resolves connection status issues with some multi-point devices.
New Features
BLUEUTIL_USE_SYSTEM_PROFILER=1environment variable: Set default behaviour to use system_profilerBenefits
multiple devices simultaneously
Implementation Details
system_profiler SPBluetoothDataType -xmlMockBluetoothDeviceclass that provides the same interface asIOBluetoothDeviceget_paired_devices()to choose between methods based on flag--paired,--connected, device search) to use the new systemUsage Examples
Backward Compatibility
This change is fully backward compatible. The default behaviour remains unchanged, using IOBluetooth APIs. The new functionality is opt-in only.