Skip to content

Commit

Permalink
Removed custom read access and add reportability for new attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs committed Jan 12, 2024
1 parent 17a4f0f commit ecf9c58
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion data_model/clusters/ICDManagement.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Davis, CA 95616, USA
</attribute>
<attribute id="0x0008" name="OperatingMode" type="OperatingModeEnum" default="0">
<access read="true" readPrivilege="view"/>
<quality changeOmitted="false" nullable="false" scene="false" persistence="fixed" reportable="false"/>
<quality changeOmitted="false" nullable="false" scene="false" persistence="fixed" reportable="true"/>
<mandatoryConform>
<feature name="LITS"/>
</mandatoryConform>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
*/
Expand Down
5 changes: 5 additions & 0 deletions src/app/icd/ICDManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ecf9c58

Please sign in to comment.