Skip to content

Commit

Permalink
cluster model decoupling - declare the codegen (ember) version and im…
Browse files Browse the repository at this point in the history
…plement 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>
  • Loading branch information
5 people committed Jun 10, 2024
1 parent e1b5fbe commit 47097e0
Show file tree
Hide file tree
Showing 18 changed files with 1,499 additions and 115 deletions.
1 change: 1 addition & 0 deletions src/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ if (chip_build_tests) {
chip_test_group("tests") {
deps = []
tests = [
"${chip_root}/src/app/codegen-interaction-model/tests",
"${chip_root}/src/app/interaction-model/tests",
"${chip_root}/src/access/tests",
"${chip_root}/src/crypto/tests",
Expand Down
2 changes: 1 addition & 1 deletion src/app/ConcreteClusterPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct ConcreteClusterPath
// to alignment requirements it's "free" in the sense of not needing more
// memory to put it here. But we don't initialize it, because that
// increases codesize for the non-consumers.
bool mExpanded; // NOTE: in between larger members
bool mExpanded; // NOTE: in between larger members, NOT initialized (see above)
ClusterId mClusterId = 0;
};

Expand Down
27 changes: 27 additions & 0 deletions src/app/codegen-interaction-model/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (c) 2024 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build_overrides/chip.gni")
# This source set is TIGHLY coupled with code-generated data models
# as generally implemented by `src/app/util`
#
# Corresponding functions defined in attribute-storace.cpp/attribute-table.cpp must
# be available at link time for this model to use
#
# Use `model.gni` to get access to:
# CodegenDataModel.cpp
# CodegenDataModel.h
#
# The above list of files exists to satisfy the "dependency linter"
# since those files should technically be "visible to gn" even though we
# are supposed to go through model.gni constants
Loading

0 comments on commit 47097e0

Please sign in to comment.