Skip to content

Commit

Permalink
Set root endpoint id by default in commissioning window params
Browse files Browse the repository at this point in the history
Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
samadDotDev and bzbarsky-apple committed Jul 25, 2024
1 parent d823c8a commit 477bf13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
10 changes: 2 additions & 8 deletions src/controller/CommissioningWindowOpener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ CHIP_ERROR CommissioningWindowOpener::OpenCommissioningWindow(const Commissionin
mCommissioningWindowVerifierCallback = nullptr;
mNodeId = params.GetNodeId();
mCommissioningWindowTimeout = params.GetTimeout();
if (params.HasEndpointId())
{
mTargetEndpointId = params.GetEndpointId();
}
mTargetEndpointId = params.GetEndpointId();

if (params.GetReadVIDPIDAttributes())
{
Expand Down Expand Up @@ -166,10 +163,7 @@ CHIP_ERROR CommissioningWindowOpener::OpenCommissioningWindow(const Commissionin
mPBKDFIterations = params.GetIteration();
mCommissioningWindowOption = CommissioningWindowOption::kTokenWithProvidedPIN;
mDiscriminator.SetLongValue(params.GetDiscriminator());
if (params.HasEndpointId())
{
mTargetEndpointId = params.GetEndpointId();
}
mTargetEndpointId = params.GetEndpointId();

mNextStep = Step::kOpenCommissioningWindow;

Expand Down
7 changes: 3 additions & 4 deletions src/controller/CommissioningWindowParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@ class CommissioningWindowCommonParams
return static_cast<Derived &>(*this);
}

bool HasEndpointId() const { return mEndpointId.HasValue(); }
EndpointId GetEndpointId() const { return mEndpointId.Value(); }
EndpointId GetEndpointId() const { return mEndpointId; }
Derived & SetEndpointId(EndpointId endpointId)
{
mEndpointId = MakeOptional(endpointId);
mEndpointId = endpointId;
return static_cast<Derived &>(*this);
}

Expand Down Expand Up @@ -91,7 +90,7 @@ class CommissioningWindowCommonParams

private:
NodeId mNodeId = kUndefinedNodeId;
Optional<EndpointId> mEndpointId = NullOptional;
EndpointId mEndpointId = kRootEndpointId; // Default endpoint for Administrator Commissioning Cluster
System::Clock::Seconds16 mTimeout = System::Clock::Seconds16(300); // Defaulting
uint32_t mIteration = 1000; // Defaulting
Optional<uint16_t> mDiscriminator = NullOptional; // Using optional type to avoid picking a sentinnel in valid range
Expand Down

0 comments on commit 477bf13

Please sign in to comment.