Skip to content

Commit

Permalink
Add failsafe timer time as a parameter. (#13674)
Browse files Browse the repository at this point in the history
  • Loading branch information
cecille authored Jan 19, 2022
1 parent 41d3a6c commit 8eb0c21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1714,9 +1714,7 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio
GeneralCommissioningCluster genCom;
// TODO: should get the endpoint information from the descriptor cluster.
genCom.Associate(proxy, 0);
// TODO(cecille): Make this a parameter
uint16_t commissioningExpirySeconds = 60;
genCom.ArmFailSafe(mSuccess.Cancel(), mFailure.Cancel(), commissioningExpirySeconds, breadcrumb, kCommandTimeoutMs);
genCom.ArmFailSafe(mSuccess.Cancel(), mFailure.Cancel(), params.GetFailsafeTimerSeconds(), breadcrumb, kCommandTimeoutMs);
}
break;
case CommissioningStage::kConfigRegulatory: {
Expand Down
8 changes: 8 additions & 0 deletions src/controller/CommissioningDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,18 @@ class CommissioningParameters
bool HasAttestationNonce() const { return mAttestationNonce.HasValue(); }
bool HasWiFiCredentials() const { return mWiFiCreds.HasValue(); }
bool HasThreadOperationalDataset() const { return mThreadOperationalDataset.HasValue(); }
uint16_t GetFailsafeTimerSeconds() const { return mFailsafeTimerSeconds; }
const Optional<ByteSpan> GetCSRNonce() const { return mCSRNonce; }
const Optional<ByteSpan> GetAttestationNonce() const { return mAttestationNonce; }
const Optional<WiFiCredentials> GetWiFiCredentials() const { return mWiFiCreds; }
const Optional<ByteSpan> GetThreadOperationalDataset() const { return mThreadOperationalDataset; }

CommissioningParameters & SetFailsafeTimerSeconds(uint16_t seconds)
{
mFailsafeTimerSeconds = seconds;
return *this;
}

// The lifetime of the buffer csrNonce is pointing to, should exceed the lifetime of CommissioningParameters object.
CommissioningParameters & SetCSRNonce(ByteSpan csrNonce)
{
Expand Down Expand Up @@ -95,6 +102,7 @@ class CommissioningParameters
CHIP_ERROR GetCompletionStatus() { return completionStatus; }

private:
uint16_t mFailsafeTimerSeconds = 60;
Optional<ByteSpan> mCSRNonce; ///< CSR Nonce passed by the commissioner
Optional<ByteSpan> mAttestationNonce; ///< Attestation Nonce passed by the commissioner
Optional<WiFiCredentials> mWiFiCreds;
Expand Down

0 comments on commit 8eb0c21

Please sign in to comment.