Skip to content

Commit

Permalink
Migrate Ecosystem Information Cluster to use global structs (#34744)
Browse files Browse the repository at this point in the history
* Migrate Ecosystem Information Cluster to use global structs

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Oct 17, 2024
1 parent 907d293 commit 4513833
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -199,7 +200,8 @@ EcosystemLocationStruct::Builder & EcosystemLocationStruct::Builder::SetFloorNum
return *this;
}

EcosystemLocationStruct::Builder & EcosystemLocationStruct::Builder::SetAreaTypeTag(std::optional<AreaTypeTag> aAreaTypeTag)
EcosystemLocationStruct::Builder &
EcosystemLocationStruct::Builder::SetAreaTypeTag(std::optional<Globals::AreaTypeTag> aAreaTypeTag)
{
VerifyOrDie(!mIsAlreadyBuilt);
mLocationDescriptor.mAreaType = aAreaTypeTag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct LocationDescriptorStruct
{
std::string mLocationName;
std::optional<int16_t> mFloorNumber;
std::optional<AreaTypeTag> mAreaType;
std::optional<Globals::AreaTypeTag> mAreaType;
};

// This intentionally mirrors Structs::EcosystemLocationStruct::Type but has ownership
Expand All @@ -111,7 +111,7 @@ class EcosystemLocationStruct

Builder & SetLocationName(std::string aLocationName);
Builder & SetFloorNumber(std::optional<int16_t> aFloorNumber);
Builder & SetAreaTypeTag(std::optional<AreaTypeTag> aAreaTypeTag);
Builder & SetAreaTypeTag(std::optional<Globals::AreaTypeTag> aAreaTypeTag);
Builder & SetLocationDescriptorLastEdit(uint64_t aLocationDescriptorLastEditEpochUs);

// Upon success this object will have moved all ownership of underlying
Expand Down

0 comments on commit 4513833

Please sign in to comment.