diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index 0a58c15d271504..3c0191072923b8 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -88,7 +88,7 @@ using namespace chip::DeviceLayer; extern "C" { typedef void (*ConstructBytesArrayFunct)(const uint8_t * dataBuf, uint32_t dataLen); typedef void (*LogMessageFunct)(uint64_t time, uint64_t timeUS, const char * moduleName, uint8_t category, const char * msg); -typedef void (*DeviceAvailableFunc)(DeviceProxy * device, PyChipError err); +typedef void (*DeviceAvailableFunc)(chip::Controller::Python::PyObject * context, DeviceProxy * device, PyChipError err); typedef void (*ChipThreadTaskRunnerFunct)(intptr_t context); typedef void (*DeviceUnpairingCompleteFunct)(uint64_t nodeId, PyChipError error); } @@ -745,14 +745,14 @@ struct GetDeviceCallbacks { auto * self = static_cast(context); auto * operationalDeviceProxy = new OperationalDeviceProxy(&exchangeMgr, sessionHandle); - self->mCallback(context, operationalDeviceProxy, ToPyChipError(CHIP_NO_ERROR)); + self->mCallback(self->mContext, operationalDeviceProxy, ToPyChipError(CHIP_NO_ERROR)); delete self; } static void OnConnectionFailureFn(void * context, const ScopedNodeId & peerId, CHIP_ERROR error) { auto * self = static_cast(context); - self->mCallback(context, nullptr, ToPyChipError(error)); + self->mCallback(self->mContext, nullptr, ToPyChipError(error)); delete self; }