From ecf9c586177d4694a9090b28e8cef4ed341a885f Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Fri, 12 Jan 2024 11:50:11 -0500 Subject: [PATCH] Removed custom read access and add reportability for new attribute --- data_model/clusters/ICDManagement.xml | 2 +- .../icd-management-server/icd-management-server.cpp | 9 --------- src/app/icd/ICDManager.cpp | 5 +++++ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/data_model/clusters/ICDManagement.xml b/data_model/clusters/ICDManagement.xml index 6b7490efa1a0ec..be52f390be1786 100644 --- a/data_model/clusters/ICDManagement.xml +++ b/data_model/clusters/ICDManagement.xml @@ -135,7 +135,7 @@ Davis, CA 95616, USA - + diff --git a/src/app/clusters/icd-management-server/icd-management-server.cpp b/src/app/clusters/icd-management-server/icd-management-server.cpp index 5d79c11372839a..4574b4cfa3c2d1 100644 --- a/src/app/clusters/icd-management-server/icd-management-server.cpp +++ b/src/app/clusters/icd-management-server/icd-management-server.cpp @@ -64,7 +64,6 @@ class IcdManagementAttributeAccess : public AttributeAccessInterface CHIP_ERROR ReadRegisteredClients(EndpointId endpoint, AttributeValueEncoder & encoder); CHIP_ERROR ReadICDCounter(EndpointId endpoint, AttributeValueEncoder & encoder); CHIP_ERROR ReadClientsSupportedPerFabric(EndpointId endpoint, AttributeValueEncoder & encoder); - CHIP_ERROR ReadOperatingMode(EndpointId endpoint, AttributeValueEncoder & encoder); PersistentStorageDelegate * mStorage = nullptr; Crypto::SymmetricKeystore * mSymmetricKeystore = nullptr; @@ -95,9 +94,6 @@ CHIP_ERROR IcdManagementAttributeAccess::Read(const ConcreteReadAttributePath & case IcdManagement::Attributes::ClientsSupportedPerFabric::Id: return ReadClientsSupportedPerFabric(aPath.mEndpointId, aEncoder); - - case IcdManagement::Attributes::OperatingMode::Id: - return ReadOperatingMode(aPath.mEndpointId, aEncoder); } return CHIP_NO_ERROR; @@ -161,11 +157,6 @@ CHIP_ERROR IcdManagementAttributeAccess::ReadClientsSupportedPerFabric(EndpointI return encoder.Encode(mICDConfigurationData->GetClientsSupportedPerFabric()); } -CHIP_ERROR IcdManagementAttributeAccess::ReadOperatingMode(EndpointId endpoint, AttributeValueEncoder & encoder) -{ - return encoder.Encode(mICDConfigurationData->GetICDMode()); -} - /** * @brief Implementation of Fabric Delegate for ICD Management cluster */ diff --git a/src/app/icd/ICDManager.cpp b/src/app/icd/ICDManager.cpp index 09190ae9dfb8e1..88a672e0187153 100644 --- a/src/app/icd/ICDManager.cpp +++ b/src/app/icd/ICDManager.cpp @@ -245,6 +245,11 @@ void ICDManager::UpdateICDMode() { ICDConfigurationData::GetInstance().SetICDMode(tempMode); postObserverEvent(ObserverEventType::ICDModeChange); + + // Can't use attribute accessors/Attributes::FeatureMap::Get in unit tests +#if !CONFIG_BUILD_FOR_HOST_UNIT_TEST + Attributes::OperatingMode::Set(kRootEndpointId, to_underlying(tempMode)); +#endif } // When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec.