forked from SiliconLabsSoftware/matter_sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Python] Convert async API functions to python asyncio (#33989)
* [Python] Use context manager for Commissioning Use a context manager to handle the commissioning process in the device controller. This will ensure that the commissioning resources are properly cleaned up after completion and removes boiler plate code. Also clear fabricCheckNodeId and mark it internal use by adding the underline prefix. Also call pychip_ScriptDevicePairingDelegate_SetExpectingPairingComplete directly on the Python Thread, as this is an atomic operation. This is will also be more asyncio friendly as it is guaranteed to not block. * [Python] Use context manager for all callbacks Use context managers for all APIs which wait for callbacks. This allows to cleanly wrap the future and add additional handling e.g. locks for asyncio in the future. * [Python] Convert commissioning APIs to async functions Make all commissioning APIs async functions. This avoids the need to use run_in_executor() to call them from asyncio code in a non- blocking way. * [Python] Convert UnpairDevice/OpenCommissioningWindow to asyncio * [Python] Convert EstablishPASESession to asyncio * [Python] Convert IssueNOCChain to asyncio * [Python] Add locking to prevent concurrent access with asyncio Make sure that different asyncio tasks do not run the same function concurrently. This is done by adding an asyncio lock to functions which use callbacks. * [Python] Raise an exception if the future did not complete * [Python] Convert tests in src/controller/python/ to asyncio * [Python] Convert tests in src/python_testing/ to asyncio * Adjust yamltest_with_chip_repl_tester to use asyncio * [Python] Add documentation to the new context managers * [Python] Use asyncio.run() to run async tests
- Loading branch information
Showing
28 changed files
with
331 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.