-
Notifications
You must be signed in to change notification settings - Fork 304
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
corebluetooth: work around macOS 12 scanner bug #692
Conversation
3e0da7a
to
8162caa
Compare
This is great, but a sad state of affairs that it is needed. I was wrong in my comment in the issue then: there was a workaround that was reasonable... It does require prior knowledge of the device though, or could you pass e.g. Device Information service uuid if nothing is sent in in Bleak and get all devices anyway? The DI is always present, or am I wrong again? 🤔 |
The services have to be specifically included in the advertising data, so if a device advertises no services, we won't be able to connect. The Accessory Design Guidelines for Apple Devices specifically says:
So I'm afraid you are wrong about counting on the DI service. |
597600c
to
993f1bf
Compare
All platforms have been implemented now. Incidentally, this also fixes #230. |
Unless I'm missing something, this doesn't fix |
The kwargs from Using |
From my standpoint as a user, I don't see any reason not to deprecate that use - switching my project away from it was trivial and I agree there are wins there. 👍 |
993f1bf
to
02000d9
Compare
macOS has a bug (feature?) where advertising data is no longer received unless one or more service UUIDs are given in scanForPeripheralsWithServices:options:. This implements a new kwarg on `BleakScanner` to allow users to provide such a list of UUIDs. This commit only implements it in the CoreBluetooth backend with other backends to follow. Issue #635.
This implements the service_uuids kwarg in BleakScanner in the BlueZ backend.
This changes set_scanning_filter in the Android backend to raise NotImplementedError since it is not implemented. Also remove async specifier since this is not supposed to be an async function.
This implements the BleakScanner service_uuids kwarg in the Android backend.
This changes how advertising data is cached and combined. Previously, we just cached scan response data to get the local name later. Separate callbacks were called for advertising data and scan response data which makes more work for users who are interested in filtering on data that is split between the two packets. Now, the advertising data and scan response data are both cached together as a single object and this object is used to create the Bleak advertising data structure so that the advertising data seen by Bleak users now contains the information from both advertising data type combined.
This provides an implementation for the BleakScanner service_uuids kwarg in the WinRT backend. As explained in the code comment, it is not possible to use the OS-provided filter mechanism for technical reasons. Fixes #230
02000d9
to
afe2b85
Compare
What is the path to get this merged to |
Is there pls any estimate on when this PR (currently develop branch) gets to a new release on pipy? Thanks |
How does this work with manufacturer data? They seem to come as separate announcements from the list of services? Will the scanner still get these manufacturer data if the device at least once announce a selected service? |
MacOS combines the information from the advertising data packet and scan response packet so I don't expect any problems in that regard. |
I can confirm that it seem to work. Seams to take a bit longer for first manufacturer data to show up, but no issue otherwise. |
macOS has a bug (feature?) where advertising data is no longer received unless one or more service UUIDs are given in
scanForPeripheralsWithServices:options:
.This implements a new kwarg on
BleakScanner
to allow users to provide such a list of UUIDs. This commit only implements it in the CoreBluetooth backend with other backends to follow.If macOS 12 is detected and this kwarg is not given, an error will be logged explaining how to fix the problem.
Fixes #635.