Skip to content

Commit

Permalink
Remove the ember metadata public cluster path validation as it is not…
Browse files Browse the repository at this point in the history
… needed anymore as a public API
  • Loading branch information
andy31415 committed Feb 3, 2025
1 parent 0e22237 commit 4b4d018
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 29 deletions.
29 changes: 8 additions & 21 deletions src/data-model-providers/codegen/EmberMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ FindAttributeMetadata(const ConcreteAttributePath & aPath)

if (metadata == nullptr)
{
Status status = ValidateClusterPath(aPath);
const EmberAfEndpointType * type = emberAfFindEndpointType(aPath.mEndpointId);
if (type == nullptr)
{
return Status::UnsupportedEndpoint;
}

if (status != Status::Success)
const EmberAfCluster * cluster = emberAfFindClusterInType(type, aPath.mClusterId, CLUSTER_MASK_SERVER);
if (cluster == nullptr)
{
return status;
return Status::UnsupportedCluster;
}

// Since we know the attribute is unsupported and the endpoint/cluster are
Expand All @@ -51,24 +56,6 @@ FindAttributeMetadata(const ConcreteAttributePath & aPath)
return metadata;
}

Status ValidateClusterPath(const ConcreteClusterPath & path)
{

const EmberAfEndpointType * type = emberAfFindEndpointType(path.mEndpointId);
if (type == nullptr)
{
return Status::UnsupportedEndpoint;
}

const EmberAfCluster * cluster = emberAfFindClusterInType(type, path.mClusterId, CLUSTER_MASK_SERVER);
if (cluster == nullptr)
{
return Status::UnsupportedCluster;
}

return Status::Success;
}

} // namespace Ember
} // namespace app
} // namespace chip
8 changes: 0 additions & 8 deletions src/data-model-providers/codegen/EmberMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ std::variant<const EmberAfAttributeMetadata *, // a specific attribute stored
>
FindAttributeMetadata(const ConcreteAttributePath & aPath);

/// Returns the status for a given cluster existing in the ember metadata.
///
/// Return code will be one of:
/// - Status::UnsupportedEndpoint if the path endpoint does not exist
/// - Status::UnsupportedCluster if the cluster does not exist on the given endpoint
/// - Status::Success if the cluster exists in the ember metadata.
Protocols::InteractionModel::Status ValidateClusterPath(const ConcreteClusterPath & path);

} // namespace Ember
} // namespace app
} // namespace chip

0 comments on commit 4b4d018

Please sign in to comment.