Skip to content

Commit

Permalink
Call OnDone on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca committed Oct 16, 2024
1 parent 3168f76 commit 3b9ab97
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions examples/fabric-admin/device_manager/CommissionerControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,17 @@ void CommissionerControl::OnDeviceConnectedFn(void * context, Messaging::Exchang
OperationalDeviceProxy device(&exchangeMgr, sessionHandle);

CHIP_ERROR err = self->SendCommandForType(self->mCommandType, &device);
LogErrorOnFailure(err);
if (err != CHIP_NO_ERROR)
{
ChipLogError(NotSpecified, "Failed to send CommissionerControl command.");
self->OnDone(nullptr);
}
}

void CommissionerControl::OnDeviceConnectionFailureFn(void * context, const ScopedNodeId & peerId, CHIP_ERROR err)
{
LogErrorOnFailure(err);

CommissionerControl * self = reinterpret_cast<CommissionerControl *>(context);
VerifyOrReturn(self != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectionFailureFn: context is null"));
VerifyOrReturn(self != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null"));
self->OnDone(nullptr);
}

0 comments on commit 3b9ab97

Please sign in to comment.