Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
swan-amazon committed Aug 9, 2024
1 parent eae4abb commit 0d9dabc
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 6 deletions.
2 changes: 0 additions & 2 deletions examples/chip-tool/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ static_library("chip-tool-utils") {
"${chip_root}/examples/common/tracing:commandline",
"${chip_root}/src/app/icd/client:handler",
"${chip_root}/src/app/icd/client:manager",

# "${chip_root}/src/app/server",
"${chip_root}/src/app/tests/suites/commands/interaction_model",
"${chip_root}/src/controller/data_model",
"${chip_root}/src/credentials:file_attestation_trust_store",
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/pairing/PairingCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ CommissioningParameters PairingCommand::GetCommissioningParameters()
{
params.SetRequireTermsAndConditionsAcknowledgement(mRequireTCAcknowledgements.Value());
}
else
else
{
// Default requiring TCs to false, to preserve release 1.3 chip-tool behavior
params.SetRequireTermsAndConditionsAcknowledgement(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class GeneralCommissioningAttrAccess : public AttributeAccessInterface
}
case TCAcknowledgementsRequired::Id: {
auto provider = Server::GetInstance().GetEnhancedSetupFlowProvider();
auto getter = &EnhancedSetupFlowProvider::GetTermsAndConditionsRequiredAcknowledgements;
auto getter = &EnhancedSetupFlowProvider::IsTermsAndConditionsAcceptanceRequired;
return ReadIfSupported(provider, getter, aEncoder);
}
#endif
Expand Down
8 changes: 8 additions & 0 deletions src/app/server/DefaultEnhancedSetupFlowProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ CHIP_ERROR chip::app::DefaultEnhancedSetupFlowProvider::HasTermsAndConditionsReq
return CHIP_NO_ERROR;
}

CHIP_ERROR chip::app::DefaultEnhancedSetupFlowProvider::IsTermsAndConditionsAcceptanceRequired(bool & outValue) const
{
// Default implementation requires terms and conditions check only if not previously accepted. Other implementations may skip
// requiring a terms and conditions check on secondary commissioning, in the case that the required terms and conditions may
// have changed.
return HasTermsAndConditionsRequiredAcknowledgementsVersionBeenAccepted(outValue);
}

CHIP_ERROR chip::app::DefaultEnhancedSetupFlowProvider::GetTermsAndConditionsRequiredAcknowledgements(uint16_t & outValue) const
{
uint16_t requiredAcknowledgements;
Expand Down
2 changes: 2 additions & 0 deletions src/app/server/DefaultEnhancedSetupFlowProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class DefaultEnhancedSetupFlowProvider : public EnhancedSetupFlowProvider

CHIP_ERROR HasTermsAndConditionsRequiredAcknowledgementsVersionBeenAccepted(bool & outAccepted) const override;

CHIP_ERROR IsTermsAndConditionsAcceptanceRequired(bool & outValue) const override;

CHIP_ERROR GetTermsAndConditionsRequiredAcknowledgements(uint16_t & outValue) const override;

CHIP_ERROR GetTermsAndConditionsRequiredAcknowledgementsVersion(uint16_t & outValue) const override;
Expand Down
6 changes: 6 additions & 0 deletions src/app/server/EnhancedSetupFlowProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ class EnhancedSetupFlowProvider
*/
virtual CHIP_ERROR HasTermsAndConditionsRequiredAcknowledgementsVersionBeenAccepted(bool & outAccepted) const = 0;

/**
* @param[out] outValue true if terms and conditions acceptance is required before commissioning complete may succeed, false
* otherwise.
*/
virtual CHIP_ERROR IsTermsAndConditionsAcceptanceRequired(bool & outValue) const = 0;

/**
* @param[out] outValue The version of the required acknowledgements.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/app/server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,9 @@ void Server::ScheduleFactoryReset()
GetInstance().GetFabricTable().DeleteAllFabrics();
PlatformMgr().HandleServerShuttingDown();
ConfigurationMgr().InitiateFactoryReset();
#if CHIP_CONFIG_TC_REQUIRED
// Clear accepted terms and conditions
#endif
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/app/server/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
#if CHIP_CONFIG_TC_REQUIRED
#include <app/server/DefaultEnhancedSetupFlowProvider.h>
#include <app/server/DefaultTermsAndConditionsProvider.h>
#endif
#include <app/server/EnhancedSetupFlowProvider.h>
#include <app/server/TermsAndConditionsProvider.h>
#endif
#include <credentials/CertificateValidityPolicy.h>
#include <credentials/FabricTable.h>
#include <credentials/GroupDataProvider.h>
Expand Down Expand Up @@ -185,10 +185,12 @@ struct ServerInitParams
// Optional. Support for the ICD Check-In BackOff strategy. Must be initialized before being provided.
// If the ICD Check-In protocol use-case is supported and no strategy is provided, server will use the default strategy.
app::ICDCheckInBackOffStrategy * icdCheckInBackOffStrategy = nullptr;
#if CHIP_CONFIG_TC_REQUIRED
// Optional. Enhanced setup flow provider to support terms and conditions acceptance check.
app::EnhancedSetupFlowProvider * enhancedSetupFlowProvider = nullptr;
// Optional. Terms and conditions provider to support enhanced setup flow feature.
app::TermsAndConditionsProvider * termsAndConditionsProvider = nullptr;
#endif
};

/**
Expand Down
1 change: 0 additions & 1 deletion src/controller/CommissioningDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ class CommissioningParameters
// The country code to be used for the node, if set.
Optional<CharSpan> GetCountryCode() const { return mCountryCode; }


Optional<bool> GetRequireTermsAndConditionsAcknowledgement() const { return mRequireTermsAndConditionsAcknowledgement; }

Optional<TermsAndConditionsAcknowledgement> GetTermsAndConditionsAcknowledgement() const
Expand Down

0 comments on commit 0d9dabc

Please sign in to comment.