@@ -588,15 +588,16 @@ async def ConnectBLE(self, discriminator: int, setupPinCode: int, nodeid: int, i
588
588
589
589
return await asyncio .futures .wrap_future (ctx .future )
590
590
591
- def UnpairDevice (self , nodeid : int ) -> None :
591
+ async def UnpairDevice (self , nodeid : int ) -> None :
592
592
self .CheckIsActive ()
593
593
594
594
with self ._unpair_device_context as ctx :
595
- self ._ChipStack .Call (
595
+ res = await self ._ChipStack .CallAsync (
596
596
lambda : self ._dmLib .pychip_DeviceController_UnpairDevice (
597
597
self .devCtrl , nodeid , self .cbHandleDeviceUnpairCompleteFunct )
598
- ).raise_on_error ()
599
- ctx .future .result ()
598
+ )
599
+ res .raise_on_error ()
600
+ return await asyncio .futures .wrap_future (ctx .future )
600
601
601
602
def CloseBLEConnection (self ):
602
603
self .CheckIsActive ()
@@ -776,8 +777,8 @@ class CommissioningWindowPasscode(enum.IntEnum):
776
777
kOriginalSetupCode = 0 ,
777
778
kTokenWithRandomPin = 1 ,
778
779
779
- def OpenCommissioningWindow (self , nodeid : int , timeout : int , iteration : int ,
780
- discriminator : int , option : CommissioningWindowPasscode ) -> CommissioningParameters :
780
+ async def OpenCommissioningWindow (self , nodeid : int , timeout : int , iteration : int ,
781
+ discriminator : int , option : CommissioningWindowPasscode ) -> CommissioningParameters :
781
782
''' Opens a commissioning window on the device with the given nodeid.
782
783
nodeid: Node id of the device
783
784
timeout: Command timeout
@@ -794,12 +795,13 @@ def OpenCommissioningWindow(self, nodeid: int, timeout: int, iteration: int,
794
795
self .CheckIsActive ()
795
796
796
797
with self ._open_window_context as ctx :
797
- self ._ChipStack .Call (
798
+ res = await self ._ChipStack .CallAsync (
798
799
lambda : self ._dmLib .pychip_DeviceController_OpenCommissioningWindow (
799
800
self .devCtrl , self .pairingDelegate , nodeid , timeout , iteration , discriminator , option )
800
- ).raise_on_error ()
801
+ )
802
+ res .raise_on_error ()
801
803
802
- return ctx . future . result ( )
804
+ return await asyncio . futures . wrap_future ( ctx . future )
803
805
804
806
def GetCompressedFabricId (self ):
805
807
self .CheckIsActive ()
0 commit comments