Skip to content

Commit 316a9bb

Browse files
committed
[Python] Convert IssueNOCChain to asyncio
1 parent fd882ea commit 316a9bb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/controller/python/chip/ChipDeviceCtrl.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -2074,17 +2074,18 @@ def NOCChainCallback(self, nocChain):
20742074
self._issue_node_chain_context.future.set_result(nocChain)
20752075
return
20762076

2077-
def IssueNOCChain(self, csr: Clusters.OperationalCredentials.Commands.CSRResponse, nodeId: int):
2077+
async def IssueNOCChain(self, csr: Clusters.OperationalCredentials.Commands.CSRResponse, nodeId: int):
20782078
"""Issue an NOC chain using the associated OperationalCredentialsDelegate.
20792079
The NOC chain will be provided in TLV cert format."""
20802080
self.CheckIsActive()
20812081

20822082
with self._issue_node_chain_context as ctx:
2083-
self._ChipStack.Call(
2083+
res = await self._ChipStack.CallAsync(
20842084
lambda: self._dmLib.pychip_DeviceController_IssueNOCChain(
20852085
self.devCtrl, py_object(self), csr.NOCSRElements, len(csr.NOCSRElements), nodeId)
2086-
).raise_on_error()
2087-
return ctx.future.result()
2086+
)
2087+
res.raise_on_error()
2088+
return await asyncio.futures.wrap_future(ctx.future)
20882089

20892090

20902091
class BareChipDeviceController(ChipDeviceControllerBase):

0 commit comments

Comments
 (0)