Skip to content

Commit

Permalink
Add initial feature logic for Terms and Conditions (TC) acknowledgements
Browse files Browse the repository at this point in the history
This commit introduces the initial logic for handling Terms and
Conditions (TC) acknowledgements in the General Commissioning cluster.
The logic includes support for setting and checking TC acknowledgements
and versions during the commissioning process.

Changes include:
- Handling TC acknowledgements and TC acknowledgement version in the
  pairing command.
- Logic to read TC attributes and check TC acceptance in the General
  Commissioning server.
- Introduction of classes to manage TC acceptance logic.
- Initialization and use of TC providers in the server setup.
- Addition of a new commissioning stage for TC acknowledgements in the
  commissioning flow.

The feature logic is currently disabled and will be enabled in an
example in a subsequent commit.
  • Loading branch information
swan-amazon committed Oct 30, 2024
1 parent b7aa537 commit 68a728a
Show file tree
Hide file tree
Showing 15 changed files with 1,480 additions and 54 deletions.
9 changes: 6 additions & 3 deletions src/app/FailSafeContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,12 @@ void FailSafeContext::ScheduleFailSafeCleanup(FabricIndex fabricIndex, bool addN
SetFailSafeArmed(false);

ChipDeviceEvent event{ .Type = DeviceEventType::kFailSafeTimerExpired,
.FailSafeTimerExpired = { .fabricIndex = fabricIndex,
.addNocCommandHasBeenInvoked = addNocCommandInvoked,
.updateNocCommandHasBeenInvoked = updateNocCommandInvoked } };
.FailSafeTimerExpired = {
.fabricIndex = fabricIndex,
.addNocCommandHasBeenInvoked = addNocCommandInvoked,
.updateNocCommandHasBeenInvoked = updateNocCommandInvoked,
.updateTermsAndConditionsHasBeenInvoked = mUpdateTermsAndConditionsHasBeenInvoked,
} };
CHIP_ERROR status = PlatformMgr().PostEvent(&event);

if (status != CHIP_NO_ERROR)
Expand Down
18 changes: 11 additions & 7 deletions src/app/FailSafeContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class FailSafeContext
void SetUpdateNocCommandInvoked() { mUpdateNocCommandHasBeenInvoked = true; }
void SetAddTrustedRootCertInvoked() { mAddTrustedRootCertHasBeenInvoked = true; }
void SetCsrRequestForUpdateNoc(bool isForUpdateNoc) { mIsCsrRequestForUpdateNoc = isForUpdateNoc; }
void SetUpdateTermsAndConditionsHasBeenInvoked() { mUpdateTermsAndConditionsHasBeenInvoked = true; }

/**
* @brief
Expand Down Expand Up @@ -91,6 +92,7 @@ class FailSafeContext
bool UpdateNocCommandHasBeenInvoked() const { return mUpdateNocCommandHasBeenInvoked; }
bool AddTrustedRootCertHasBeenInvoked() const { return mAddTrustedRootCertHasBeenInvoked; }
bool IsCsrRequestForUpdateNoc() const { return mIsCsrRequestForUpdateNoc; }
bool UpdateTermsAndConditionsHasBeenInvoked() { return mUpdateTermsAndConditionsHasBeenInvoked; }

FabricIndex GetFabricIndex() const
{
Expand All @@ -109,8 +111,9 @@ class FailSafeContext
bool mUpdateNocCommandHasBeenInvoked = false;
bool mAddTrustedRootCertHasBeenInvoked = false;
// The fact of whether a CSR occurred at all is stored elsewhere.
bool mIsCsrRequestForUpdateNoc = false;
FabricIndex mFabricIndex = kUndefinedFabricIndex;
bool mIsCsrRequestForUpdateNoc = false;
FabricIndex mFabricIndex = kUndefinedFabricIndex;
bool mUpdateTermsAndConditionsHasBeenInvoked = false;

/**
* @brief
Expand Down Expand Up @@ -140,11 +143,12 @@ class FailSafeContext
{
SetFailSafeArmed(false);

mAddNocCommandHasBeenInvoked = false;
mUpdateNocCommandHasBeenInvoked = false;
mAddTrustedRootCertHasBeenInvoked = false;
mFailSafeBusy = false;
mIsCsrRequestForUpdateNoc = false;
mAddNocCommandHasBeenInvoked = false;
mUpdateNocCommandHasBeenInvoked = false;
mAddTrustedRootCertHasBeenInvoked = false;
mFailSafeBusy = false;
mIsCsrRequestForUpdateNoc = false;
mUpdateTermsAndConditionsHasBeenInvoked = false;
}

void FailSafeTimerExpired();
Expand Down
3 changes: 2 additions & 1 deletion src/app/chip_data_model.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ function(chip_configure_data_model APP_TARGET)
# CMAKE data model auto-includes the server side implementation
target_sources(${APP_TARGET} ${SCOPE}
${CHIP_APP_BASE_DIR}/server/AclStorage.cpp
${CHIP_APP_BASE_DIR}/server/DefaultAclStorage.cpp
${CHIP_APP_BASE_DIR}/server/CommissioningWindowManager.cpp
${CHIP_APP_BASE_DIR}/server/DefaultAclStorage.cpp
${CHIP_APP_BASE_DIR}/server/DefaultTermsAndConditionsProvider.cpp
${CHIP_APP_BASE_DIR}/server/Dnssd.cpp
${CHIP_APP_BASE_DIR}/server/EchoHandler.cpp
${CHIP_APP_BASE_DIR}/server/OnboardingCodesUtil.cpp
Expand Down
Loading

0 comments on commit 68a728a

Please sign in to comment.