|
32 | 32 | import os
|
33 | 33 | import sys
|
34 | 34 | import time
|
35 |
| -from ctypes import (CFUNCTYPE, POINTER, Structure, c_bool, c_char_p, c_int64, c_uint8, c_uint16, c_uint32, c_ulong, c_void_p, |
36 |
| - py_object, pythonapi) |
| 35 | +from ctypes import CFUNCTYPE, Structure, c_bool, c_char_p, c_int64, c_uint8, c_uint16, c_uint32, c_void_p, py_object, pythonapi |
37 | 36 | from threading import Condition, Event, Lock
|
38 | 37 |
|
39 | 38 | import chip.native
|
@@ -194,9 +193,6 @@ def __call__(self):
|
194 | 193 | pythonapi.Py_DecRef(py_object(self))
|
195 | 194 |
|
196 | 195 |
|
197 |
| -_CompleteFunct = CFUNCTYPE(None, c_void_p, c_void_p) |
198 |
| -_ErrorFunct = CFUNCTYPE(None, c_void_p, c_void_p, |
199 |
| - c_ulong, POINTER(DeviceStatusStruct)) |
200 | 196 | _LogMessageFunct = CFUNCTYPE(
|
201 | 197 | None, c_int64, c_int64, c_char_p, c_uint8, c_char_p)
|
202 | 198 | _ChipThreadTaskRunnerFunct = CFUNCTYPE(None, py_object)
|
@@ -272,21 +268,11 @@ def __init__(self, persistentStoragePath: str, installDefaultLogHandler=True,
|
272 | 268 | self.logger.addHandler(logHandler)
|
273 | 269 | self.logger.setLevel(logging.DEBUG)
|
274 | 270 |
|
275 |
| - def HandleComplete(appState, reqState): |
276 |
| - self.callbackRes = True |
277 |
| - self.completeEvent.set() |
278 |
| - |
279 |
| - def HandleError(appState, reqState, err, devStatusPtr): |
280 |
| - self.callbackRes = self.ErrorToException(err, devStatusPtr) |
281 |
| - self.completeEvent.set() |
282 |
| - |
283 | 271 | @_ChipThreadTaskRunnerFunct
|
284 | 272 | def HandleChipThreadRun(callback):
|
285 | 273 | callback()
|
286 | 274 |
|
287 | 275 | self.cbHandleChipThreadRun = HandleChipThreadRun
|
288 |
| - self.cbHandleComplete = _CompleteFunct(HandleComplete) |
289 |
| - self.cbHandleError = _ErrorFunct(HandleError) |
290 | 276 | # set by other modules(BLE) that require service by thread while thread blocks.
|
291 | 277 | self.blockingCB = None
|
292 | 278 |
|
@@ -389,15 +375,9 @@ def Call(self, callFunct, timeoutMs: int = None):
|
389 | 375 | This function is a wrapper of PostTaskOnChipThread, which includes some handling of application specific logics.
|
390 | 376 | Calling this function on CHIP on CHIP mainloop thread will cause deadlock.
|
391 | 377 | '''
|
392 |
| - # throw error if op in progress |
393 |
| - self.callbackRes = None |
394 |
| - self.completeEvent.clear() |
395 | 378 | # TODO: Lock probably no longer necessary, see https://github.com/project-chip/connectedhomeip/issues/33321.
|
396 | 379 | with self.networkLock:
|
397 | 380 | res = self.PostTaskOnChipThread(callFunct).Wait(timeoutMs)
|
398 |
| - self.completeEvent.set() |
399 |
| - if res == 0 and self.callbackRes is not None: |
400 |
| - return self.callbackRes |
401 | 381 | return res
|
402 | 382 |
|
403 | 383 | async def CallAsync(self, callFunct, timeoutMs: int = None):
|
|
0 commit comments