Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement 'ReadAttribute' inside the codegen-data-model IM/DM split #33877

Merged
merged 139 commits into from
Jun 28, 2024
Merged
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
30812a9
Initial copy with a clean history
andreilitvin May 7, 2024
53891f3
make linter happy
andreilitvin May 7, 2024
0947dd6
Restyle
andreilitvin May 7, 2024
5a2a108
Fix typo
andreilitvin May 7, 2024
223f275
Merge branch 'master' into imdm/2-ember-iterate
andreilitvin May 7, 2024
72a6146
Merge branch 'master' into imdm/2-ember-iterate
andy31415 May 8, 2024
26bb33b
Add nolint: assert will return before we use the underlying value
andy31415 May 8, 2024
4b55a20
2 more fixes regarding unchecked access
andy31415 May 8, 2024
d8b8433
Switch some asserts to expects, for better test logic
andy31415 May 8, 2024
21376d6
Start implementing a read ... wip while I switch to a few other tests
andy31415 May 8, 2024
9f5eff9
More implementation and we seem to need privilege check as well
andy31415 May 8, 2024
7b6f2eb
More mock ember functions implemented, to make it at least link for now
andy31415 May 8, 2024
06e5881
A bit of work on AAI support. Still need to split out global attribut…
andy31415 May 8, 2024
2bc8b27
Split out global AAI...for now
andy31415 May 8, 2024
8acf68c
Add global attribute access interface as part of ember data model def…
andy31415 May 8, 2024
2408818
Drop RequiredPrivilegeStubs ... those are odd and if you use mock emb…
andy31415 May 8, 2024
c43ae2a
Restyle
andy31415 May 8, 2024
ce42236
Added sufficient overrides for things to compile ... this is a MESS
andy31415 May 8, 2024
53ad556
Some more changes to compile
andy31415 May 8, 2024
09f1e9e
Things link now ... but boy do we have many workarounds...
andy31415 May 8, 2024
22417f3
Remove double return
andy31415 May 8, 2024
1a97cd4
Restyle
andy31415 May 8, 2024
0eea694
Full ember handling
andreilitvin May 9, 2024
fec8237
Comment updates and slight restyle
andreilitvin May 9, 2024
17637c7
remove commented out code
andreilitvin May 9, 2024
6db60e8
Remove read-state from arguments - attributevalueencoder maintains it…
andreilitvin May 9, 2024
55c0c2a
more comments and some logic cleanup on alternatives ... code should …
andreilitvin May 9, 2024
a536b84
clean one more comment that seemed odd
andreilitvin May 9, 2024
4006b1a
Fix off by one bug for long strin processing
andreilitvin May 9, 2024
c9663d6
More generics
andreilitvin May 9, 2024
688cda3
Split out io storage and type conversion as shared functions for embe…
andreilitvin May 9, 2024
3d4ccf1
Restyle
andreilitvin May 9, 2024
3ff8865
Added more comments
andreilitvin May 9, 2024
23f8d48
Fix lint errors ... these files are not in libraries since they depen…
andreilitvin May 9, 2024
682df96
Restyle
andreilitvin May 9, 2024
d905219
Fix the access denied error logic ... the translation to UnsupportedA…
andreilitvin May 9, 2024
55f042c
Shorter code is better
andreilitvin May 9, 2024
d609545
Some comments, cleaner code
andreilitvin May 9, 2024
6d40c81
Fix auto-include
andy31415 May 13, 2024
ed2894d
add some TODO because access control is needed
andy31415 May 13, 2024
27e106a
Model renames
andreilitvin May 14, 2024
5b73a1d
Add renamed files
andreilitvin May 14, 2024
9bf0f85
Add some attribute iteration hint
andreilitvin May 14, 2024
64f0db7
Make use of the attribute cache
andreilitvin May 14, 2024
777ee68
Restyle
andreilitvin May 14, 2024
851e0a4
Add a cluster iteration hint
andreilitvin May 14, 2024
5009d8e
Add a few more hints. Ember code still contains loops though, so this…
andreilitvin May 14, 2024
88e5bbc
Add some TODO items for using faster iterations for data. Ember index…
andreilitvin May 14, 2024
7672d22
Add a cluster type cache as well. This relies on ember being reasonab…
andreilitvin May 14, 2024
23a988d
Add global attribute handling
andreilitvin May 14, 2024
f4651fc
Fix typing u16 vs unsigned
andreilitvin May 14, 2024
e1df31b
Unit test preparation: make ACL pass and have an ACL test as well
andreilitvin May 14, 2024
b923fab
Some progress in testability. No mock reads, however at least some pr…
andreilitvin May 14, 2024
126300a
Make some unit tests pass with ember overrides
andreilitvin May 15, 2024
bb98ce8
Restyle
andreilitvin May 15, 2024
c2ee606
Attempt to decode data. It does NOT work yet
andy31415 May 15, 2024
4e86e6a
Validation actually passes
andy31415 May 15, 2024
e09fbe6
Start splitting into unrelated files ...this is painful
andy31415 May 15, 2024
a325e5e
Restyle
andy31415 May 15, 2024
3d50093
Better test namespacing - be consistent
andy31415 May 15, 2024
6f1c553
Re-organize a bit ... boilerplate still seems A LOT
andy31415 May 15, 2024
7533d78
Minor comments to start organizing the code better - I NEED more read…
andy31415 May 15, 2024
a797b5e
Restyle and re-organize for readability
andy31415 May 15, 2024
7aa3209
More code changes to support testing strings ... however this FAILS r…
andy31415 May 15, 2024
87d86d7
Restyle
andy31415 May 15, 2024
4cd9fa8
Fix a typo ... still broken though
andy31415 May 15, 2024
582b939
one more typo fix ... test passes
andy31415 May 15, 2024
b05881e
Long octet string test as well
andy31415 May 15, 2024
f16d17f
Restyle
andy31415 May 15, 2024
c76d197
Fix comment and change the size of the string
andy31415 May 15, 2024
4a78d26
Add several ember-specific tests
andy31415 May 16, 2024
320cecb
unit tests and working with nullable values
andy31415 May 16, 2024
2a17d02
Fix up the tests
andy31415 May 16, 2024
f55cdea
Restyle
andy31415 May 16, 2024
9185cc3
AAI unit test for read
andy31415 May 16, 2024
414d61e
Slight comment updates
andy31415 May 16, 2024
9c61ebb
Restyle
andy31415 May 16, 2024
5bb6772
Use StringBuilderAdapters to format chip_error nicely
andreilitvin May 17, 2024
684a431
Format
andreilitvin May 17, 2024
8324eb9
More unit tests for lists ... test overflow as well
andreilitvin May 17, 2024
58f86b7
Add test support for partially encoded lists
andreilitvin May 17, 2024
0191f5e
Merge branch 'imdm/2-ember-iterate' into imdm/3-ember-read-attribute
andreilitvin May 17, 2024
a373c38
add missing file
andreilitvin May 17, 2024
c1fc803
Merge branch 'master' into imdm/2-ember-iterate
andreilitvin May 17, 2024
55ba3ca
Merge branch 'imdm/2-ember-iterate' into imdm/3-ember-read-attribute
andreilitvin May 17, 2024
c2b4edc
Fix name shadowing
andreilitvin May 17, 2024
eba45ae
Fix auto-added include names
andreilitvin May 17, 2024
ae58110
Merge branch 'imdm/2-ember-iterate' into imdm/3-ember-read-attribute
andreilitvin May 17, 2024
98458eb
Test global attribute read via AAI
andreilitvin May 17, 2024
2afa9fa
More unit test coverage
andreilitvin May 17, 2024
285c4b0
Test nullable string reads
andreilitvin May 17, 2024
8a33193
One more test for error pahs
andreilitvin May 17, 2024
38c5759
More failure cases on failure path
andreilitvin May 17, 2024
7befbcd
Restyle
andreilitvin May 17, 2024
c34e10f
Merge branch 'master' into imdm/2-ember-iterate
andreilitvin May 21, 2024
22e9df0
Remove back the initialization and make the comment more obvious
andreilitvin May 21, 2024
63a7685
Merge branch 'master' into imdm/2-ember-iterate
andy31415 May 22, 2024
c5faeaa
Merge branch 'imdm/2-ember-iterate' into imdm/3-ember-read-attribute
andy31415 May 22, 2024
48f2fe8
Undo odd include that got auto-added
andy31415 May 22, 2024
8a5cbe7
Merge branch 'master' into imdm/3-ember-read-attribute
andy31415 Jun 12, 2024
60ed0be
Place files back past renames
andy31415 Jun 12, 2024
e9347f9
A bit more renaming
andy31415 Jun 12, 2024
a2b7ae5
Fix includes
andy31415 Jun 12, 2024
6dab6ba
More updates to the latest code
andy31415 Jun 12, 2024
97a5417
Fix unit test merging
andy31415 Jun 12, 2024
e2ec97d
Resolve data model ambiguity
andy31415 Jun 12, 2024
ecf3fc0
Restyle
andy31415 Jun 12, 2024
cbbdba5
Do not try to compile ember tests on zephyr as it is not compatible w…
andy31415 Jun 12, 2024
a55ccfc
Update placement and comment for including codegen test into one larg…
andy31415 Jun 12, 2024
2db453e
Restyle
andy31415 Jun 12, 2024
53ca74b
Add static cast for ember calls for span sizes ... we know we are les…
andy31415 Jun 12, 2024
660789f
Fix clang-tidy error report
andreilitvin Jun 13, 2024
4eede5a
Restyle
andreilitvin Jun 13, 2024
39cc446
Do not try to translate UnsupportedRead
andreilitvin Jun 13, 2024
a2249a6
Typo fixes
andreilitvin Jun 13, 2024
819df5d
Code review feedback: correct the return code for global attribute mi…
andy31415 Jun 14, 2024
ff01c99
Some spelling updates and format
andy31415 Jun 14, 2024
7eb0588
ChipDie if internal logic for read fails
andy31415 Jun 14, 2024
51a20bb
Fix typo
andy31415 Jun 14, 2024
adbb76b
Add unit test for invalid global attribute read
andy31415 Jun 14, 2024
f2ed12e
Merge branch 'master' into imdm/3-ember-read-attribute
andreilitvin Jun 17, 2024
9394cd6
Code review feedback: comment about internal flags and implement path…
andreilitvin Jun 17, 2024
aaeafb0
Merge branch 'imdm/3-ember-read-attribute' of github.com:andy31415/co…
andreilitvin Jun 17, 2024
39b4b11
Restyle and unit test for expansion
andreilitvin Jun 17, 2024
ea8356f
Another unit test for AAI this time for unsupported read
andreilitvin Jun 17, 2024
be0270f
Restyle
andreilitvin Jun 17, 2024
dd1ffc7
Merge branch 'master' into imdm/3-ember-read-attribute
andreilitvin Jun 17, 2024
36f866b
Update src/app/codegen-data-model/tests/TestAttributeReportIBsEncodin…
andy31415 Jun 21, 2024
6f4f4c7
Merge branch 'master' into imdm/3-ember-read-attribute
andy31415 Jun 21, 2024
ddc9460
Rename files to not have a Test prefix when not containing tests
andy31415 Jun 21, 2024
8aa4ea8
Merge branch 'master' into imdm/3-ember-read-attribute
andy31415 Jun 28, 2024
6ed59f1
Add comment as per review comment
andy31415 Jun 28, 2024
cdac2ac
Use macros for error returns
andy31415 Jun 28, 2024
da6b870
Fix typo
andy31415 Jun 28, 2024
4ef4438
Add a macro for dynamic global IM status codes in chip_error
andy31415 Jun 28, 2024
6308bdb
Reference issue in comment
andy31415 Jun 28, 2024
cbd5c95
Merge branch 'master' into imdm/3-ember-read-attribute
andy31415 Jun 28, 2024
810cc06
Fix comment a bit
andy31415 Jun 28, 2024
c4e4aa7
Undo module updates ... this time for real
andy31415 Jun 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/chef/chef.py
Original file line number Diff line number Diff line change
@@ -878,7 +878,7 @@ def main() -> int:
"""))
if options.do_clean:
shell.run_cmd("rm -rf out")
shell.run_cmd("gn gen out")
shell.run_cmd("gn gen --export-compile-commands out")
shell.run_cmd("ninja -C out")

#
9 changes: 8 additions & 1 deletion src/BUILD.gn
Original file line number Diff line number Diff line change
@@ -50,7 +50,6 @@ if (chip_build_tests) {
chip_test_group("tests") {
deps = []
tests = [
"${chip_root}/src/app/codegen-data-model/tests",
"${chip_root}/src/app/data-model-interface/tests",
"${chip_root}/src/access/tests",
"${chip_root}/src/crypto/tests",
@@ -82,7 +81,15 @@ if (chip_build_tests) {

if (current_os != "zephyr" && current_os != "mbed" &&
chip_device_platform != "efr32") {
# Avoid these items from "one single binary" test executions. Once tests
# are split, we can re-visit this (and likely many others)
#
# In particular:
# "app/codegen-data-model/tests" contains symbols for ember mocks which
# are used by other tests

tests += [
"${chip_root}/src/app/codegen-data-model/tests",
"${chip_root}/src/setup_payload/tests",
"${chip_root}/src/transport/raw/tests",
]
1 change: 1 addition & 0 deletions src/app/codegen-data-model/BUILD.gn
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ import("//build_overrides/chip.gni")
#
# Use `model.gni` to get access to:
# CodegenDataModel.cpp
# CodegenDataModel_Read.cpp
# CodegenDataModel.h
#
# The above list of files exists to satisfy the "dependency linter"
7 changes: 0 additions & 7 deletions src/app/codegen-data-model/CodegenDataModel.cpp
Original file line number Diff line number Diff line change
@@ -231,13 +231,6 @@ bool CodegenDataModel::EmberCommandListIterator::Exists(const CommandId * list,
return (*mCurrentHint == toCheck);
}

CHIP_ERROR CodegenDataModel::ReadAttribute(const InteractionModel::ReadAttributeRequest & request,
InteractionModel::ReadState & state, AttributeValueEncoder & encoder)
{
// TODO: this needs an implementation
return CHIP_ERROR_NOT_IMPLEMENTED;
}

CHIP_ERROR CodegenDataModel::WriteAttribute(const InteractionModel::WriteAttributeRequest & request,
AttributeValueDecoder & decoder)
{
3 changes: 1 addition & 2 deletions src/app/codegen-data-model/CodegenDataModel.h
Original file line number Diff line number Diff line change
@@ -68,8 +68,7 @@ class CodegenDataModel : public chip::app::InteractionModel::DataModel
/// Generic model implementations
CHIP_ERROR Shutdown() override { return CHIP_NO_ERROR; }

CHIP_ERROR ReadAttribute(const InteractionModel::ReadAttributeRequest & request, InteractionModel::ReadState & state,
AttributeValueEncoder & encoder) override;
CHIP_ERROR ReadAttribute(const InteractionModel::ReadAttributeRequest & request, AttributeValueEncoder & encoder) override;
CHIP_ERROR WriteAttribute(const InteractionModel::WriteAttributeRequest & request, AttributeValueDecoder & decoder) override;
CHIP_ERROR Invoke(const InteractionModel::InvokeRequest & request, chip::TLV::TLVReader & input_arguments,
InteractionModel::InvokeReply & reply) override;
Loading
Loading