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

Charactristic notify callback not removed on device disconnect #63

Open
ashesman opened this issue Feb 24, 2021 · 0 comments
Open

Charactristic notify callback not removed on device disconnect #63

ashesman opened this issue Feb 24, 2021 · 0 comments

Comments

@ashesman
Copy link

It seems that the characteristic notify callback that is registered with the underlying layer is not removed when a device disconnects. When you reconnect to that device and register a notify callback it is called twice for each time data is received. Every time you disconnect/reconnect and register the callback you get one more call of the callback each time. Note that a new derived gatt.Device is instantiated on each connect.

In my disconnect code I call .enable_notifications(False) on the particular characteristic in question. Seems to work correctly if the central is causing the disconnect. However, if the peripheral device is remotely disconnected (e.g. powered off), then device.services is no longer valid to obtain the characteristic to call enable_notifications on.

I would assume it is the responsibility of the destructing code to clean up any callbacks registered?

Any ideas how to work around this?

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

No branches or pull requests

1 participant