Skip to content

Commit

Permalink
Set CommissioningParameters on Default commissioner (#16204)
Browse files Browse the repository at this point in the history
Crossed the streams on two PRs that updated the function and the
auto commissioner and these ended up incorrect.
  • Loading branch information
cecille authored and pull[bot] committed May 24, 2022
1 parent 3f43af0 commit 7435652
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,12 @@ CHIP_ERROR DeviceCommissioner::GetDeviceBeingCommissioned(NodeId deviceId, Commi
CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, const char * setUpCode, const CommissioningParameters & params)
{
MATTER_TRACE_EVENT_SCOPE("PairDevice", "DeviceCommissioner");
ReturnErrorOnFailure(mAutoCommissioner.SetCommissioningParameters(params));
if (mDefaultCommissioner == nullptr)
{
ChipLogError(Controller, "No default commissioner is specified");
return CHIP_ERROR_INCORRECT_STATE;
}
ReturnErrorOnFailure(mDefaultCommissioner->SetCommissioningParameters(params));
return mSetUpCodePairer.PairDevice(remoteDeviceId, setUpCode, SetupCodePairerBehaviour::kCommission);
}

Expand Down Expand Up @@ -886,7 +891,12 @@ CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, Re

CHIP_ERROR DeviceCommissioner::Commission(NodeId remoteDeviceId, CommissioningParameters & params)
{
ReturnErrorOnFailure(mAutoCommissioner.SetCommissioningParameters(params));
if (mDefaultCommissioner == nullptr)
{
ChipLogError(Controller, "No default commissioner is specified");
return CHIP_ERROR_INCORRECT_STATE;
}
ReturnErrorOnFailure(mDefaultCommissioner->SetCommissioningParameters(params));
return Commission(remoteDeviceId);
}

Expand All @@ -911,6 +921,13 @@ CHIP_ERROR DeviceCommissioner::Commission(NodeId remoteDeviceId)
ChipLogError(Controller, "Commissioning already in progress - not restarting");
return CHIP_ERROR_INCORRECT_STATE;
}

if (mDefaultCommissioner == nullptr)
{
ChipLogError(Controller, "No default commissioner is specified");
return CHIP_ERROR_INCORRECT_STATE;
}

ChipLogProgress(Controller, "Commission called for node ID 0x" ChipLogFormatX64, ChipLogValueX64(remoteDeviceId));

mSystemState->SystemLayer()->StartTimer(chip::System::Clock::Milliseconds32(kSessionEstablishmentTimeout),
Expand Down

0 comments on commit 7435652

Please sign in to comment.