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

added remove_device function to BleakClient interface and implement it for WinRT backend #1002

Closed

Conversation

jochenjagers
Copy link
Contributor

Hello,

this PR adds a remove_device function to be able to remove a device without the need of connecting to it before.
This was inspired by the remove_device function for the bluez backend from another pull request (https://github.com/hbldh/bleak/pull/640/files#diff-dca4aa1d374b221291b543a5d1296bbf912b43d1e2ebc51ed11c1eb153fbb89bR118)
As I have no possibility to test with the bluez backend at the moment I did not copy it from there.

Additionally I moved the validate_address function out of the bluez backend utils into a generic utils file to be able to use it in the WinRT backend as well.

@dlech
Copy link
Collaborator

dlech commented Sep 12, 2022

EDIT: disregard this comment, I had disconnection on my mind instead of removing pairing info

Thanks for the PR. However, BlueZ is the only backend that has a problem with not disconnecting sometimes and it is not possible to "disconnect" in any other backend without "connecting" first. Something similar was recently discussed in #992. Perhaps the feature that was added to close that issue could be of help for your use case (it allows "connecting" in the BlueZ backend without disconnecting first)?

@dlech
Copy link
Collaborator

dlech commented Sep 12, 2022

Can we not just make sure that calling the existing unpair() method works without being connected instead of adding a new method?

@dlech
Copy link
Collaborator

dlech commented Sep 12, 2022

Related issue: #309

@jochenjagers
Copy link
Contributor Author

Changing the unpair() function was also my first idea and I did this in the version of bleak I am currently using on my own.
But I was not happy about the complexity which was added to unpair() by this. And it might not be clear to the user that pair() needs a connection but unpair() can be used without. It is obvious if you know how it works but it might be confusing if you are new to the topic.
But I will have a look on unpair() again and check for an easy solution.

@jochenjagers
Copy link
Contributor Author

What do you think about this solution?
develop...jochenjagers:bleak:feature/winrt-unpair-without-connect
It allows unpair without connection for the WinRT backend without adding a new function to the inferface.

@dlech
Copy link
Collaborator

dlech commented Sep 14, 2022

It will be easier to make specific comments in a pull request, but in general, it looks like the right approach.

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.

None yet

2 participants