From 6118f53deb67c9fb6370dda87ae20fe87e248097 Mon Sep 17 00:00:00 2001 From: James Swan <122404367+swan-amazon@users.noreply.github.com> Date: Fri, 6 Dec 2024 21:14:55 +0000 Subject: [PATCH] --- .../general-commissioning-server.cpp | 107 +++++------------- .../DefaultTermsAndConditionsProvider.cpp | 99 ++++++---------- .../DefaultTermsAndConditionsProvider.h | 6 +- src/app/server/TermsAndConditionsProvider.h | 16 +-- src/lib/core/CHIPConfig.h | 11 -- 5 files changed, 72 insertions(+), 167 deletions(-) diff --git a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp index 619840acdbda85..7a123e47292861 100644 --- a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp +++ b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp @@ -49,6 +49,7 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::GeneralCommissioning; using namespace chip::app::Clusters::GeneralCommissioning::Attributes; using namespace chip::DeviceLayer; +using chip::app::Clusters::GeneralCommissioning::CommissioningErrorEnum; using Transport::SecureSession; using Transport::Session; @@ -107,16 +108,8 @@ CHIP_ERROR GeneralCommissioningAttrAccess::Read(const ConcreteReadAttributePath TermsAndConditionsProvider * const termsAndConditionsProvider = TermsAndConditionsManager::GetInstance(); Optional outTermsAndConditions; - if (nullptr == termsAndConditionsProvider) - { - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; - } - - CHIP_ERROR err = termsAndConditionsProvider->GetAcceptance(outTermsAndConditions); - if (CHIP_NO_ERROR != err) - { - return CHIP_ERROR_INTERNAL; - } + VerifyOrReturnError(nullptr != termsAndConditionsProvider, CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE); + ReturnErrorOnFailure(termsAndConditionsProvider->GetAcceptance(outTermsAndConditions)); return aEncoder.Encode(outTermsAndConditions.ValueOr(TermsAndConditions(0, 0)).GetVersion()); } @@ -124,16 +117,8 @@ CHIP_ERROR GeneralCommissioningAttrAccess::Read(const ConcreteReadAttributePath TermsAndConditionsProvider * const termsAndConditionsProvider = TermsAndConditionsManager::GetInstance(); Optional outTermsAndConditions; - if (nullptr == termsAndConditionsProvider) - { - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; - } - - CHIP_ERROR err = termsAndConditionsProvider->GetRequirements(outTermsAndConditions); - if (CHIP_NO_ERROR != err) - { - return CHIP_ERROR_INTERNAL; - } + VerifyOrReturnError(nullptr != termsAndConditionsProvider, CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE); + ReturnErrorOnFailure(termsAndConditionsProvider->GetRequirements(outTermsAndConditions)); return aEncoder.Encode(outTermsAndConditions.ValueOr(TermsAndConditions(0, 0)).GetVersion()); } @@ -141,16 +126,8 @@ CHIP_ERROR GeneralCommissioningAttrAccess::Read(const ConcreteReadAttributePath TermsAndConditionsProvider * const termsAndConditionsProvider = TermsAndConditionsManager::GetInstance(); Optional outTermsAndConditions; - if (nullptr == termsAndConditionsProvider) - { - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; - } - - CHIP_ERROR err = termsAndConditionsProvider->GetAcceptance(outTermsAndConditions); - if (CHIP_NO_ERROR != err) - { - return CHIP_ERROR_INTERNAL; - } + VerifyOrReturnError(nullptr != termsAndConditionsProvider, CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE); + ReturnErrorOnFailure(termsAndConditionsProvider->GetAcceptance(outTermsAndConditions)); return aEncoder.Encode(outTermsAndConditions.ValueOr(TermsAndConditions(0, 0)).GetValue()); } @@ -159,22 +136,10 @@ CHIP_ERROR GeneralCommissioningAttrAccess::Read(const ConcreteReadAttributePath Optional outTermsAndConditions; TermsAndConditionsState termsAndConditionsState; - if (nullptr == termsAndConditionsProvider) - { - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; - } - - CHIP_ERROR err = termsAndConditionsProvider->GetAcceptance(outTermsAndConditions); - if (CHIP_NO_ERROR != err) - { - return CHIP_ERROR_INTERNAL; - } + VerifyOrReturnError(nullptr != termsAndConditionsProvider, CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE); - err = termsAndConditionsProvider->CheckAcceptance(outTermsAndConditions, termsAndConditionsState); - if (CHIP_NO_ERROR != err) - { - return CHIP_ERROR_INTERNAL; - } + ReturnErrorOnFailure(termsAndConditionsProvider->GetAcceptance(outTermsAndConditions)); + ReturnErrorOnFailure(termsAndConditionsProvider->CheckAcceptance(outTermsAndConditions, termsAndConditionsState)); bool setTermsAndConditionsCallRequiredBeforeCommissioningCompleteSuccess = termsAndConditionsState != TermsAndConditionsState::OK; @@ -184,16 +149,8 @@ CHIP_ERROR GeneralCommissioningAttrAccess::Read(const ConcreteReadAttributePath TermsAndConditionsProvider * const termsAndConditionsProvider = TermsAndConditionsManager::GetInstance(); Optional outUpdateAcceptanceDeadline; - if (nullptr == termsAndConditionsProvider) - { - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; - } - - CHIP_ERROR err = termsAndConditionsProvider->GetUpdateAcceptanceDeadline(outUpdateAcceptanceDeadline); - if (CHIP_NO_ERROR != err) - { - return CHIP_ERROR_INTERNAL; - } + VerifyOrReturnError(nullptr != termsAndConditionsProvider, CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE); + ReturnErrorOnFailure(termsAndConditionsProvider->GetUpdateAcceptanceDeadline(outUpdateAcceptanceDeadline)); if (!outUpdateAcceptanceDeadline.HasValue()) { @@ -258,40 +215,31 @@ CommissioningErrorEnum CheckTermsAndConditionsAcknowledgementsState(TermsAndCond { TermsAndConditionsState termsAndConditionsState; - CHIP_ERROR err = termsAndConditionsProvider->CheckAcceptance(acceptedTermsAndConditions, termsAndConditionsState); - if (CHIP_NO_ERROR != err) - { - ChipLogError(FailSafe, "GeneralCommissioning: Failed to verify terms and conditions acceptance: %" CHIP_ERROR_FORMAT, - err.Format()); - return chip::app::Clusters::GeneralCommissioning::CommissioningErrorEnum::kRequiredTCNotAccepted; - } + VerifyOrReturnValue(CHIP_NO_ERROR == + termsAndConditionsProvider->CheckAcceptance(acceptedTermsAndConditions, termsAndConditionsState), + CommissioningErrorEnum::kRequiredTCNotAccepted); switch (termsAndConditionsState) { case TermsAndConditionsState::OK: - return chip::app::Clusters::GeneralCommissioning::CommissioningErrorEnum::kOk; + return CommissioningErrorEnum::kOk; case TermsAndConditionsState::TC_ACKNOWLEDGEMENTS_NOT_RECEIVED: - return chip::app::Clusters::GeneralCommissioning::CommissioningErrorEnum::kTCAcknowledgementsNotReceived; + return CommissioningErrorEnum::kTCAcknowledgementsNotReceived; case TermsAndConditionsState::TC_MIN_VERSION_NOT_MET: - return chip::app::Clusters::GeneralCommissioning::CommissioningErrorEnum::kTCMinVersionNotMet; + return CommissioningErrorEnum::kTCMinVersionNotMet; case TermsAndConditionsState::REQUIRED_TC_NOT_ACCEPTED: - return chip::app::Clusters::GeneralCommissioning::CommissioningErrorEnum::kRequiredTCNotAccepted; + return CommissioningErrorEnum::kRequiredTCNotAccepted; } - return chip::app::Clusters::GeneralCommissioning::CommissioningErrorEnum::kOk; + return CommissioningErrorEnum::kOk; } CommissioningErrorEnum CheckTermsAndConditionsAcknowledgements(TermsAndConditionsProvider * const termsAndConditionsProvider) { Optional acceptedTermsAndConditions; - CHIP_ERROR err = termsAndConditionsProvider->GetAcceptance(acceptedTermsAndConditions); - if (err != CHIP_NO_ERROR) - { - ChipLogError(FailSafe, "GeneralCommissioning: Failed to get terms and conditions acceptance: %" CHIP_ERROR_FORMAT, - err.Format()); - return chip::app::Clusters::GeneralCommissioning::CommissioningErrorEnum::kTCAcknowledgementsNotReceived; - } + VerifyOrReturnValue(CHIP_NO_ERROR == termsAndConditionsProvider->GetAcceptance(acceptedTermsAndConditions), + CommissioningErrorEnum::kTCAcknowledgementsNotReceived); return CheckTermsAndConditionsAcknowledgementsState(termsAndConditionsProvider, acceptedTermsAndConditions); } @@ -306,15 +254,13 @@ void NotifyTermsAndConditionsAttributesChange(TermsAndConditionsProvider * const if (currentTermsAndConditionsAcceptance.ValueOr(TermsAndConditions(0, 0)).GetVersion() != updatedTermsAndConditions.ValueOr(TermsAndConditions(0, 0)).GetVersion()) { - MatterReportingAttributeChangeCallback(endpoint, GeneralCommissioning::Id, - GeneralCommissioning::Attributes::TCAcceptedVersion::Id); + MatterReportingAttributeChangeCallback(endpoint, GeneralCommissioning::Id, Attributes::TCAcceptedVersion::Id); } if (currentTermsAndConditionsAcceptance.ValueOr(TermsAndConditions(0, 0)).GetValue() != updatedTermsAndConditions.ValueOr(TermsAndConditions(0, 0)).GetValue()) { - MatterReportingAttributeChangeCallback(endpoint, GeneralCommissioning::Id, - GeneralCommissioning::Attributes::TCAcknowledgements::Id); + MatterReportingAttributeChangeCallback(endpoint, GeneralCommissioning::Id, Attributes::TCAcknowledgements::Id); } CommissioningErrorEnum previousState = @@ -324,8 +270,7 @@ void NotifyTermsAndConditionsAttributesChange(TermsAndConditionsProvider * const if (previousState != updatedState) { - MatterReportingAttributeChangeCallback(endpoint, GeneralCommissioning::Id, - GeneralCommissioning::Attributes::TCAcknowledgementsRequired::Id); + MatterReportingAttributeChangeCallback(endpoint, GeneralCommissioning::Id, Attributes::TCAcknowledgementsRequired::Id); } } } @@ -547,7 +492,7 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(app::CommandH bool emberAfGeneralCommissioningClusterSetTCAcknowledgementsCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::GeneralCommissioning::Commands::SetTCAcknowledgements::DecodableType & commandData) + const GeneralCommissioning::Commands::SetTCAcknowledgements::DecodableType & commandData) { #if CHIP_CONFIG_TC_REQUIRED MATTER_TRACE_SCOPE("SetTCAcknowledgements", "GeneralCommissioning"); diff --git a/src/app/server/DefaultTermsAndConditionsProvider.cpp b/src/app/server/DefaultTermsAndConditionsProvider.cpp index 95ca4714cafc0b..bc249f1254903e 100644 --- a/src/app/server/DefaultTermsAndConditionsProvider.cpp +++ b/src/app/server/DefaultTermsAndConditionsProvider.cpp @@ -23,6 +23,8 @@ #include #include #include +#include +#include namespace { constexpr chip::TLV::Tag kSerializationVersionTag = chip::TLV::ContextTag(1); @@ -52,7 +54,7 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsStorageDelegate::Delete() VerifyOrReturnValue(nullptr != mStorageDelegate, CHIP_ERROR_UNINITIALIZED); const chip::StorageKeyName kStorageKey = chip::DefaultStorageKeyAllocator::TermsAndConditionsAcceptance(); - VerifyOrReturnValue(CHIP_NO_ERROR == mStorageDelegate->SyncDeleteKeyValue(kStorageKey.KeyName()), CHIP_ERROR_INTERNAL); + ReturnErrorOnFailure(mStorageDelegate->SyncDeleteKeyValue(kStorageKey.KeyName())); return CHIP_NO_ERROR; } @@ -72,27 +74,27 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsStorageDelegate::Get(OptionalSyncGetKeyValue(kStorageKey.KeyName(), &buffer, bufferSize); + + CHIP_ERROR err = mStorageDelegate->SyncGetKeyValue(kStorageKey.KeyName(), &buffer, bufferSize); + VerifyOrReturnValue(CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND == err || CHIP_NO_ERROR == err, err); + if (CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND == err) { outTermsAndConditions.ClearValue(); return CHIP_NO_ERROR; } - VerifyOrReturnValue(CHIP_NO_ERROR == err, CHIP_ERROR_INTERNAL); - tlvReader.Init(buffer, bufferSize); - VerifyOrReturnValue(CHIP_NO_ERROR == tlvReader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()), - CHIP_ERROR_INTERNAL); - VerifyOrReturnValue(CHIP_NO_ERROR == tlvReader.EnterContainer(tlvContainer), CHIP_ERROR_INTERNAL); - VerifyOrReturnValue(CHIP_NO_ERROR == tlvReader.Next(kSerializationVersionTag), CHIP_ERROR_INTERNAL); - VerifyOrReturnValue(CHIP_NO_ERROR == tlvReader.Get(serializationVersion), CHIP_ERROR_INTERNAL); + ReturnErrorOnFailure(tlvReader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag())); + ReturnErrorOnFailure(tlvReader.EnterContainer(tlvContainer)); + ReturnErrorOnFailure(tlvReader.Next(kSerializationVersionTag)); + ReturnErrorOnFailure(tlvReader.Get(serializationVersion)); if (serializationVersion < kSerializationSchemaMinimumVersion) { ChipLogError(AppServer, "The terms and conditions datastore schema (%hhu) is newer than oldest compatible schema (%hhu)", serializationVersion, kSerializationSchemaMinimumVersion); - return CHIP_ERROR_INTERNAL; + return CHIP_IM_GLOBAL_STATUS(ConstraintError); } if (serializationVersion != kSerializationSchemaCurrentVersion) @@ -101,11 +103,11 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsStorageDelegate::Get(Optional(TermsAndConditions(acknowledgements, acknowledgementsVersion)); @@ -121,23 +123,16 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsStorageDelegate::Set(const TermsA VerifyOrReturnValue(nullptr != mStorageDelegate, CHIP_ERROR_UNINITIALIZED); tlvWriter.Init(buffer); - VerifyOrReturnValue(CHIP_NO_ERROR == - tlvWriter.StartContainer(chip::TLV::AnonymousTag(), chip::TLV::kTLVType_Structure, tlvContainer), - CHIP_ERROR_INTERNAL); - VerifyOrReturnValue(CHIP_NO_ERROR == tlvWriter.Put(kSerializationVersionTag, kSerializationSchemaCurrentVersion), - CHIP_ERROR_INTERNAL); - VerifyOrReturnValue(CHIP_NO_ERROR == tlvWriter.Put(kAcceptedAcknowledgementsTag, inTermsAndConditions.GetValue()), - CHIP_ERROR_INTERNAL); - VerifyOrReturnValue(CHIP_NO_ERROR == tlvWriter.Put(kAcceptedAcknowledgementsVersionTag, inTermsAndConditions.GetVersion()), - CHIP_ERROR_INTERNAL); - VerifyOrReturnValue(CHIP_NO_ERROR == tlvWriter.EndContainer(tlvContainer), CHIP_ERROR_INTERNAL); - VerifyOrReturnValue(CHIP_NO_ERROR == tlvWriter.Finalize(), CHIP_ERROR_INTERNAL); + ReturnErrorOnFailure(tlvWriter.StartContainer(chip::TLV::AnonymousTag(), chip::TLV::kTLVType_Structure, tlvContainer)); + ReturnErrorOnFailure(tlvWriter.Put(kSerializationVersionTag, kSerializationSchemaCurrentVersion)); + ReturnErrorOnFailure(tlvWriter.Put(kAcceptedAcknowledgementsTag, inTermsAndConditions.GetValue())); + ReturnErrorOnFailure(tlvWriter.Put(kAcceptedAcknowledgementsVersionTag, inTermsAndConditions.GetVersion())); + ReturnErrorOnFailure(tlvWriter.EndContainer(tlvContainer)); + ReturnErrorOnFailure(tlvWriter.Finalize()); const chip::StorageKeyName kStorageKey = chip::DefaultStorageKeyAllocator::TermsAndConditionsAcceptance(); - VerifyOrReturnValue( - CHIP_NO_ERROR == - mStorageDelegate->SyncSetKeyValue(kStorageKey.KeyName(), buffer, static_cast(tlvWriter.GetLengthWritten())), - CHIP_ERROR_INTERNAL); + ReturnErrorOnFailure( + mStorageDelegate->SyncSetKeyValue(kStorageKey.KeyName(), buffer, static_cast(tlvWriter.GetLengthWritten()))); return CHIP_NO_ERROR; } @@ -206,21 +201,13 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::CommitAcceptance() { VerifyOrReturnValue(nullptr != mTermsAndConditionsStorageDelegate, CHIP_ERROR_UNINITIALIZED); - if (!mTemporalAcceptance.HasValue()) - { - ChipLogError(AppServer, "No terms and conditions to commit"); - return CHIP_NO_ERROR; - } - - CHIP_ERROR err = mTermsAndConditionsStorageDelegate->Set(mTemporalAcceptance.Value()); - if (CHIP_NO_ERROR != err) - { - ChipLogError(AppServer, "Failed storage delegate Set(): %" CHIP_ERROR_FORMAT, err.Format()); - return CHIP_ERROR_INTERNAL; - } + // No terms and conditions to commit + VerifyOrReturnValue(mTemporalAcceptance.HasValue(), CHIP_NO_ERROR); + ReturnErrorOnFailure(mTermsAndConditionsStorageDelegate->Set(mTemporalAcceptance.Value())); ChipLogProgress(AppServer, "Terms and conditions have been committed"); mTemporalAcceptance.ClearValue(); + return CHIP_NO_ERROR; } @@ -237,19 +224,15 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::GetAcceptance(Optional< // Otherwise, try to get the persisted acceptance state CHIP_ERROR err = mTermsAndConditionsStorageDelegate->Get(outTermsAndConditions); + VerifyOrReturnValue(CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND == err || CHIP_NO_ERROR == err, err); + if (CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND == err) { ChipLogError(AppServer, "No terms and conditions have been accepted"); + outTermsAndConditions.ClearValue(); return CHIP_NO_ERROR; } - // If the storage delegate returns an error, other than "value not found" then there was an unexpected datastore failure - if (CHIP_NO_ERROR != err) - { - ChipLogError(AppServer, "Failed storage delegate Get(): %" CHIP_ERROR_FORMAT, err.Format()); - return CHIP_ERROR_INTERNAL; - } - return CHIP_NO_ERROR; } @@ -267,6 +250,7 @@ chip::app::DefaultTermsAndConditionsProvider::GetUpdateAcceptanceDeadline(Option { VerifyOrReturnValue(nullptr != mTermsAndConditionsStorageDelegate, CHIP_ERROR_UNINITIALIZED); + // No-op stub implementation. This feature is not implemented in this default implementation. outUpdateAcceptanceDeadline = Optional(); return CHIP_NO_ERROR; @@ -276,12 +260,7 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::ResetAcceptance() { VerifyOrReturnValue(nullptr != mTermsAndConditionsStorageDelegate, CHIP_ERROR_UNINITIALIZED); - CHIP_ERROR err = mTermsAndConditionsStorageDelegate->Delete(); - if (CHIP_NO_ERROR != err) - { - ChipLogError(AppServer, "Failed storage delegate Delete(): %" CHIP_ERROR_FORMAT, err.Format()); - } - + (void) mTermsAndConditionsStorageDelegate->Delete(); return RevertAcceptance(); } @@ -298,15 +277,7 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::SetAcceptance(const Opt { VerifyOrReturnValue(nullptr != mTermsAndConditionsStorageDelegate, CHIP_ERROR_UNINITIALIZED); - TermsAndConditionsState termsAndConditionsState = TermsAndConditionsState::OK; - - CHIP_ERROR err = CheckAcceptance(inTermsAndConditions, termsAndConditionsState); - if (CHIP_NO_ERROR != err) - { - ChipLogError(AppServer, "Failed to check acceptance state: %" CHIP_ERROR_FORMAT, err.Format()); - return CHIP_ERROR_INVALID_ARGUMENT; - } - mTemporalAcceptance = inTermsAndConditions; + return CHIP_NO_ERROR; } diff --git a/src/app/server/DefaultTermsAndConditionsProvider.h b/src/app/server/DefaultTermsAndConditionsProvider.h index ced78e702b66b4..fefe7211908a62 100644 --- a/src/app/server/DefaultTermsAndConditionsProvider.h +++ b/src/app/server/DefaultTermsAndConditionsProvider.h @@ -47,8 +47,8 @@ class TermsAndConditionsStorageDelegate * effectively resetting their acceptance status in the persistent storage. * * @retval CHIP_NO_ERROR if the record was successfully deleted. - * @retval CHIP_ERROR_INTERNAL if there was an error deleting the record from storage. * @retval CHIP_ERROR_UNINITIALIZED if the storage delegate is not properly initialized. + * @retval CHIP_ERROR_* for other errors. */ virtual CHIP_ERROR Delete() = 0; @@ -61,8 +61,8 @@ class TermsAndConditionsStorageDelegate * @param[out] outTermsAndConditions The retrieved terms and conditions, if any exist. * * @retval CHIP_NO_ERROR if the terms were successfully retrieved. - * @retval CHIP_ERROR_INTERNAL if an error occurred while retrieving from persistent storage. * @retval CHIP_ERROR_UNINITIALIZED if the storage delegate is not properly initialized. + * @retval CHIP_ERROR_* for other errors. */ virtual CHIP_ERROR Get(Optional & outTermsAndConditions) = 0; @@ -75,8 +75,8 @@ class TermsAndConditionsStorageDelegate * @param[in] inTermsAndConditions The terms and conditions to be saved. * * @retval CHIP_NO_ERROR if the terms were successfully stored. - * @retval CHIP_ERROR_INTERNAL if there was an error during the storage operation. * @retval CHIP_ERROR_UNINITIALIZED if the storage delegate is not properly initialized. + * @retval CHIP_ERROR_* for other errors. */ virtual CHIP_ERROR Set(const TermsAndConditions & inTermsAndConditions) = 0; }; diff --git a/src/app/server/TermsAndConditionsProvider.h b/src/app/server/TermsAndConditionsProvider.h index 9b908382b8bf6d..76846dfa066590 100644 --- a/src/app/server/TermsAndConditionsProvider.h +++ b/src/app/server/TermsAndConditionsProvider.h @@ -74,8 +74,8 @@ class TermsAndConditionsProvider * why they are invalid (e.g., version mismatch or required terms not accepted). * * @retval CHIP_NO_ERROR if the terms are successfully validated. - * @retval CHIP_ERROR_INTERNAL if there was an error during the operation. * @retval CHIP_ERROR_UNINITIALIZED if the module has not been initialized. + * @retval CHIP_ERROR_* for other errors. */ virtual CHIP_ERROR CheckAcceptance(const Optional & inTermsAndConditions, TermsAndConditionsState & outState) const = 0; @@ -87,8 +87,8 @@ class TermsAndConditionsProvider * status in a permanent location and clears the temporary in-memory acceptance state after committing. * * @retval CHIP_NO_ERROR if the terms were successfully persisted. - * @retval CHIP_ERROR_INTERNAL if there was an error during the operation. * @retval CHIP_ERROR_UNINITIALIZED if the module has not been initialized. + * @retval CHIP_ERROR_* for other errors. */ virtual CHIP_ERROR CommitAcceptance() = 0; @@ -102,8 +102,8 @@ class TermsAndConditionsProvider * @param[out] outTermsAndConditions The current accepted terms and conditions, if any. * * @retval CHIP_NO_ERROR if the terms were successfully retrieved or no terms were found. - * @retval CHIP_ERROR_INTERNAL if there was an error during the operation. * @retval CHIP_ERROR_UNINITIALIZED if the module has not been initialized. + * @retval CHIP_ERROR_* for other errors. */ virtual CHIP_ERROR GetAcceptance(Optional & outTermsAndConditions) const = 0; @@ -116,8 +116,8 @@ class TermsAndConditionsProvider * @param[out] outTermsAndConditions The required terms and conditions. * * @retval CHIP_NO_ERROR if the required terms were successfully retrieved. - * @retval CHIP_ERROR_INTERNAL if there was an error during the operation. * @retval CHIP_ERROR_UNINITIALIZED if the module has not been initialized. + * @retval CHIP_ERROR_* for other errors. */ virtual CHIP_ERROR GetRequirements(Optional & outTermsAndConditions) const = 0; @@ -131,8 +131,8 @@ class TermsAndConditionsProvider * Returns empty Optional if no deadline is set. * * @retval CHIP_NO_ERROR if the deadline was successfully retrieved or no deadline was found. - * @retval CHIP_ERROR_INTERNAL if there was an error during the operation. * @retval CHIP_ERROR_UNINITIALIZED if the module has not been initialized. + * @retval CHIP_ERROR_* for other errors. */ virtual CHIP_ERROR GetUpdateAcceptanceDeadline(Optional & outUpdateAcceptanceDeadline) const = 0; @@ -144,8 +144,8 @@ class TermsAndConditionsProvider * through this method. * * @retval CHIP_NO_ERROR if the terms were successfully reset. - * @retval CHIP_ERROR_INTERNAL if there was an error during the operation. * @retval CHIP_ERROR_UNINITIALIZED if the module has not been initialized. + * @retval CHIP_ERROR_* for other errors. */ virtual CHIP_ERROR ResetAcceptance() = 0; @@ -156,8 +156,8 @@ class TermsAndConditionsProvider * not affect the persisted state stored in storage. * * @retval CHIP_NO_ERROR if the in-memory acceptance state was successfully cleared. - * @retval CHIP_ERROR_INTERNAL if there was an error during the operation. * @retval CHIP_ERROR_UNINITIALIZED if the module has not been initialized. + * @retval CHIP_ERROR_* for other errors. */ virtual CHIP_ERROR RevertAcceptance() = 0; @@ -170,9 +170,9 @@ class TermsAndConditionsProvider * @param[in] inTermsAndConditions The terms and conditions to be accepted temporarily. * * @retval CHIP_NO_ERROR if the terms were successfully stored in-memory. - * @retval CHIP_ERROR_INTERNAL if there was an error during the operation. * @retval CHIP_ERROR_INVALID_ARGUMENT if the provided terms and conditions are invalid. * @retval CHIP_ERROR_UNINITIALIZED if the module has not been initialized. + * @retval CHIP_ERROR_* for other errors. */ virtual CHIP_ERROR SetAcceptance(const Optional & inTermsAndConditions) = 0; }; diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index 9e4c144432a294..5574decbd1c94f 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -1845,17 +1845,6 @@ extern const char CHIP_NON_PRODUCTION_MARKER[]; #define CHIP_CONFIG_MAX_BDX_LOG_TRANSFERS 5 #endif // CHIP_CONFIG_MAX_BDX_LOG_TRANSFERS -/** - * @def CHIP_CONFIG_TEST_GOOGLETEST - * - * @brief - * If asserted (1), enable APIs that support unit tests built with the GoogleTest framework - * - */ -#ifndef CHIP_CONFIG_TEST_GOOGLETEST -#define CHIP_CONFIG_TEST_GOOGLETEST 0 -#endif // CHIP_CONFIG_TEST_GOOGLETEST - /** * @file * Configuration settings for Terms and Conditions (TC) acknowledgements during device commissioning.