Skip to content

Charactristic notify callback not removed on device disconnect #63

Description

@ashesman

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions