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

Don't forget previously discovered characteristics #747

Merged
merged 5 commits into from Feb 11, 2018

Conversation

elafargue
Copy link
Contributor

@elafargue elafargue commented Jan 31, 2018

... when calling discoverCharacteristics multiple times in a program.

Without this fix, we get crashes when unsubscribing, and never receive 'data' events on previously subscribed characteristics if calling discoverCharacteristics multiple times with different uuid lists.

This PR includes comments/feedback from #730

Without losing previously discovered characteristics. Otherwise,
every call to discoverCharacteristics forgets any previously discovered
characteristic that is not included in the most recent call.
@elafargue
Copy link
Contributor Author

These are my changes. I will include follow-up commits that roll in the fixes described in the suggestions on #730 once I have tested those.

@elafargue
Copy link
Contributor Author

@jacobrosenthal tested this overnight with multiple connects/disconnects and discoveries, as well as multiple devices connected at the same time, all working fine. This removes a lot of irritating crashes that occur when using noble intensively.

@jacobrosenthal
Copy link
Member

What about that early exit PR https://github.com/sandeepmistry/noble/pull/383/files , that seemed kind of a classy way to do it. Can you run that and see if it similarly works well?

@elafargue
Copy link
Contributor Author

elafargue commented Feb 2, 2018

I will check #383 - if it works, that would be neat, definitely.

@elafargue
Copy link
Contributor Author

OK, just checked, with #383 on its own, the code crashes again at it did earlier - that PR might have solved edge cases, but it doesn't seem to provide a complete solution like this PR does.

Let me know if you can try this PR on your side and test on your side, and whether it works for you, merging it would be a tremendous help.

@elafargue
Copy link
Contributor Author

Did a few more tests - multiple connect/disconnect, multiple "discover" for services and characteristics in each session, this PR solves all the crashes or hangs I got earlier whereas the simple fix to "noble.js" in #383 really does not, I'm afraid.

@sandeepmistry
Copy link
Collaborator

@elafargue thanks for updating, this looks good visually to me.

We'll need to do some testing here before merging.

@jacobrosenthal
Copy link
Member

Ill take a look with some of my existing code. @monteslu do we need anything for webble?

@tripish @Chondrules does this hit your needs from your previous PR?

@monteslu
Copy link
Collaborator

monteslu commented Feb 9, 2018

I think we're good on the web ble bindings. The call to service.getCharacteristics() seems to cache the characteristics internally in the web bluetooth api. I've called it manually several times and get the same characteristics back.

@jacobrosenthal
Copy link
Member

Last attempt to try to ping @tripish @Chondrules to see if this solves their old PRs #383 and #541

@jacobrosenthal jacobrosenthal merged commit 01ec6c9 into noble:master Feb 11, 2018
@elafargue
Copy link
Contributor Author

elafargue commented Feb 11, 2018 via email

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

Successfully merging this pull request may close these issues.

None yet

4 participants