From cc895039b5f53541661128fff45d7b988d95e139 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 11 Jun 2024 17:16:23 +0000 Subject: [PATCH] Restyled by clang-format --- .../chef-resource-monitoring-delegates.cpp | 126 +++++++++--------- .../chef-resource-monitoring-delegates.h | 28 ++-- examples/chef/common/stubs.cpp | 10 +- 3 files changed, 86 insertions(+), 78 deletions(-) diff --git a/examples/chef/common/clusters/resource-monitoring/chef-resource-monitoring-delegates.cpp b/examples/chef/common/clusters/resource-monitoring/chef-resource-monitoring-delegates.cpp index b48ee42a70fb19..9a4731427f7fad 100644 --- a/examples/chef/common/clusters/resource-monitoring/chef-resource-monitoring-delegates.cpp +++ b/examples/chef/common/clusters/resource-monitoring/chef-resource-monitoring-delegates.cpp @@ -15,13 +15,13 @@ * limitations under the License. */ -#include #include #include #include #include -#include #include +#include +#include using namespace chip; using namespace chip::app; @@ -98,49 +98,47 @@ void HepaFilterMonitoring::Shutdown() gHepaFilterDelegate.reset(); } -chip::Protocols::InteractionModel::Status ChefResourceMonitorInstance::ExternalAttributeWrite(const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) +chip::Protocols::InteractionModel::Status +ChefResourceMonitorInstance::ExternalAttributeWrite(const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) { Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Success; - AttributeId attributeId = attributeMetadata->attributeId; + AttributeId attributeId = attributeMetadata->attributeId; - switch (attributeId) { - case HepaFilterMonitoring::Attributes::Condition::Id: + switch (attributeId) { - uint8_t newCondition = *(uint8_t *)buffer; - ret = UpdateCondition(newCondition); + case HepaFilterMonitoring::Attributes::Condition::Id: { + uint8_t newCondition = *(uint8_t *) buffer; + ret = UpdateCondition(newCondition); } - break; - case HepaFilterMonitoring::Attributes::ChangeIndication::Id: - { - ResourceMonitoring::ChangeIndicationEnum newIndication = static_cast(*(uint8_t *)buffer); - ret = UpdateChangeIndication(newIndication); + break; + case HepaFilterMonitoring::Attributes::ChangeIndication::Id: { + ResourceMonitoring::ChangeIndicationEnum newIndication = + static_cast(*(uint8_t *) buffer); + ret = UpdateChangeIndication(newIndication); } - break; - case HepaFilterMonitoring::Attributes::InPlaceIndicator::Id: - { - bool newInPlaceIndicator = *(bool *)buffer; - ret = UpdateInPlaceIndicator(newInPlaceIndicator); + break; + case HepaFilterMonitoring::Attributes::InPlaceIndicator::Id: { + bool newInPlaceIndicator = *(bool *) buffer; + ret = UpdateInPlaceIndicator(newInPlaceIndicator); } - break; - case HepaFilterMonitoring::Attributes::LastChangedTime::Id: - { - uint32_t newValue = 0; - uint16_t tlvLen = *(uint16_t *) buffer; + break; + case HepaFilterMonitoring::Attributes::LastChangedTime::Id: { + uint32_t newValue = 0; + uint16_t tlvLen = *(uint16_t *) buffer; chip::TLV::TLVReader reader; reader.Init(buffer + sizeof(uint16_t), tlvLen); reader.Next(); reader.Get(newValue); DataModel::Nullable newLastChangedTime = DataModel::MakeNullable(newValue); - ret = UpdateLastChangedTime(newLastChangedTime); + ret = UpdateLastChangedTime(newLastChangedTime); } - break; + break; case HepaFilterMonitoring::Attributes::DegradationDirection::Id: - default: - { + default: { ChipLogError(Zcl, "Unsupported External Attribute Read: %d", static_cast(attributeId)); - ret = Protocols::InteractionModel::Status::UnsupportedWrite; + ret = Protocols::InteractionModel::Status::UnsupportedWrite; } - break; + break; } return ret; @@ -159,81 +157,89 @@ void emberAfActivatedCarbonFilterMonitoringClusterInitCallback(chip::EndpointId gActivatedCarbonFilterInstance->Init(); } -chip::Protocols::InteractionModel::Status chefResourceMonitoringExternalWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) +chip::Protocols::InteractionModel::Status +chefResourceMonitoringExternalWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) { Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Success; - AttributeId attributeId = attributeMetadata->attributeId; - ChipLogProgress(Zcl, "chefResourceMonitoringExternalWriteCallback EP: %d, Cluster: %d, Att: %d", static_cast(endpoint), static_cast(clusterId), static_cast(attributeId)); + AttributeId attributeId = attributeMetadata->attributeId; + ChipLogProgress(Zcl, "chefResourceMonitoringExternalWriteCallback EP: %d, Cluster: %d, Att: %d", static_cast(endpoint), + static_cast(clusterId), static_cast(attributeId)); - switch (clusterId) { + switch (clusterId) + { case HepaFilterMonitoring::Id: - ret = gHepaFilterInstance->ExternalAttributeWrite(attributeMetadata, buffer); + ret = gHepaFilterInstance->ExternalAttributeWrite(attributeMetadata, buffer); break; case ActivatedCarbonFilterMonitoring::Id: - ret = gActivatedCarbonFilterInstance->ExternalAttributeWrite(attributeMetadata, buffer); + ret = gActivatedCarbonFilterInstance->ExternalAttributeWrite(attributeMetadata, buffer); break; default: - ret = Protocols::InteractionModel::Status::UnsupportedWrite; + ret = Protocols::InteractionModel::Status::UnsupportedWrite; break; } return ret; } -chip::Protocols::InteractionModel::Status chefResourceMonitoringExternalReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, uint16_t maxReadLength) +chip::Protocols::InteractionModel::Status +chefResourceMonitoringExternalReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, + uint16_t maxReadLength) { Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Success; - AttributeId attributeId = attributeMetadata->attributeId; - ChipLogProgress(Zcl, "chefResourceMonitoringExternalReadCallback EP: %d, Cluster: %d, Att: %d", static_cast(endpoint), static_cast(clusterId), static_cast(attributeId)); + AttributeId attributeId = attributeMetadata->attributeId; + ChipLogProgress(Zcl, "chefResourceMonitoringExternalReadCallback EP: %d, Cluster: %d, Att: %d", static_cast(endpoint), + static_cast(clusterId), static_cast(attributeId)); - switch (clusterId) { + switch (clusterId) + { case HepaFilterMonitoring::Id: - ret = gHepaFilterInstance->ExternalAttributeRead(attributeMetadata, buffer, maxReadLength); + ret = gHepaFilterInstance->ExternalAttributeRead(attributeMetadata, buffer, maxReadLength); break; case ActivatedCarbonFilterMonitoring::Id: - ret = gActivatedCarbonFilterInstance->ExternalAttributeRead(attributeMetadata, buffer, maxReadLength); + ret = gActivatedCarbonFilterInstance->ExternalAttributeRead(attributeMetadata, buffer, maxReadLength); break; default: - ret = Protocols::InteractionModel::Status::UnsupportedRead; + ret = Protocols::InteractionModel::Status::UnsupportedRead; break; } return ret; } -chip::Protocols::InteractionModel::Status ChefResourceMonitorInstance::ExternalAttributeRead(const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, uint16_t maxReadLength) +chip::Protocols::InteractionModel::Status +ChefResourceMonitorInstance::ExternalAttributeRead(const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, + uint16_t maxReadLength) { Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Success; - AttributeId attributeId = attributeMetadata->attributeId; + AttributeId attributeId = attributeMetadata->attributeId; - switch (attributeId) { - case HepaFilterMonitoring::Attributes::Condition::Id: + switch (attributeId) { + case HepaFilterMonitoring::Attributes::Condition::Id: { *buffer = GetCondition(); } - break; - case HepaFilterMonitoring::Attributes::ChangeIndication::Id: - { + break; + case HepaFilterMonitoring::Attributes::ChangeIndication::Id: { ResourceMonitoring::ChangeIndicationEnum changeIndication = GetChangeIndication(); // The underlying type of ResourceMonitoring::ChangeIndicationEnum is uint8_t *buffer = to_underlying(changeIndication); } - break; - case HepaFilterMonitoring::Attributes::InPlaceIndicator::Id: - { - *(bool *)buffer = GetInPlaceIndicator(); + break; + case HepaFilterMonitoring::Attributes::InPlaceIndicator::Id: { + *(bool *) buffer = GetInPlaceIndicator(); } - break; - case HepaFilterMonitoring::Attributes::LastChangedTime::Id: - { + break; + case HepaFilterMonitoring::Attributes::LastChangedTime::Id: { DataModel::Nullable lastChangedTime = GetLastChangedTime(); - *(uint32_t *)buffer = lastChangedTime.IsNull() ? 0 : lastChangedTime.Value(); + *(uint32_t *) buffer = lastChangedTime.IsNull() ? 0 : lastChangedTime.Value(); } - break; + break; case HepaFilterMonitoring::Attributes::DegradationDirection::Id: default: ChipLogError(Zcl, "Unsupported External Attribute Read: %d", static_cast(attributeId)); - ret = Protocols::InteractionModel::Status::UnsupportedRead; + ret = Protocols::InteractionModel::Status::UnsupportedRead; break; } diff --git a/examples/chef/common/clusters/resource-monitoring/chef-resource-monitoring-delegates.h b/examples/chef/common/clusters/resource-monitoring/chef-resource-monitoring-delegates.h index 9c3e13efcf391a..2334be90b4ab3a 100644 --- a/examples/chef/common/clusters/resource-monitoring/chef-resource-monitoring-delegates.h +++ b/examples/chef/common/clusters/resource-monitoring/chef-resource-monitoring-delegates.h @@ -31,17 +31,18 @@ class ChefResourceMonitorInstance : public ResourceMonitoring::Instance { public: ChefResourceMonitorInstance(Delegate * aDelegate, EndpointId aEndpointId, ClusterId aClusterId, uint32_t aFeatureMap, - ResourceMonitoring::Attributes::DegradationDirection::TypeInfo::Type aDegradationDirection, - bool aResetConditionCommandSupported) : ResourceMonitoring::Instance(aDelegate, aEndpointId, aClusterId, aFeatureMap, - aDegradationDirection, aResetConditionCommandSupported) { }; - - chip::Protocols::InteractionModel::Status ExternalAttributeWrite(const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer); - chip::Protocols::InteractionModel::Status ExternalAttributeRead(const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, uint16_t maxReadLength); - + ResourceMonitoring::Attributes::DegradationDirection::TypeInfo::Type aDegradationDirection, + bool aResetConditionCommandSupported) : + ResourceMonitoring::Instance(aDelegate, aEndpointId, aClusterId, aFeatureMap, aDegradationDirection, + aResetConditionCommandSupported){}; + + chip::Protocols::InteractionModel::Status ExternalAttributeWrite(const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer); + chip::Protocols::InteractionModel::Status ExternalAttributeRead(const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength); }; -} // namespace ResourceMonitor - +} // namespace ResourceMonitoring namespace HepaFilterMonitoring { class HepaFilterMonitoringDelegate : public ResourceMonitoring::Delegate @@ -86,6 +87,11 @@ void Shutdown(); } // namespace app } // namespace chip -chip::Protocols::InteractionModel::Status chefResourceMonitoringExternalWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer); +chip::Protocols::InteractionModel::Status +chefResourceMonitoringExternalWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer); -chip::Protocols::InteractionModel::Status chefResourceMonitoringExternalReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, uint16_t maxReadLength); +chip::Protocols::InteractionModel::Status +chefResourceMonitoringExternalReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, + uint16_t maxReadLength); diff --git a/examples/chef/common/stubs.cpp b/examples/chef/common/stubs.cpp index 9887a0b412cb13..8771bf78dccaf5 100644 --- a/examples/chef/common/stubs.cpp +++ b/examples/chef/common/stubs.cpp @@ -18,12 +18,10 @@ defined(MATTER_DM_PLUGIN_RADON_CONCENTRATION_MEASUREMENT_SERVER) #include "chef-concentration-measurement.h" #endif -#if defined(MATTER_DM_PLUGIN_HEPA_FILTER_MONITORING_SERVER) || \ - defined(MATTER_DM_PLUGIN_ACTIVATED_CARBON_FILTER_MONITORING_SERVER) +#if defined(MATTER_DM_PLUGIN_HEPA_FILTER_MONITORING_SERVER) || defined(MATTER_DM_PLUGIN_ACTIVATED_CARBON_FILTER_MONITORING_SERVER) #include "resource-monitoring/chef-resource-monitoring-delegates.h" #endif - #if defined(MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER) || defined(MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER) #include "chef-rvc-mode-delegate.h" #endif @@ -70,8 +68,7 @@ Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(Endpoin case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id: return chefConcentrationMeasurementReadCallback(endpoint, clusterId, attributeMetadata, buffer, maxReadLength); #endif -#if defined(MATTER_DM_PLUGIN_HEPA_FILTER_MONITORING_SERVER) || \ - defined(MATTER_DM_PLUGIN_ACTIVATED_CARBON_FILTER_MONITORING_SERVER) +#if defined(MATTER_DM_PLUGIN_HEPA_FILTER_MONITORING_SERVER) || defined(MATTER_DM_PLUGIN_ACTIVATED_CARBON_FILTER_MONITORING_SERVER) case chip::app::Clusters::HepaFilterMonitoring::Id: case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id: return chefResourceMonitoringExternalReadCallback(endpoint, clusterId, attributeMetadata, buffer, maxReadLength); @@ -136,8 +133,7 @@ Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(Endpoi case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id: return chefConcentrationMeasurementWriteCallback(endpoint, clusterId, attributeMetadata, buffer); #endif -#if defined(MATTER_DM_PLUGIN_HEPA_FILTER_MONITORING_SERVER) || \ - defined(MATTER_DM_PLUGIN_ACTIVATED_CARBON_FILTER_MONITORING_SERVER) +#if defined(MATTER_DM_PLUGIN_HEPA_FILTER_MONITORING_SERVER) || defined(MATTER_DM_PLUGIN_ACTIVATED_CARBON_FILTER_MONITORING_SERVER) case chip::app::Clusters::HepaFilterMonitoring::Id: case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id: return chefResourceMonitoringExternalWriteCallback(endpoint, clusterId, attributeMetadata, buffer);