Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Remove Python Bluetooth and ChipStack event loop integration #33775

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/controller/python/chip/ChipBluezMgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,6 @@ def __init__(self, devMgr, logger=None):
self.rx = None
self.setInputHook(self.readlineCB)
self.devMgr = devMgr
self.devMgr.SetBlockingCB(self.devMgrCB)

def __del__(self):
self.disconnect()
Expand Down
2 changes: 0 additions & 2 deletions src/controller/python/chip/ChipCoreBluetoothMgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ def __init__(self, devCtrl, logger=None):
def __del__(self):
self.disconnect()
self.setInputHook(self.orig_input_hook)
self.devCtrl.SetBlockingCB(None)
self.devCtrl.SetBleEventCB(None)

def devMgrCB(self):
"""A callback used by ChipDeviceCtrl.py to drive the OSX runloop while the
Expand Down
5 changes: 0 additions & 5 deletions src/controller/python/chip/ChipDeviceCtrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1591,11 +1591,6 @@ async def ReadEvent(self, nodeid: int, events: typing.List[typing.Union[
else:
return res.events

def SetBlockingCB(self, blockingCB):
self.CheckIsActive()

self._ChipStack.blockingCB = blockingCB

def SetIpk(self, ipk: bytes):
self._ChipStack.Call(
lambda: self._dmLib.pychip_DeviceController_SetIpk(self.devCtrl, ipk, len(ipk))
Expand Down
8 changes: 1 addition & 7 deletions src/controller/python/chip/ChipStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ def HandleChipThreadRun(callback):
callback()

self.cbHandleChipThreadRun = HandleChipThreadRun
# set by other modules(BLE) that require service by thread while thread blocks.
self.blockingCB = None

#
# Storage has to be initialized BEFORE initializing the stack, since the latter
Expand Down Expand Up @@ -255,11 +253,7 @@ def CallAsyncWithCompleteCallback(self, callFunct):
if not res.is_success:
self.completeEvent.set()
raise res.to_exception()
while not self.completeEvent.isSet():
if self.blockingCB:
arkq marked this conversation as resolved.
Show resolved Hide resolved
self.blockingCB()

self.completeEvent.wait(0.05)
self.completeEvent.wait()
if isinstance(self.callbackRes, ChipStackException):
raise self.callbackRes
return self.callbackRes
Expand Down
Loading