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

Remove notifications asymmetrical? #343

Closed
Rlopez opened this issue Dec 29, 2016 · 1 comment
Closed

Remove notifications asymmetrical? #343

Rlopez opened this issue Dec 29, 2016 · 1 comment

Comments

@Rlopez
Copy link

Rlopez commented Dec 29, 2016

It seems like notification removal is different depending on wether the connection is requested to disconnect and the connection is lost.

If I disconnect I seem to need to do a StopNotifications() otherwise I end up with old callbacks being hit in a second connect (I sadly don't have an easy repo for that).
...but, if I suffer a disconnect I can't call StopNotifications(), else I'll get a index.js:190 Coudln't Stop Notifications:BluetoothGatt is null error and I won't be able to get notifications anymore. My guess is that notifications get automagically removed when there's a connection loss.

Is this the expected behaviour? I didn't see any of this mentioned in the docs so I am wondering if it could be added if my guesswork is correct.
Also, would it be possible to recover from the "BluetoothGatt is null error"?

@don
Copy link
Owner

don commented Jan 4, 2017

Calling ble.stopNotification writes a value to a descriptor on the peripheral, so you need to be connected to the peripheral for this to work.

I'm not sure what you mean by "end up with old callbacks being hit in a second connect". Typically I call ble.startNotification after connecting to a peripheral. I usually pass a named function as the callback rather than an anonymous inline function.

@don don closed this as completed Jan 4, 2017
don added a commit that referenced this issue Jan 5, 2017
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

2 participants