Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[controller] fix issues in #30260 #30864

Merged
merged 2 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion if this is touched later
VerifyOrReturn(commissioner->mCommissioningStage == CommissioningStage::kICDRegistration);

{
pairingDelegate->OnICDRegistrationComplete(deviceBeingCommissioned->GetDeviceId(), data.ICDCounter);
commissioner->CommissioningStageComplete(CHIP_NO_ERROR, report);
return;
}
else

if (commissioner->mDeviceBeingCommissioned == nullptr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion if this is touched later
VerifyOrReturn(commissioner->mDeviceBeingCommissioned != nullptr);

{
commissioner->CommissioningStageComplete(CHIP_ERROR_INCORRECT_STATE, report);
return;
}

if (commissioner->mPairingDelegate != nullptr)
yunhanw-google marked this conversation as resolved.
Show resolved Hide resolved
{
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
Loading