From f25331f972bb1806f0031f1f1f06d4c97850040f Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 10 Apr 2024 10:50:30 -0400 Subject: [PATCH] Fix up mock ember implementation: - provide data version function as described by attribute-storage.h - fix self-referencing structure copying for mock node configurations --- src/app/util/mock/MockNodeConfig.cpp | 7 +++++++ src/app/util/mock/MockNodeConfig.h | 4 ++++ src/app/util/mock/attribute-storage.cpp | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/src/app/util/mock/MockNodeConfig.cpp b/src/app/util/mock/MockNodeConfig.cpp index b4f6b1d27cfc5c..e7c04fa546e5c9 100644 --- a/src/app/util/mock/MockNodeConfig.cpp +++ b/src/app/util/mock/MockNodeConfig.cpp @@ -91,6 +91,13 @@ MockEndpointConfig::MockEndpointConfig(EndpointId aId, std::initializer_list aClusters = {}); + // Cluster-config is self-referntial: mEmberCluster.clusters references mEmberClusters + MockEndpointConfig(const MockEndpointConfig & other); + MockEndpointConfig & operator=(const MockEndpointConfig &) = delete; + const MockClusterConfig * clusterById(ClusterId clusterId, ptrdiff_t * outIndex = nullptr) const; const EmberAfEndpointType * emberEndpoint() const { return &mEmberEndpoint; } diff --git a/src/app/util/mock/attribute-storage.cpp b/src/app/util/mock/attribute-storage.cpp index d308316dd8fee5..6aa872956dbe7a 100644 --- a/src/app/util/mock/attribute-storage.cpp +++ b/src/app/util/mock/attribute-storage.cpp @@ -258,6 +258,12 @@ const EmberAfCluster * emberAfFindServerCluster(EndpointId endpointId, ClusterId return cluster->emberCluster(); } +DataVersion * emberAfDataVersionStorage(const chip::app::ConcreteClusterPath & aConcreteClusterPath) +{ + // shared data version storage + return &dataVersion; +} + namespace chip { namespace app {