-
Notifications
You must be signed in to change notification settings - Fork 292
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
access denied error in windows backend due to GattServicesChanged event #1061
Comments
This seems like a tricky one to handle. We can't know if a device has a Services Changed characteristic until services have been resolved. And we can't know when Windows decides to enable indications on this characteristic. If we get the event during |
…nt occurs We can get an access denied error for services returned before a services changed event. This handles services changed events that are received while attempting to get services. Hopefully, this is the only time this event is received in most cases. Fixes #1061.
…nt occurs We can get an access denied error for services returned before a services changed event. This handles services changed events that are received while attempting to get services. Hopefully, this is the only time this event is received in most cases. Fixes #1061.
…nt occurs We can get an access denied error for services returned before a services changed event. This handles services changed events that are received while attempting to get services. Hopefully, this is the only time this event is received in most cases. Fixes #1061.
I had a very similar problem while writing data to a Nordic UART service. I had many access denies errors when I started with bleak version 0.13 and after updating to 0.15 it change more to "The object is already closed" or "A method was called at an unexpected time" (don't know the exact error messages as my system reported them in German)
The problem for me was that the device kept updating the service list during service discovery. I added a gatt_services_changed listener to the WinRT client and started over with service discovery if it is was currently running or started a new discovery before accessing the services list the next time.
The documentation of the GattServicesChanged event (https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.bluetoothledevice.gattserviceschanged) says:
For my device I get the event 11 times during the first service discovery and if I reload them after I got the event everything works as expected.
I can open a PR in the next days with a suggestion how to deal with this issue.
Originally posted by @jochenjagers in #849 (comment)
The text was updated successfully, but these errors were encountered: