Skip to content

Commit

Permalink
[Python] Fix EstablishPASESession API compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
agners committed Jun 13, 2024
1 parent b551e51 commit a51c323
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/controller/python/chip/ChipDeviceCtrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,13 @@ def EstablishPASESessionBLE(self, setupPinCode: int, discriminator: int, nodeid:
lambda: self._dmLib.pychip_DeviceController_EstablishPASESessionBLE(
self.devCtrl, setupPinCode, discriminator, nodeid)
).raise_on_error()
return self._pase_establishment_complete_future.result()

# TODO: This is a bit funky, but what the API returned with the previous
# implementation. We should revisit this.
err = self._pase_establishment_complete_future.result()
if not err.is_success:
return err.to_exception()
return None
finally:
self._pase_establishment_complete_future = None

Expand All @@ -615,7 +621,13 @@ def EstablishPASESessionIP(self, ipaddr: str, setupPinCode: int, nodeid: int, po
lambda: self._dmLib.pychip_DeviceController_EstablishPASESessionIP(
self.devCtrl, ipaddr.encode("utf-8"), setupPinCode, nodeid, port)
).raise_on_error()
return self._pase_establishment_complete_future.result()

# TODO: This is a bit funky, but what the API returned with the previous
# implementation. We should revisit this.
err = self._pase_establishment_complete_future.result()
if not err.is_success:
return err.to_exception()
return None
finally:
self._pase_establishment_complete_future = None

Expand All @@ -629,7 +641,13 @@ def EstablishPASESession(self, setUpCode: str, nodeid: int):
lambda: self._dmLib.pychip_DeviceController_EstablishPASESession(
self.devCtrl, setUpCode.encode("utf-8"), nodeid)
).raise_on_error()
return self._pase_establishment_complete_future.result()

# TODO: This is a bit funky, but what the API returned with the previous
# implementation. We should revisit this.
err = self._pase_establishment_complete_future.result()
if not err.is_success:
return err.to_exception()
return None
finally:
self._pase_establishment_complete_future = None

Expand Down

0 comments on commit a51c323

Please sign in to comment.