Skip to content

aioble: Fix notified/indicated event waiting. #459

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

Merged
merged 3 commits into from
Nov 11, 2021

Conversation

jimmo
Copy link
Member

@jimmo jimmo commented Nov 8, 2021

After a client does a successful await char.notified(), then before the
next call to notified() a notification arrives, then they call
notified() twice before the next notification, the second call will
return None rather than waiting.

This applies the same fix as in 5a86aa5
which solved a similar problem for server-side char.written(). Using
a deque is slightly overkill here, but it's consistent with the server
side, and also makes it very easy to support having a notification queue
in the future.

Also makes the client characteristic properly flags/properties-aware (i.e.
explicitly fail operations that aren't supported).

Signed-off-by: Jim Mussared [email protected]

After a client does a successful `await char.notified()`, then before the
next call to `notified()` a notification arrives, then they call
`notified()` twice before the _next_ notification, the second call will
return None rather than waiting.

This applies the same fix as in 5a86aa5
which solved a similar problem for server-side `char.written()`. Using
a deque is slightly overkill here, but it's consistent with the server
side, and also makes it very easy to support having a notification queue
in the future.

Also makes the client characteristic properly flags/properties-aware (i.e.
explicitly fail operations that aren't supported).

Signed-off-by: Jim Mussared <[email protected]>
This allows a server to write a characteristic and automatically
notify/indicate all subscribed clients.

Signed-off-by: Jim Mussared <[email protected]>
jimmo added a commit to jimmo/micropython-lib that referenced this pull request Nov 10, 2021
This replicates the failure described in micropython#453 (which is fixed by micropython#459.

Also adds a test for subscription.

Signed-off-by: Jim Mussared <[email protected]>
This replicates the failure described in micropython#453 (which is fixed by micropython#459.

Also adds a test for subscription.

Signed-off-by: Jim Mussared <[email protected]>
@jimmo
Copy link
Member Author

jimmo commented Nov 10, 2021

Added multitest for this.

Also added multitest for subscription (so I've pulled in the commit from #437).

@dpgeorge dpgeorge merged commit dd9b783 into micropython:master Nov 11, 2021
@dpgeorge
Copy link
Member

Thank you! The multitests pass for me on PYBD+PYBD.

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.

2 participants