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

Connection handling enhancements #82

Closed
JoeHut opened this issue Jul 7, 2019 · 3 comments
Closed

Connection handling enhancements #82

JoeHut opened this issue Jul 7, 2019 · 3 comments
Assignees
Labels
Backend: BlueZ Issues and PRs relating to the BlueZ backend Backend: pythonnet Issues or PRs relating to the .NET/pythonnet backend enhancement New feature or request
Milestone

Comments

@JoeHut
Copy link
Contributor

JoeHut commented Jul 7, 2019

In Bluez it should be possible to listen for an event if a device has disconnected (https://stackoverflow.com/questions/53664144/device-connect-disconnect-notification-via-bluez-dbus-api). Are there plans to add an disconnection callback to the client API (I have no idea whether this is possible on the other platforms) or even try to implement something like auto-reconnection in the library itself?

@hbldh
Copy link
Owner

hbldh commented Jul 8, 2019

There are no plans, no. It is a good idea though and I do not think it is very hard to do, at least not in the BlueZ backend.

The auto-reconnection is somewhat breaking the idea of BLE, is it not? If the connection is not used, better to let it die and let the peripheral save energy until it is actually needed and let the client reconnect then?

@hbldh hbldh added Backend: pythonnet Issues or PRs relating to the .NET/pythonnet backend Backend: BlueZ Issues and PRs relating to the BlueZ backend enhancement New feature or request labels Jul 8, 2019
@JoeHut
Copy link
Contributor Author

JoeHut commented Jul 9, 2019

I could provide a PR for the API and a BlueZ implementation, but I have no idea about .NET or the Darwin backend...

Out of experience there are multiple reasons why a BLE connection might drop, especially if the connection intervals are not properly set up. Typical cases are interferences and reflections in crowded environments and getting out of range. We always try to have a very resilient auto-reconnection on the peripheral side since you typically want to have long-lived connections where you can react to events from the peripheral in real time. But this is of course very use-case specific.

Anyways, this logic can be definitely pushed to the application if we have a proper disconnect callback.

@hbldh hbldh self-assigned this Jul 16, 2019
@hbldh hbldh added this to the v0.5.0 milestone Jul 16, 2019
hbldh added a commit that referenced this issue Aug 2, 2019
macOS support added (thanks to @kevincar)
Merged #80: macOS development
Merged #90 which fixed #89: Leaking callbacks in BlueZ
Merged #92 which fixed #91, Prevent leaking of DBus connections on discovery
Merged #96: Regex patterns
Merged #86 which fixed #83 and #82
Recovered old .NET discovery method to try for #95
@hbldh
Copy link
Owner

hbldh commented Aug 2, 2019

This is implemented and merged into version 0.5.0 which has now been deployed to PyPI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend: BlueZ Issues and PRs relating to the BlueZ backend Backend: pythonnet Issues or PRs relating to the .NET/pythonnet backend enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants