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

[Fabrix-Sync] Fix ICD device commissioning process #36821

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 6 additions & 2 deletions examples/fabric-sync/admin/PairingManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ void PairingManager::OnPairingDeleted(CHIP_ERROR err)

void PairingManager::OnCommissioningComplete(NodeId nodeId, CHIP_ERROR err)
{
// The pairing delegate OnCommissioningComplete might clear our internal state,
// so we need to save the value of mDeviceIsICD before calling it.
auto deviceIsICD = mDeviceIsICD;

if (mPairingDelegate)
{
mPairingDelegate->OnCommissioningComplete(nodeId, err);
Expand All @@ -295,12 +299,12 @@ void PairingManager::OnCommissioningComplete(NodeId nodeId, CHIP_ERROR err)

// mCommissioner has a lifetime that is the entire life of the application itself
// so it is safe to provide to StartDeviceSynchronization.
DeviceSynchronizer::Instance().StartDeviceSynchronization(mCommissioner, nodeId, mDeviceIsICD);
DeviceSynchronizer::Instance().StartDeviceSynchronization(mCommissioner, nodeId, deviceIsICD);
}
else
{
// When ICD device commissioning fails, the ICDClientInfo stored in OnICDRegistrationComplete needs to be removed.
if (mDeviceIsICD)
if (deviceIsICD)
{
CHIP_ERROR deleteEntryError = FabricAdmin::Instance().GetDefaultICDClientStorage().DeleteEntry(
ScopedNodeId(nodeId, mCommissioner->GetFabricIndex()));
Expand Down
Loading