Skip to content

disconnect() behaviour mismatch WinRT/bluezdbus #1857

@patman15

Description

@patman15

Hi!

To avoid stale connections, I thought (and I think I have seen an example like this) that it is a good idea to always call disconnect() on a BleakClient to avoid stale connection before connecting again. I did so in my code
https://github.com/patman15/aiobmsble/blob/7c0ea3e3220745a3d98ef10c532602fee2726099/aiobmsble/basebms.py#L331-L343

I didn't find any hints in the user manual whether this is allowed or not, so I checked the bluezdbus implementation which is safe. Unfortunately, I now found out that the WinRT implementation has an assert that raises in case the client is not connected.

Thus, my question(s): should the behavior be identical, if so, which way? If not, should it be documented, that the application needs to check the connection state? (Honestly, I considered the way that I always can call disconnect() very handy!)

Thanks,
Patrick

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions