Skip to content

Commit 71aed77

Browse files
soares-sergiorestyled-commitsbzbarsky-apple
authored
Introduce the CodeDrivenDataModelProvider (project-chip#39974)
* Add the CodeDrivenDataModelProvider with Unit Tests * Restyled by clang-format * Fix unused variable * Attempt to fix clang-tidy error * Restyled by clang-format * Removed SetPersistentStorageDelegate and moved it to ctor * Remove unit tests from building for efr32, failing in CI * Restyled by clang-format * Move codedriven/tests to the right place in BUILD.gn * Update src/data-model-providers/codedriven/CodeDrivenDataModelProvider.cpp rename endpointProvider to endpoint Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * More endpointProvider -> endpoint renames * Update comment "using code" -> "dynamically at runtime" Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update comment about "outlive their registration." Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update comment on CodeDrivenDataModelProvider.h "ProviderMetadataTree implementation" Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Add comment on CodeDrivenDataModelProvider.h "/* DataModel::Provider implementation */" Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Log all cluster paths on startup failure * Fix comment about EndpointProvider * Review suggestion: Removed outStatus from GetServerCluster * Fix ServerClusters(EndpointId) to return correct clusters; add unit test * Moved clusters to data model provider * renamed GetServerCluster to GetServerClusterInterface for consistency * Added endpoint ID assignment logic * removed GetServerCluster and ServerClusters from the EndpointInterface and SpanEndpoint * Added more unit tests for everything that was changed. * Restyled by whitespace * Restyled by clang-format * Remove cluster on shutdown * removed unused iterator * Update code to return CHIP_ERROR_KEY_NOT_FOUND instead of Status::Failure * Update UnsupportedEndpoint error code; check for EndpointID validity in ServerClusters() * Minor nit from code review * nit from code review: use std::max * Addressed latest round of review suggestions from Andrei; Removed endpoint id from SpanEndpoint; Removed mNextAvailableEndpointId; Removed validation for paths/endpoints; Renamed variables from epProvider to endpoint; Fixed comments and added TODO about markDirty() * Restyled by whitespace * Restyled by clang-format * Make PersistentStorageDelegate a reference instead of a pointer * Attempt to make clang tidy happy * Apply Boris' NITs from code review Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update SpanEndpoint to get const refs; remove default arg from EndpointRegistration; Move Get methods to private * Fixed ordering of clusters/endpoints; added more checks and tests to verify the new behavior * fix CI coverage failure * Restyled by whitespace * Restyled by clang-format * Fix merge issues with master; Updated serverClsuterContext to references; store the interactionContext * Fix one more conflict with master * Reuse LogOnlyEvents * Restyled by clang-format * make clang tidy happy * Start clusters on first endpoint added * Update src/data-model-providers/codedriven/CodeDrivenDataModelProvider.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Restyled by whitespace --------- Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent e086a20 commit 71aed77

13 files changed

Lines changed: 1912 additions & 687 deletions

src/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ if (chip_build_tests) {
123123
# with ember
124124
# Disabled on EFR32 since "include <random>" fails with `::fabs` not defined
125125
tests += [
126+
"${chip_root}/src/data-model-providers/codedriven/tests",
126127
"${chip_root}/src/data-model-providers/codegen/tests",
127128
"${chip_root}/examples/common/server-cluster-shim/tests",
128129
]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) 2025 Project CHIP Authors
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
import("//build_overrides/chip.gni")
15+
import("//build_overrides/pigweed.gni")
16+
source_set("codedriven") {
17+
sources = [
18+
"CodeDrivenDataModelProvider.cpp",
19+
"CodeDrivenDataModelProvider.h",
20+
]
21+
22+
public_deps = [
23+
"${chip_root}/src/app:paths",
24+
"${chip_root}/src/app/server-cluster",
25+
"${chip_root}/src/app/server-cluster:registry",
26+
"${chip_root}/src/data-model-providers/codedriven/endpoint",
27+
"${chip_root}/src/lib/core:types",
28+
"${chip_root}/src/lib/support",
29+
]
30+
}

0 commit comments

Comments
 (0)