From 3ccec304b7fcccf37e51199ab184f34fe6af2a64 Mon Sep 17 00:00:00 2001 From: James Swan <122404367+swan-amazon@users.noreply.github.com> Date: Thu, 6 Jun 2024 00:04:27 +0000 Subject: [PATCH] Refactored function parameters with in/out prefix --- .../DefaultEnhancedSetupFlowProvider.cpp | 28 +++++++++-------- .../server/DefaultEnhancedSetupFlowProvider.h | 19 ++++++------ .../DefaultTermsAndConditionsProvider.cpp | 31 ++++++++++--------- .../DefaultTermsAndConditionsProvider.h | 21 +++++++------ src/app/server/EnhancedSetupFlowProvider.h | 23 +++++++------- src/app/server/TermsAndConditionsProvider.h | 18 +++++------ 6 files changed, 73 insertions(+), 67 deletions(-) diff --git a/src/app/server/DefaultEnhancedSetupFlowProvider.cpp b/src/app/server/DefaultEnhancedSetupFlowProvider.cpp index d5f80e0a2cf28c..95bbca130c97f1 100644 --- a/src/app/server/DefaultEnhancedSetupFlowProvider.cpp +++ b/src/app/server/DefaultEnhancedSetupFlowProvider.cpp @@ -21,9 +21,9 @@ #include #include -CHIP_ERROR chip::app::DefaultEnhancedSetupFlowProvider::Init(TermsAndConditionsProvider * aTermsAndConditionsProvider) +CHIP_ERROR chip::app::DefaultEnhancedSetupFlowProvider::Init(TermsAndConditionsProvider * const inTermsAndConditionsProvider) { - mTermsAndConditionsProvider = aTermsAndConditionsProvider; + mTermsAndConditionsProvider = inTermsAndConditionsProvider; return CHIP_NO_ERROR; } @@ -53,52 +53,54 @@ bool chip::app::DefaultEnhancedSetupFlowProvider::HasTermsAndConditionsRequiredA return acceptedAcknowledgementsVersion >= requiredAcknowledgementsVersion; } -CHIP_ERROR chip::app::DefaultEnhancedSetupFlowProvider::GetTermsAndConditionsRequiredAcknowledgements(uint16_t & value) const +CHIP_ERROR chip::app::DefaultEnhancedSetupFlowProvider::GetTermsAndConditionsRequiredAcknowledgements(uint16_t & outValue) const { uint16_t requiredAcknowledgements; uint16_t requiredAcknowledgementsVersion; mTermsAndConditionsProvider->GetRequirements(requiredAcknowledgements, requiredAcknowledgementsVersion); - value = requiredAcknowledgements; + outValue = requiredAcknowledgements; return CHIP_NO_ERROR; } -CHIP_ERROR chip::app::DefaultEnhancedSetupFlowProvider::GetTermsAndConditionsRequiredAcknowledgementsVersion(uint16_t & value) const +CHIP_ERROR +chip::app::DefaultEnhancedSetupFlowProvider::GetTermsAndConditionsRequiredAcknowledgementsVersion(uint16_t & outValue) const { uint16_t requiredAcknowledgements; uint16_t requiredAcknowledgementsVersion; mTermsAndConditionsProvider->GetRequirements(requiredAcknowledgements, requiredAcknowledgementsVersion); - value = requiredAcknowledgementsVersion; + outValue = requiredAcknowledgementsVersion; return CHIP_NO_ERROR; } -CHIP_ERROR chip::app::DefaultEnhancedSetupFlowProvider::GetTermsAndConditionsAcceptedAcknowledgements(uint16_t & value) const +CHIP_ERROR chip::app::DefaultEnhancedSetupFlowProvider::GetTermsAndConditionsAcceptedAcknowledgements(uint16_t & outValue) const { uint16_t acceptedAcknowledgements; uint16_t acceptedAcknowledgementsVersion; mTermsAndConditionsProvider->GetAcceptance(acceptedAcknowledgements, acceptedAcknowledgementsVersion); - value = acceptedAcknowledgements; + outValue = acceptedAcknowledgements; return CHIP_NO_ERROR; } -CHIP_ERROR chip::app::DefaultEnhancedSetupFlowProvider::GetTermsAndConditionsAcceptedAcknowledgementsVersion(uint16_t & value) const +CHIP_ERROR +chip::app::DefaultEnhancedSetupFlowProvider::GetTermsAndConditionsAcceptedAcknowledgementsVersion(uint16_t & outValue) const { uint16_t acceptedAcknowledgements; uint16_t acceptedAcknowledgementsVersion; mTermsAndConditionsProvider->GetAcceptance(acceptedAcknowledgements, acceptedAcknowledgementsVersion); - value = acceptedAcknowledgementsVersion; + outValue = acceptedAcknowledgementsVersion; return CHIP_NO_ERROR; } -CHIP_ERROR chip::app::DefaultEnhancedSetupFlowProvider::SetTermsAndConditionsAcceptance(uint16_t aTCAcknowledgements, - uint16_t aTCAcknowledgementsVersion) +CHIP_ERROR chip::app::DefaultEnhancedSetupFlowProvider::SetTermsAndConditionsAcceptance(uint16_t inTCAcknowledgementsValue, + uint16_t inTCAcknowledgementsVersionValue) { - return mTermsAndConditionsProvider->SetAcceptance(aTCAcknowledgements, aTCAcknowledgementsVersion); + return mTermsAndConditionsProvider->SetAcceptance(inTCAcknowledgementsValue, inTCAcknowledgementsVersionValue); } diff --git a/src/app/server/DefaultEnhancedSetupFlowProvider.h b/src/app/server/DefaultEnhancedSetupFlowProvider.h index 0870be959a2996..c6ea651fcc5f81 100644 --- a/src/app/server/DefaultEnhancedSetupFlowProvider.h +++ b/src/app/server/DefaultEnhancedSetupFlowProvider.h @@ -34,9 +34,10 @@ class DefaultEnhancedSetupFlowProvider : public EnhancedSetupFlowProvider /** * @brief Initializes the EnhancedSetupFlowProvider. * + * @param[in] inTermsAndConditionsProvider The terms and conditions provide dependency. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR Init(TermsAndConditionsProvider * aTermsAndConditionsProvider); + virtual CHIP_ERROR Init(TermsAndConditionsProvider * const inTermsAndConditionsProvider); /** * @brief Checks if the required terms and conditions acknowledgements have been accepted. @@ -55,34 +56,34 @@ class DefaultEnhancedSetupFlowProvider : public EnhancedSetupFlowProvider /** * @brief Retrieves the required terms and conditions acknowledgements. * - * @param[out] value The value of the required acknowledgements. + * @param[out] outValue The value of the required acknowledgements. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR GetTermsAndConditionsRequiredAcknowledgements(uint16_t & value) const; + virtual CHIP_ERROR GetTermsAndConditionsRequiredAcknowledgements(uint16_t & outValue) const; /** * @brief Retrieves the required terms and conditions acknowledgements version. * - * @param[out] value The value of the required acknowledgements version. + * @param[out] outValue The value of the required acknowledgements version. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR GetTermsAndConditionsRequiredAcknowledgementsVersion(uint16_t & value) const; + virtual CHIP_ERROR GetTermsAndConditionsRequiredAcknowledgementsVersion(uint16_t & outValue) const; /** * @brief Retrieves the accepted terms and conditions acknowledgements. * - * @param[out] value The value of the accepted acknowledgements. + * @param[out] outValue The value of the accepted acknowledgements. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR GetTermsAndConditionsAcceptedAcknowledgements(uint16_t & value) const; + virtual CHIP_ERROR GetTermsAndConditionsAcceptedAcknowledgements(uint16_t & outValue) const; /** * @brief Retrieves the accepted terms and conditions acknowledgements version. * - * @param[out] value The value of the accepted acknowledgements version. + * @param[out] outValue The value of the accepted acknowledgements version. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR GetTermsAndConditionsAcceptedAcknowledgementsVersion(uint16_t & value) const; + virtual CHIP_ERROR GetTermsAndConditionsAcceptedAcknowledgementsVersion(uint16_t & outValue) const; /** * @brief Sets the acceptance status of the terms and conditions. diff --git a/src/app/server/DefaultTermsAndConditionsProvider.cpp b/src/app/server/DefaultTermsAndConditionsProvider.cpp index 2ed8c2332fe1bd..e0f34e0e5414f2 100644 --- a/src/app/server/DefaultTermsAndConditionsProvider.cpp +++ b/src/app/server/DefaultTermsAndConditionsProvider.cpp @@ -22,14 +22,14 @@ #include CHIP_ERROR -chip::app::DefaultTermsAndConditionsProvider::Init(chip::DeviceLayer::PersistedStorage::KeyValueStoreManager * kvsManager) +chip::app::DefaultTermsAndConditionsProvider::Init(chip::DeviceLayer::PersistedStorage::KeyValueStoreManager * const inKvsManager) { - mKeyValueStoreManager = kvsManager; + mKeyValueStoreManager = inKvsManager; return CHIP_NO_ERROR; } -CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::GetAcceptance(uint16_t & aAcknowledgements, - uint16_t & aAcknowledgementsVersion) +CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::GetAcceptance(uint16_t & outAcknowledgementsValue, + uint16_t & outAcknowledgementsVersionValue) { uint16_t acknowledgements = 0; uint16_t acknowledgementsVersion = 0; @@ -37,8 +37,8 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::GetAcceptance(uint16_t mKeyValueStoreManager->Get(kAcceptedAcknowledgementsKeyName, &acknowledgements, sizeof(acknowledgements)); mKeyValueStoreManager->Get(kAcceptedAcknowledgementsVersionKeyName, &acknowledgementsVersion, sizeof(acknowledgementsVersion)); - aAcknowledgements = acknowledgements; - aAcknowledgementsVersion = acknowledgementsVersion; + outAcknowledgementsValue = acknowledgements; + outAcknowledgementsVersionValue = acknowledgementsVersion; return CHIP_NO_ERROR; } @@ -51,19 +51,20 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::GetAcceptance(uint16_t #error "CHIP_CONFIG_TC_REQUIRED_ACKNOWLEDGEMENTS_VERSION is not defined!" #endif -CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::GetRequirements(uint16_t & aAcknowledgements, - uint16_t & aAcknowledgementsVersion) +CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::GetRequirements(uint16_t & outAcknowledgementsValue, + uint16_t & outAcknowledgementsVersionValue) { - aAcknowledgements = CHIP_CONFIG_TC_REQUIRED_ACKNOWLEDGEMENTS; - aAcknowledgementsVersion = CHIP_CONFIG_TC_REQUIRED_ACKNOWLEDGEMENTS_VERSION; + outAcknowledgementsValue = CHIP_CONFIG_TC_REQUIRED_ACKNOWLEDGEMENTS; + outAcknowledgementsVersionValue = CHIP_CONFIG_TC_REQUIRED_ACKNOWLEDGEMENTS_VERSION; return CHIP_NO_ERROR; } -CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::SetAcceptance(uint16_t aAcceptedAcknowledgements, - uint16_t aAcceptedAcknowledgementsVersion) +CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::SetAcceptance(uint16_t inAcceptedAcknowledgementsValue, + uint16_t inAcceptedAcknowledgementsVersionValue) { - mKeyValueStoreManager->Put(kAcceptedAcknowledgementsKeyName, &aAcceptedAcknowledgements, sizeof(aAcceptedAcknowledgements)); - mKeyValueStoreManager->Put(kAcceptedAcknowledgementsVersionKeyName, &aAcceptedAcknowledgementsVersion, - sizeof(aAcceptedAcknowledgementsVersion)); + mKeyValueStoreManager->Put(kAcceptedAcknowledgementsKeyName, &inAcceptedAcknowledgementsValue, + sizeof(inAcceptedAcknowledgementsValue)); + mKeyValueStoreManager->Put(kAcceptedAcknowledgementsVersionKeyName, &inAcceptedAcknowledgementsVersionValue, + sizeof(inAcceptedAcknowledgementsVersionValue)); return CHIP_NO_ERROR; } diff --git a/src/app/server/DefaultTermsAndConditionsProvider.h b/src/app/server/DefaultTermsAndConditionsProvider.h index 4d47b342f6829c..36f7c21eb57973 100644 --- a/src/app/server/DefaultTermsAndConditionsProvider.h +++ b/src/app/server/DefaultTermsAndConditionsProvider.h @@ -36,36 +36,37 @@ class DefaultTermsAndConditionsProvider : public TermsAndConditionsProvider /** * @brief Initializes the TermsAndConditionsProvider. * + * @param[in] inKvsManager The KVS manager dependency. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR Init(chip::DeviceLayer::PersistedStorage::KeyValueStoreManager * kvsManager); + virtual CHIP_ERROR Init(chip::DeviceLayer::PersistedStorage::KeyValueStoreManager * inKvsManager); /** * @brief Retrieves the acceptance status of the required terms and conditions. * - * @param[out] aAcknowledgements The number of acknowledgements accepted. - * @param[out] aAcknowledgementsVersion The version of the accepted acknowledgements. + * @param[out] outAcknowledgementValues The number of acknowledgements accepted. + * @param[out] outAcknowledgementsVersionValue The version of the accepted acknowledgements. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR GetAcceptance(uint16_t & aAcknowledgements, uint16_t & aAcknowledgementsVersion); + virtual CHIP_ERROR GetAcceptance(uint16_t & outAcknowledgementsValue, uint16_t & outAcknowledgementsVersionValue); /** * @brief Retrieves the requirements of the terms and conditions. * - * @param[out] aAcknowledgements The number of required acknowledgements. - * @param[out] aAcknowledgementsVersion The version of the required acknowledgements. + * @param[out] outAcknowledgementValues The number of required acknowledgements. + * @param[out] outAcknowledgementsVersionValue The version of the required acknowledgements. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR GetRequirements(uint16_t & aAcknowledgements, uint16_t & aAcknowledgementsVersion); + virtual CHIP_ERROR GetRequirements(uint16_t & outAcknowledgementsValue, uint16_t & outAcknowledgementsVersionValue); /** * @brief Sets the acceptance status of the required terms and conditions. * - * @param[in] aAcknowledgements The number of acknowledgements to accept. - * @param[in] aAcknowledgementsVersion The version of the acknowledgements to accept. + * @param[in] inAcknowledgementValues The number of acknowledgements to accept. + * @param[in] inAcknowledgementsVersionValue The version of the acknowledgements to accept. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR SetAcceptance(uint16_t aAcknowledgements, uint16_t aAcknowledgementsVersion); + virtual CHIP_ERROR SetAcceptance(uint16_t inAcknowledgementsValue, uint16_t inAcknowledgementsVersionValue); private: chip::DeviceLayer::PersistedStorage::KeyValueStoreManager * mKeyValueStoreManager; diff --git a/src/app/server/EnhancedSetupFlowProvider.h b/src/app/server/EnhancedSetupFlowProvider.h index 11ebe057fe801b..7b572dcca39e9f 100644 --- a/src/app/server/EnhancedSetupFlowProvider.h +++ b/src/app/server/EnhancedSetupFlowProvider.h @@ -55,43 +55,44 @@ class EnhancedSetupFlowProvider /** * @brief Retrieves the required terms and conditions acknowledgements. * - * @param[out] value The value of the required acknowledgements. + * @param[out] outValue The outValue of the required acknowledgements. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR GetTermsAndConditionsRequiredAcknowledgements(uint16_t & value) const = 0; + virtual CHIP_ERROR GetTermsAndConditionsRequiredAcknowledgements(uint16_t & outValue) const = 0; /** * @brief Retrieves the required terms and conditions acknowledgements version. * - * @param[out] value The value of the required acknowledgements version. + * @param[out] outValue The outValue of the required acknowledgements version. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR GetTermsAndConditionsRequiredAcknowledgementsVersion(uint16_t & value) const = 0; + virtual CHIP_ERROR GetTermsAndConditionsRequiredAcknowledgementsVersion(uint16_t & outValue) const = 0; /** * @brief Retrieves the accepted terms and conditions acknowledgements. * - * @param[out] value The value of the accepted acknowledgements. + * @param[out] outValue The outValue of the accepted acknowledgements. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR GetTermsAndConditionsAcceptedAcknowledgements(uint16_t & value) const = 0; + virtual CHIP_ERROR GetTermsAndConditionsAcceptedAcknowledgements(uint16_t & outValue) const = 0; /** * @brief Retrieves the accepted terms and conditions acknowledgements version. * - * @param[out] value The value of the accepted acknowledgements version. + * @param[out] outValue The outValue of the accepted acknowledgements version. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR GetTermsAndConditionsAcceptedAcknowledgementsVersion(uint16_t & value) const = 0; + virtual CHIP_ERROR GetTermsAndConditionsAcceptedAcknowledgementsVersion(uint16_t & outValue) const = 0; /** * @brief Sets the acceptance status of the terms and conditions. * - * @param[in] aTCAcknowledgements The acknowledgements to accept. - * @param[in] aTCAcknowledgementsVersion The version of the acknowledgements to accept. + * @param[in] inTCAcknowledgements The acknowledgements to accept. + * @param[in] inTCAcknowledgementsoutValue The version of the acknowledgements to accept. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR SetTermsAndConditionsAcceptance(uint16_t aTCAcknowledgements, uint16_t aTCAcknowledgementsVersion) = 0; + virtual CHIP_ERROR SetTermsAndConditionsAcceptance(uint16_t inTCAcknowledgementsValue, + uint16_t inTCAcknowledgementsoutValue) = 0; }; }; // namespace app diff --git a/src/app/server/TermsAndConditionsProvider.h b/src/app/server/TermsAndConditionsProvider.h index 9c68fee9e3787e..d2c2aedf5165f0 100644 --- a/src/app/server/TermsAndConditionsProvider.h +++ b/src/app/server/TermsAndConditionsProvider.h @@ -39,29 +39,29 @@ class TermsAndConditionsProvider /** * @brief Retrieves the acceptance status of the required terms and conditions. * - * @param[out] aAcknowledgements The number of acknowledgements accepted. - * @param[out] aAcknowledgementsVersion The version of the accepted acknowledgements. + * @param[out] outAcknowledgementsValue The number of acknowledgements accepted. + * @param[out] outAcknowledgementsVersionValue The version of the accepted acknowledgements. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR GetAcceptance(uint16_t & aAcknowledgements, uint16_t & aAcknowledgementsVersion) = 0; + virtual CHIP_ERROR GetAcceptance(uint16_t & outAcknowledgementsValue, uint16_t & outAcknowledgementsVersionValue) = 0; /** * @brief Retrieves the requirements of the terms and conditions. * - * @param[out] aAcknowledgements The number of required acknowledgements. - * @param[out] aAcknowledgementsVersion The version of the required acknowledgements. + * @param[out] outAcknowledgementsValue The number of required acknowledgements. + * @param[out] outAcknowledgementsVersionValue The version of the required acknowledgements. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR GetRequirements(uint16_t & aAcknowledgements, uint16_t & aAcknowledgementsVersion) = 0; + virtual CHIP_ERROR GetRequirements(uint16_t & outAcknowledgementsValue, uint16_t & outAcknowledgementsVersionValue) = 0; /** * @brief Sets the acceptance status of the required terms and conditions. * - * @param[in] aAcknowledgements The number of acknowledgements to accept. - * @param[in] aAcknowledgementsVersion The version of the acknowledgements to accept. + * @param[in] inAcknowledgementsValue The number of acknowledgements to accept. + * @param[in] inAcknowledgementsVersionValue The version of the acknowledgements to accept. * @return CHIP_ERROR On success returns CHIP_NO_ERROR, otherwise returns an error code. */ - virtual CHIP_ERROR SetAcceptance(uint16_t aAcknowledgements, uint16_t aAcknowledgementsVersion) = 0; + virtual CHIP_ERROR SetAcceptance(uint16_t inAcknowledgementsValue, uint16_t inAcknowledgementsVersionValue) = 0; }; }; // namespace app