-
Notifications
You must be signed in to change notification settings - Fork 284
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
bluez: Implement unpair() method #1067
Conversation
Nice one! It would be helpful to have some comments explaining the preconditions that lead to the various cases of having/not having |
2eebda0
to
c9a5d62
Compare
@dlech Thanks for quick review! Have fixed the issue you found with setting I've tested with permutations of the following:
Also added some code to explicitly reset the internal state of the connection after unpairing. Although Bluez sends property changes to update some of this, it seems like calling |
c9a5d62
to
7a88f4a
Compare
Operates by calling RemoveDevice on the Adapter object, which can be done regardless of the device's connection status. If the device is connected then calling this method will cause Bluez to disconnect. Calling this method will also cause Bluez to delete any bonding information and GATT attribute cache. This seems like the only applicable way to unpair a device in Bluez. It's possible to set the Trusted parameter (readwrite) on a Device object, but not the Paired parameter.
7a88f4a
to
a7fb45f
Compare
@dlech Thanks for the careful review and explanatory comments, much appreciated! I think this should be good to go now. I noticed another quirk while re-testing, which is that even if the RemoveDevice attempt fails (i.e. nothing to remove), any existing BlueZ object still needs to be re-Discovered - so I've reordered the |
merged, thanks! |
Operates by calling RemoveDevice on the Adapter object, which can be done regardless of the device's connection status.
If the device is connected then calling this method will cause Bluez to disconnect. Calling this method will also cause Bluez to delete any bonding information and GATT attribute cache.
As noted in the previous version of this function, there doesn't seem to be a more direct way to unpair a device in Bluez. It's possible to set the Trusted parameter (readwrite) on a Device object, but not the Paired parameter.