From 1177063cb6da215a3f5ed09b89ab283c5424517b Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Tue, 28 Sep 2021 10:10:18 -0400 Subject: [PATCH] Removed duplicate code in controller execution that sends CommissioningComplete (#10000) * Removed controller side functions that artificially sends CommissioningComplete message to device * Restyle changes --- src/controller/CHIPDeviceController.cpp | 14 -------------- src/controller/CHIPDeviceController.h | 11 ----------- .../python/ChipDeviceController-ScriptBinding.cpp | 8 -------- src/controller/python/chip-device-ctrl.py | 1 - src/controller/python/chip/ChipDeviceCtrl.py | 6 ------ 5 files changed, 40 deletions(-) diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index f7d2e908445425..1c8e3e2b92aa8e 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -1119,20 +1119,6 @@ CHIP_ERROR DeviceCommissioner::OpenCommissioningWindow(NodeId deviceId, uint16_t return CHIP_NO_ERROR; } -CHIP_ERROR DeviceCommissioner::CommissioningComplete(NodeId remoteDeviceId) -{ - if (!mIsIPRendezvous) - { - Device * device = nullptr; - ReturnErrorOnFailure(GetDevice(remoteDeviceId, &device)); - ChipLogProgress(Controller, "Calling commissioning complete for device ID %" PRIu64, remoteDeviceId); - GeneralCommissioningCluster genCom; - genCom.Associate(device, 0); - return genCom.CommissioningComplete(NULL, NULL); - } - return CHIP_NO_ERROR; -} - void DeviceCommissioner::FreeRendezvousSession() { PersistNextKeyId(); diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index 06981afbb2fe1e..232e057a56bb2a 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -465,17 +465,6 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, CHIP_ERROR OpenCommissioningWindow(NodeId deviceId, uint16_t timeout, uint16_t iteration, uint16_t discriminator, uint8_t option); - /** - * This function call causes the DeviceCommissioner to send a - * CommissioningComplete command to the given node. At least when - * mIsIPRendezvous is false, which seems to be an incredibly broken - * workaround for - * . Chances - * are, this function and its callsites should just be removed when that - * issue is fixed. - */ - CHIP_ERROR CommissioningComplete(NodeId remoteDeviceId); - //////////// SessionEstablishmentDelegate Implementation /////////////// void OnSessionEstablishmentError(CHIP_ERROR error) override; void OnSessionEstablished() override; diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index 182a32121cfa84..69053b810e73cb 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -102,8 +102,6 @@ ChipError::StorageType pychip_DeviceController_GetAddressAndPort(chip::Controlle uint16_t * outPort); ChipError::StorageType pychip_DeviceController_GetCompressedFabricId(chip::Controller::DeviceCommissioner * devCtrl, uint64_t * outFabricId); -ChipError::StorageType pychip_DeviceController_CommissioningComplete(chip::Controller::DeviceCommissioner * devCtrl, - chip::NodeId nodeId); ChipError::StorageType pychip_DeviceController_GetFabricId(chip::Controller::DeviceCommissioner * devCtrl, uint64_t * outFabricId); // Rendezvous @@ -261,12 +259,6 @@ ChipError::StorageType pychip_DeviceController_GetCompressedFabricId(chip::Contr return CHIP_NO_ERROR.AsInteger(); } -ChipError::StorageType pychip_DeviceController_CommissioningComplete(chip::Controller::DeviceCommissioner * devCtrl, - chip::NodeId nodeId) -{ - return devCtrl->CommissioningComplete(nodeId).AsInteger(); -} - ChipError::StorageType pychip_DeviceController_GetFabricId(chip::Controller::DeviceCommissioner * devCtrl, uint64_t * outFabricId) { *outFabricId = devCtrl->GetFabricId(); diff --git a/src/controller/python/chip-device-ctrl.py b/src/controller/python/chip-device-ctrl.py index 293df4ffe213fc..2b395019dd4008 100755 --- a/src/controller/python/chip-device-ctrl.py +++ b/src/controller/python/chip-device-ctrl.py @@ -585,7 +585,6 @@ def do_resolve(self, line): address = "{}:{}".format( *address) if address else "unknown" print("Current address: " + address) - self.devCtrl.CommissioningComplete(int(args[1])) else: self.do_help("resolve") except exceptions.ChipStackException as ex: diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index b0fbb647dbc837..5ebeaea2712508 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -211,12 +211,6 @@ def GetAddressAndPort(self, nodeid): return (address.value.decode(), port.value) if error == 0 else None - def CommissioningComplete(self, nodeid): - return self._ChipStack.Call( - lambda: self._dmLib.pychip_DeviceController_CommissioningComplete( - self.devCtrl, nodeid) - ) - def DiscoverCommissionableNodesLongDiscriminator(self, long_discriminator): return self._ChipStack.Call( lambda: self._dmLib.pychip_DeviceController_DiscoverCommissionableNodesLongDiscriminator(