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

Fix bug in readline handling if multiple lines available #355

Merged
merged 2 commits into from
Jul 9, 2020

Conversation

Daniel-Christian-CardinalPeak
Copy link
Contributor

See #354

bluepy may read multiple lines from the helper, but readline only
returns the first one. Subsequent calls to poll() will delay (and
possibly return None) because there is no way to know that additional
lines are ready to return.

This uses a very simple loop to queue an entry every time readline
returns a line. The queue lets you easily check for ready lines, as
well as supporting get() with a timeout.

See IanHarvey#354

bluepy may read multiple lines from the helper, but readline only
returns the first one.  Subsequent calls to poll() will delay (and
possibly return None) because there is no way to know that additional
lines are ready to return.

This uses a very simple loop to queue an entry every time readline
returns a line.  The queue lets you easily check for ready lines, as
well as supporting get() with a timeout.
edwios added a commit to edwios/bluepy that referenced this pull request Mar 29, 2019
Merged response queue from IanHarvey#355 to capture all BLE responses in _lineq
Added debugging for Threads (all those rnd thingys)
In _waitResp(), put back to the queue if that is not yours (still not optimal. Proper way is for a fully thread aware approach)
Added time out in _getResp() so that _getResp() will always return
@csonsino
Copy link
Contributor

csonsino commented May 3, 2019

This PR fixes a bad behavior that I'm seeing where notifications come in delayed- I'm expecting 2 notifications but I only get 1. Then next time I'm expecting 2 notifications, I get the 1 previously missing one and 1 new one (the expected 2nd new one is now delayed until next time).
+1 from me

@axlthorell
Copy link

How do I install this patch on a Hass.io system?

csonsino pushed a commit to csonsino/bluepy that referenced this pull request Apr 28, 2020
csonsino added a commit to csonsino/bluepy that referenced this pull request May 22, 2020
* Apply upstream PR 355

IanHarvey#355

* Update version to 1.3.1
@IanHarvey IanHarvey merged commit 856c9b8 into IanHarvey:master Jul 9, 2020
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.

4 participants