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

make connection phy async #649

Merged
merged 2 commits into from
Feb 18, 2025
Merged

make connection phy async #649

merged 2 commits into from
Feb 18, 2025

Conversation

barbibulle
Copy link
Collaborator

As reported in #647 it isn't safe to delay the emission of the connection even until we have asynchronously read the connection PHY from the controller. Unfortunately, the controller doesn't provide the PHY information when a connection is made, it has to be requested with a command, which is an asynchronous sequence, and thus some data could be received between the time the PHY request is made and the response is received, in which case that data will arrive before the connection event is emitted.
The only clean solution here is that the Connection object can't have a synchronous phy property. It must be an async "property" (not really a property, because real properties can't be async, but an async def get_phy() method).
Also, as a consequence of this change, the connection_phy_update event must pass the PHY value as a parameter, so as not to required an un-necessary get_phy request from the listener to obtain the information.
This does change the API slightly, but it probably won't break too many users.

@barbibulle barbibulle requested a review from zxzxwu February 18, 2025 03:33
@barbibulle barbibulle merged commit 2c3af5b into main Feb 18, 2025
57 checks passed
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