From 4513833c35fdeb869c9435e5a92aca76096cd6a7 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Fri, 2 Aug 2024 19:57:00 -0400 Subject: [PATCH] Migrate Ecosystem Information Cluster to use global structs (#34744) * Migrate Ecosystem Information Cluster to use global structs * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../ecosystem-information-server.cpp | 8 +++++--- .../ecosystem-information-server.h | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/app/clusters/ecosystem-information-server/ecosystem-information-server.cpp b/src/app/clusters/ecosystem-information-server/ecosystem-information-server.cpp index 26f1c96cd65fa6..4d7f7b8ddf754e 100644 --- a/src/app/clusters/ecosystem-information-server/ecosystem-information-server.cpp +++ b/src/app/clusters/ecosystem-information-server/ecosystem-information-server.cpp @@ -66,9 +66,10 @@ CHIP_ERROR AttrAccess::Read(const ConcreteReadAttributePath & aPath, AttributeVa // TODO(#33223) To improve safety we could make GetEncodableLocationDescriptorStruct a private // memeber method where we explicitly delete member method for the parameter that matches // (LocationDescriptorStruct && aLocationDescriptor). -Structs::LocationDescriptorStruct::Type GetEncodableLocationDescriptorStruct(const LocationDescriptorStruct & aLocationDescriptor) +Globals::Structs::LocationDescriptorStruct::Type +GetEncodableLocationDescriptorStruct(const LocationDescriptorStruct & aLocationDescriptor) { - Structs::LocationDescriptorStruct::Type locationDescriptor; + Globals::Structs::LocationDescriptorStruct::Type locationDescriptor; // This would imply data is either not properly validated before being // stored here or corruption has occurred. VerifyOrDie(!aLocationDescriptor.mLocationName.empty()); @@ -199,7 +200,8 @@ EcosystemLocationStruct::Builder & EcosystemLocationStruct::Builder::SetFloorNum return *this; } -EcosystemLocationStruct::Builder & EcosystemLocationStruct::Builder::SetAreaTypeTag(std::optional aAreaTypeTag) +EcosystemLocationStruct::Builder & +EcosystemLocationStruct::Builder::SetAreaTypeTag(std::optional aAreaTypeTag) { VerifyOrDie(!mIsAlreadyBuilt); mLocationDescriptor.mAreaType = aAreaTypeTag; diff --git a/src/app/clusters/ecosystem-information-server/ecosystem-information-server.h b/src/app/clusters/ecosystem-information-server/ecosystem-information-server.h index f8407861992d3c..58c64262166403 100644 --- a/src/app/clusters/ecosystem-information-server/ecosystem-information-server.h +++ b/src/app/clusters/ecosystem-information-server/ecosystem-information-server.h @@ -96,7 +96,7 @@ struct LocationDescriptorStruct { std::string mLocationName; std::optional mFloorNumber; - std::optional mAreaType; + std::optional mAreaType; }; // This intentionally mirrors Structs::EcosystemLocationStruct::Type but has ownership @@ -111,7 +111,7 @@ class EcosystemLocationStruct Builder & SetLocationName(std::string aLocationName); Builder & SetFloorNumber(std::optional aFloorNumber); - Builder & SetAreaTypeTag(std::optional aAreaTypeTag); + Builder & SetAreaTypeTag(std::optional aAreaTypeTag); Builder & SetLocationDescriptorLastEdit(uint64_t aLocationDescriptorLastEditEpochUs); // Upon success this object will have moved all ownership of underlying