From bf2bddba78f2f430ce9b407db81ad2e45ad89769 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Wed, 23 Oct 2024 17:31:39 -0400 Subject: [PATCH] Fix ICD manager and attributes --- src/app/icd/server/ICDManager.cpp | 10 +++++----- src/app/icd/server/ICDManager.h | 6 +++--- .../zap-templates/zcl/zcl-with-test-extensions.json | 3 ++- src/app/zap-templates/zcl/zcl.json | 3 ++- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/app/icd/server/ICDManager.cpp b/src/app/icd/server/ICDManager.cpp index ba349b22b972a5..6efa43875fdf46 100644 --- a/src/app/icd/server/ICDManager.cpp +++ b/src/app/icd/server/ICDManager.cpp @@ -117,13 +117,13 @@ void ICDManager::Shutdown() bool ICDManager::SupportsFeature(Feature feature) { // Can't use attribute accessors/Attributes::FeatureMap::Get in unit tests -#if !CONFIG_BUILD_FOR_HOST_UNIT_TEST +#if !(CONFIG_BUILD_FOR_HOST_UNIT_TEST) uint32_t featureMap = 0; bool success = (Attributes::FeatureMap::Get(kRootEndpointId, &featureMap) == Status::Success); return success ? ((featureMap & to_underlying(feature)) != 0) : false; #else return ((mFeatureMap & to_underlying(feature)) != 0); -#endif // !CONFIG_BUILD_FOR_HOST_UNIT_TEST +#endif // !(CONFIG_BUILD_FOR_HOST_UNIT_TEST) } uint32_t ICDManager::StayActiveRequest(uint32_t stayActiveDuration) @@ -145,7 +145,7 @@ uint32_t ICDManager::StayActiveRequest(uint32_t stayActiveDuration) #if CHIP_CONFIG_ENABLE_ICD_CIP void ICDManager::SendCheckInMsgs() { -#if !CONFIG_BUILD_FOR_HOST_UNIT_TEST +#if !(CONFIG_BUILD_FOR_HOST_UNIT_TEST) VerifyOrDie(mStorage != nullptr); VerifyOrDie(mFabricTable != nullptr); @@ -213,7 +213,7 @@ void ICDManager::SendCheckInMsgs() } } } -#endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST +#endif // !(CONFIG_BUILD_FOR_HOST_UNIT_TEST) } bool ICDManager::CheckInMessagesWouldBeSent(const std::function & shouldCheckInMsgsBeSentFunction) @@ -396,7 +396,7 @@ void ICDManager::UpdateICDMode() ICDConfigurationData::GetInstance().SetICDMode(tempMode); // Can't use attribute accessors/Attributes::OperatingMode::Set in unit tests -#if !CONFIG_BUILD_FOR_HOST_UNIT_TEST +#if !(CONFIG_BUILD_FOR_HOST_UNIT_TEST) Attributes::OperatingMode::Set(kRootEndpointId, static_cast(tempMode)); #endif diff --git a/src/app/icd/server/ICDManager.h b/src/app/icd/server/ICDManager.h index dc516673df8d40..eae0adbc1a28de 100644 --- a/src/app/icd/server/ICDManager.h +++ b/src/app/icd/server/ICDManager.h @@ -233,7 +233,7 @@ class ICDManager : public ICDListener, public TestEventTriggerHandler #if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS && !CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION bool GetIsBootUpResumeSubscriptionExecuted() { return mIsBootUpResumeSubscriptionExecuted; }; #endif // !CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION && CHIP_CONFIG_PERSIST_SUBSCRIPTIONS -#endif +#endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST // Implementation of ICDListener functions. // Callers must origin from the chip task context or hold the ChipStack lock. @@ -382,10 +382,10 @@ class ICDManager : public ICDListener, public TestEventTriggerHandler ObjectPool mICDSenderPool; #endif // CHIP_CONFIG_ENABLE_ICD_CIP -#ifdef CONFIG_BUILD_FOR_HOST_UNIT_TEST +#if CONFIG_BUILD_FOR_HOST_UNIT_TEST // feature map that can be changed at runtime for testing purposes uint32_t mFeatureMap = 0; -#endif +#endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST }; } // namespace app diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index 3ad401afb3e47a..0eba8fc692d6d8 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -290,7 +290,8 @@ "ActiveModeThreshold", "RegisteredClients", "ICDCounter", - "ClientsSupportedPerFabric" + "ClientsSupportedPerFabric", + "MaximumCheckInBackOff" ], "Occupancy Sensing": ["HoldTimeLimits", "HoldTime", "FeatureMap"], "Operational Credentials": [ diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index c291fc651f6aa0..6907cfea0eb19f 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -284,7 +284,8 @@ "ActiveModeThreshold", "RegisteredClients", "ICDCounter", - "ClientsSupportedPerFabric" + "ClientsSupportedPerFabric", + "MaximumCheckInBackOff" ], "Occupancy Sensing": ["HoldTimeLimits", "HoldTime", "FeatureMap"], "Operational Credentials": [