Skip to content

Commit

Permalink
[controller] fix 30260 (#30864)
Browse files Browse the repository at this point in the history
  • Loading branch information
erjiaqing authored and pull[bot] committed Apr 9, 2024
1 parent 1f0d175 commit 2425636
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/controller/AutoCommissioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,10 +828,10 @@ CHIP_ERROR AutoCommissioner::CommissioningStepFinished(CHIP_ERROR err, Commissio
return NOCChainGenerated(report.Get<NocChain>().noc, report.Get<NocChain>().icac, report.Get<NocChain>().rcac,
report.Get<NocChain>().ipk, report.Get<NocChain>().adminSubject);
case CommissioningStage::kICDGetRegistrationInfo:
// Noting to od. The ICD registation info is handled elsewhere.
// Noting to do. The ICD registation info is handled elsewhere.
break;
case CommissioningStage::kICDRegistration:
// Noting to od. DevicePairingDelegate will handle this.
// Noting to do. DevicePairingDelegate will handle this.
break;
case CommissioningStage::kICDSendStayActive:
// Nothing to do.
Expand Down
22 changes: 14 additions & 8 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1177,19 +1177,25 @@ void DeviceCommissioner::OnICDManagementRegisterClientResponse(
void * context, const app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType & data)
{
DeviceCommissioner * commissioner = static_cast<DeviceCommissioner *>(context);
VerifyOrReturn(commissioner != nullptr, ChipLogProgress(Controller, "Command response callback with null context. Ignoring"));

CommissioningDelegate::CommissioningReport report;
auto pairingDelegate = commissioner->GetPairingDelegate();
auto deviceBeingCommissioned = commissioner->mDeviceBeingCommissioned;
if (pairingDelegate != nullptr && deviceBeingCommissioned != nullptr)
if (commissioner->mCommissioningStage != CommissioningStage::kICDRegistration)
{
pairingDelegate->OnICDRegistrationComplete(deviceBeingCommissioned->GetDeviceId(), data.ICDCounter);
commissioner->CommissioningStageComplete(CHIP_NO_ERROR, report);
return;
}
else

if (commissioner->mDeviceBeingCommissioned == nullptr)
{
commissioner->CommissioningStageComplete(CHIP_ERROR_INCORRECT_STATE, report);
return;
}

if (commissioner->mPairingDelegate != nullptr)
{
commissioner->mPairingDelegate->OnICDRegistrationComplete(commissioner->mDeviceBeingCommissioned->GetDeviceId(),
data.ICDCounter);
}
CommissioningDelegate::CommissioningReport report;
commissioner->CommissioningStageComplete(CHIP_NO_ERROR, report);
}

bool DeviceCommissioner::ExtendArmFailSafe(DeviceProxy * proxy, CommissioningStage step, uint16_t armFailSafeTimeout,
Expand Down

0 comments on commit 2425636

Please sign in to comment.