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

Subscribing to single notification characteristic and cannot unsubscribe #318

Open
imranmoezkhan opened this issue Mar 1, 2021 · 0 comments

Comments

@imranmoezkhan
Copy link

I have a service with a number of characteristics and I'm trying to use pygatt to subscribe to a particular notification characteristic, but it seems to be subscribing to all of them:

p=adapter.connect("6C:ED:CA:81:DE:7D", address_type=ADDRESS_TYPE)
INFO:pygatt.backends.gatttool.gatttool:Connecting to 6C:ED:CA:81:DE:7D with timeout=5.0
p.subscribe("6e500002-b5a3-f393-e0a9-e50e24dcca9e")
DEBUG:pygatt.device:Looking up handle for characteristic 6e500002-b5a3-f393-e0a9-e50e24dcca9e
DEBUG:pygatt.backends.gatttool.gatttool:Found characteristic 00002a05-0000-1000-8000-00805f9b34fb, value handle: 0x3
DEBUG:pygatt.backends.gatttool.gatttool:Found characteristic 00002a00-0000-1000-8000-00805f9b34fb, value handle: 0x16
DEBUG:pygatt.backends.gatttool.gatttool:Found characteristic 00002a01-0000-1000-8000-00805f9b34fb, value handle: 0x18
DEBUG:pygatt.backends.gatttool.gatttool:Found characteristic 00002aa6-0000-1000-8000-00805f9b34fb, value handle: 0x1a
DEBUG:pygatt.backends.gatttool.gatttool:Found characteristic 6e500002-b5a3-f393-e0a9-e50e24dcca9e, value handle: 0x2a
DEBUG:pygatt.backends.gatttool.gatttool:Found characteristic 6e500003-b5a3-f393-e0a9-e50e24dcca9e, value handle: 0x2d
DEBUG:pygatt.backends.gatttool.gatttool:Found characteristic 6e500004-b5a3-f393-e0a9-e50e24dcca9e, value handle: 0x30
DEBUG:pygatt.backends.gatttool.gatttool:Found characteristic 6e500005-b5a3-f393-e0a9-e50e24dcca9e, value handle: 0x33
DEBUG:pygatt.backends.gatttool.gatttool:Found characteristic 6e500006-b5a3-f393-e0a9-e50e24dcca9e, value handle: 0x36
DEBUG:pygatt.device:Found
DEBUG:pygatt.backends.gatttool.gatttool:Sending cmd=char-write-req 0x2b 0100
INFO:pygatt.backends.gatttool.gatttool:Sent cmd=char-write-req 0x2b 0100
INFO:pygatt.device:Subscribed to uuid=6e500002-b5a3-f393-e0a9-e50e24dcca9e
INFO:pygatt.device:Received notification on handle=0x2a, value=0xb'313631343537393939352e3739393a34372e3335'
INFO:pygatt.device:Received notification on handle=0x2d, value=0xb'313631343537393939352e3830393a2e32382c2e'
INFO:pygatt.device:Received notification on handle=0x30, value=0xb'313631343537393939352e3833373a322e36352c'
INFO:pygatt.device:Received notification on handle=0x2d, value=0xb'313631343537393939352e3838393a2e32362c2e'
INFO:pygatt.device:Received notification on handle=0x30, value=0xb'313631343537393939352e3933323a322e31342c'
INFO:pygatt.device:Received notification on handle=0x33, value=0xb'313631343537393939352e3933393a2e30312c2e' `

Also, I seem to be getting notifications even after unsubscribing to the characteristic:

p.unsubscribe("6e500002-b5a3-f393-e0a9-e50e24dcca9e")
DEBUG:pygatt.device:Looking up handle for characteristic 6e500002-b5a3-f393-e0a9-e50e24dcca9e
DEBUG:pygatt.device:Found
DEBUG:pygatt.backends.gatttool.gatttool:Sending cmd=char-write-req 0x2b 0000
INFO:pygatt.backends.gatttool.gatttool:Sent cmd=char-write-req 0x2b 0000
INFO:pygatt.device:Unsubscribed from uuid=6e500002-b5a3-f393-e0a9-e50e24dcca9e
INFO:pygatt.device:Received notification on handle=0x2a, value=0xb'313631343538303032322e3335323a34372e3335'
INFO:pygatt.device:Received notification on handle=0x2d, value=0xb'313631343538303032322e3335363a2e32372c2e'
INFO:pygatt.device:Received notification on handle=0x2d, value=0xb'313631343538303032322e3336303a2e32372c2e'
INFO:pygatt.device:Received notification on handle=0x2d, value=0xb'313631343538303032322e3432313a2e32382c2e'
INFO:pygatt.device:Received notification on handle=0x30, value=0xb'313631343538303032322e3434333a322e31332c'
INFO:pygatt.device:Received notification on handle=0x33, value=0xb'313631343538303032322e3434373a2e30322c2e'
INFO:pygatt.device:Received notification on handle=0x36, value=0xb'313631343538303032322e3435323a2d3132352e'
INFO:pygatt.device:Received notification on handle=0x2d, value=0xb'313631343538303032322e3438353a2e32372c2e'

Is there something I'm doing wrong?

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