From 1686194c3169e3843c6cdf8e4131efb05faf4461 Mon Sep 17 00:00:00 2001 From: Markus Becker Date: Tue, 26 Apr 2022 09:36:06 +0200 Subject: [PATCH] Use GetDeviceBeingCommissioned() instead of FindCommissioneeDevice() Revert making private API public. Signed-off-by: Markus Becker --- examples/chip-tool/commands/clusters/ModelCommand.cpp | 8 ++++++-- src/controller/CHIPDeviceController.h | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/chip-tool/commands/clusters/ModelCommand.cpp b/examples/chip-tool/commands/clusters/ModelCommand.cpp index 768731260fcb56..fa24e0a526b3a4 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.cpp +++ b/examples/chip-tool/commands/clusters/ModelCommand.cpp @@ -38,8 +38,12 @@ CHIP_ERROR ModelCommand::RunCommand() if (mViaPase.ValueOr(0) == 1) { ChipLogProgress(chipTool, "Sending command via PASE to node 0x%" PRIx64, mNodeId); - CommissioneeDeviceProxy * device = CurrentCommissioner().FindCommissioneeDevice(mNodeId); - return this->SendCommand(device, this->mEndPointId); + CommissioneeDeviceProxy * commissioneeDevice = nullptr; + CHIP_ERROR err = CurrentCommissioner().GetDeviceBeingCommissioned(mNodeId, &commissioneeDevice); + VerifyOrReturnError(CHIP_NO_ERROR == err, err); + VerifyOrReturnError(commissioneeDevice != nullptr, CHIP_ERROR_NOT_CONNECTED); + + return this->SendCommand(commissioneeDevice, this->mEndPointId); } else { diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index 1cff6bd7237fb4..c31f7fdfee8d5e 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -730,7 +730,6 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, void HandleAttestationResult(CHIP_ERROR err); -public: CommissioneeDeviceProxy * FindCommissioneeDevice(const SessionHandle & session); CommissioneeDeviceProxy * FindCommissioneeDevice(NodeId id); CommissioneeDeviceProxy * FindCommissioneeDevice(const Transport::PeerAddress & peerAddress);