Skip to content

Commit

Permalink
[Python] Convert IssueNOCChain to asyncio
Browse files Browse the repository at this point in the history
  • Loading branch information
agners committed Jun 18, 2024
1 parent fd882ea commit 316a9bb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/controller/python/chip/ChipDeviceCtrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2074,17 +2074,18 @@ def NOCChainCallback(self, nocChain):
self._issue_node_chain_context.future.set_result(nocChain)
return

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

with self._issue_node_chain_context as ctx:
self._ChipStack.Call(
res = await self._ChipStack.CallAsync(
lambda: self._dmLib.pychip_DeviceController_IssueNOCChain(
self.devCtrl, py_object(self), csr.NOCSRElements, len(csr.NOCSRElements), nodeId)
).raise_on_error()
return ctx.future.result()
)
res.raise_on_error()
return await asyncio.futures.wrap_future(ctx.future)


class BareChipDeviceController(ChipDeviceControllerBase):
Expand Down

0 comments on commit 316a9bb

Please sign in to comment.