Skip to content

Commit

Permalink
[ICD] Set MaximumCheckInBackOff to external and fix define guards for…
Browse files Browse the repository at this point in the history
… unit test members (#36223)

* Fix ICD manager and attributes

* Generated files

* zap regen
  • Loading branch information
mkardous-silabs authored Oct 24, 2024
1 parent 515bc3b commit e0abf7a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 63 deletions.
10 changes: 5 additions & 5 deletions src/app/icd/server/ICDManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);

Expand Down Expand Up @@ -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> & shouldCheckInMsgsBeSentFunction)
Expand Down Expand Up @@ -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<OperatingModeEnum>(tempMode));
#endif

Expand Down
6 changes: 3 additions & 3 deletions src/app/icd/server/ICDManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -382,10 +382,10 @@ class ICDManager : public ICDListener, public TestEventTriggerHandler
ObjectPool<ICDCheckInSender, (CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC * CHIP_CONFIG_MAX_FABRICS)> 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
Expand Down
3 changes: 2 additions & 1 deletion src/app/zap-templates/zcl/zcl-with-test-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@
"ActiveModeThreshold",
"RegisteredClients",
"ICDCounter",
"ClientsSupportedPerFabric"
"ClientsSupportedPerFabric",
"MaximumCheckInBackOff"
],
"Occupancy Sensing": ["HoldTimeLimits", "HoldTime", "FeatureMap"],
"Operational Credentials": [
Expand Down
3 changes: 2 additions & 1 deletion src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@
"ActiveModeThreshold",
"RegisteredClients",
"ICDCounter",
"ClientsSupportedPerFabric"
"ClientsSupportedPerFabric",
"MaximumCheckInBackOff"
],
"Occupancy Sensing": ["HoldTimeLimits", "HoldTime", "FeatureMap"],
"Operational Credentials": [
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e0abf7a

Please sign in to comment.