Skip to content

Commit 47097e0

Browse files
andy31415andreilitvinksperling-applebzbarsky-appletcarmelveilleux
authored
cluster model decoupling - declare the codegen (ember) version and implement iteration (#33345)
* Initial copy with a clean history * make linter happy * Restyle * Fix typo * Add nolint: assert will return before we use the underlying value * 2 more fixes regarding unchecked access * Switch some asserts to expects, for better test logic * Model renames * Add renamed files * Add some attribute iteration hint * Make use of the attribute cache * Restyle * Add a cluster iteration hint * Add a few more hints. Ember code still contains loops though, so this may not be ideal still * Add some TODO items for using faster iterations for data. Ember index vs value duality still needs some work * Add a cluster type cache as well. This relies on ember being reasonably static * Add global attribute handling * Fix typing u16 vs unsigned * Fix auto-added include names * Remove back the initialization and make the comment more obvious * Update src/app/codegen-interaction-model/model.gni Co-authored-by: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> * Code review feedback: added comments * Update src/app/codegen-interaction-model/CodegenDataModel.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/codegen-interaction-model/CodegenDataModel.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/codegen-interaction-model/BUILD.gn Co-authored-by: Tennessee Carmel-Veilleux <tennessee.carmelveilleux@gmail.com> * Some cleanup logic for event generation - naming and return values as eventid is not the same as event number * Comment fix * More naming updates * Several comment updates and renamed RequestContext to ActionContext * Restyle * Rename to InteractionModelContext * one more rename * Fix typo * Fix tests to compile * More renames of actions to context * One more comment added * Restyle * Address review comments * Restyle * make clang-tidy happy * Operator== exists on optional ... make use of that directly * Started renaming things * Use the right types in Model.h * Make things compile * Skip global attribute handling, add TODOs for reading extra bits from ember * Typo fix * Several flags and correct loading of privileges for attributes * Start implementing command iteration ... still feels awkward and caching will be a pain * We seem to also support fabric scoping detection * implementation is in theory done, need unit tests * Fix iterator name * Mock support for accepted/generated commands, start having unit tests * Better iteration tests on accepted commands * More unit tests and fix bugs * Restyle * More tests, one iteration bug fix * Slight update again * Aiming for more test coverage * More test coverage for edge cases in iteration * Fix code review comment * Restyle * Update src/app/interaction-model/Events.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/interaction-model/IterationTypes.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/interaction-model/Paths.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Fix comment about validity * Some kListBegin/End comment updates * Drop kListBegin/End alltogether * Drop groupId * Comment update * Update for data version to be mandatory, add more error reporting and logging * Update to use kInvalid instead of Invalid method * Update flags.set * Use IsServerMask on clusterr class * Use a struct instead of a typedef * Fix compile without error logging * Restyle * Remove command quality that is not supported * Restyle * Rename IsServerMask to IsServer --------- Co-authored-by: Andrei Litvin <andreilitvin@google.com> Co-authored-by: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> Co-authored-by: Tennessee Carmel-Veilleux <tennessee.carmelveilleux@gmail.com>
1 parent e1b5fbe commit 47097e0

18 files changed

+1499
-115
lines changed

src/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ if (chip_build_tests) {
5555
chip_test_group("tests") {
5656
deps = []
5757
tests = [
58+
"${chip_root}/src/app/codegen-interaction-model/tests",
5859
"${chip_root}/src/app/interaction-model/tests",
5960
"${chip_root}/src/access/tests",
6061
"${chip_root}/src/crypto/tests",

src/app/ConcreteClusterPath.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct ConcreteClusterPath
5252
// to alignment requirements it's "free" in the sense of not needing more
5353
// memory to put it here. But we don't initialize it, because that
5454
// increases codesize for the non-consumers.
55-
bool mExpanded; // NOTE: in between larger members
55+
bool mExpanded; // NOTE: in between larger members, NOT initialized (see above)
5656
ClusterId mClusterId = 0;
5757
};
5858

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (c) 2024 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+
# This source set is TIGHLY coupled with code-generated data models
16+
# as generally implemented by `src/app/util`
17+
#
18+
# Corresponding functions defined in attribute-storace.cpp/attribute-table.cpp must
19+
# be available at link time for this model to use
20+
#
21+
# Use `model.gni` to get access to:
22+
# CodegenDataModel.cpp
23+
# CodegenDataModel.h
24+
#
25+
# The above list of files exists to satisfy the "dependency linter"
26+
# since those files should technically be "visible to gn" even though we
27+
# are supposed to go through model.gni constants

0 commit comments

Comments
 (0)