-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Introduce the CodeDrivenDataModelProvider #39974
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
Introduce the CodeDrivenDataModelProvider #39974
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces the CodeDrivenDataModelProvider
, enabling a code-based approach to define data models within the Matter SDK. The code includes unit tests and overall looks good.
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.cpp
Outdated
Show resolved
Hide resolved
PR #39974: Size comparison from 48704fe to 82a694c Full report (32 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, psoc6, qpg, stm32, telink, tizen)
|
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.h
Outdated
Show resolved
Hide resolved
PR #39974: Size comparison from 48704fe to 0c0e641 Full report (56 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, linux, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #39974: Size comparison from 48704fe to 0129dfb Full report (8 builds for telink)
|
PR #39974: Size comparison from e831a33 to ee489fd Full report (59 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.cpp
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.cpp
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.cpp
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.cpp
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.cpp
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.h
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.h
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.h
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/tests/TestCodeDrivenDataModelProvider.cpp
Outdated
Show resolved
Hide resolved
…r.cpp rename endpointProvider to endpoint Co-authored-by: Boris Zbarsky <[email protected]>
Co-authored-by: Boris Zbarsky <[email protected]>
Co-authored-by: Boris Zbarsky <[email protected]>
… implementation" Co-authored-by: Boris Zbarsky <[email protected]>
…implementation */" Co-authored-by: Boris Zbarsky <[email protected]>
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.cpp
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.cpp
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.h
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.h
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.h
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/endpoint/EndpointInterfaceRegistry.h
Outdated
Show resolved
Hide resolved
Co-authored-by: Boris Zbarsky <[email protected]>
…ntRegistration; Move Get methods to private
…verify the new behavior
PR #39974: Size comparison from 180c8ae to 1234a92 Full report (55 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #39974: Size comparison from b3764e8 to 9dc82bb Full report (57 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #39974: Size comparison from b3764e8 to d9f86c5 Full report (57 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.cpp
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.h
Outdated
Show resolved
Hide resolved
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.h
Outdated
Show resolved
Hide resolved
PR #39974: Size comparison from 233d3f7 to e9d2eb0 Full report (27 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, nrfconnect, psoc6, qpg, telink)
|
PR #39974: Size comparison from 233d3f7 to 5f4a4df Full report (37 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
|
src/data-model-providers/codedriven/CodeDrivenDataModelProvider.h
Outdated
Show resolved
Hide resolved
Co-authored-by: Boris Zbarsky <[email protected]>
Summary
This Pull Request (PR) introduces the
CodeDrivenDataModelProvider
, enabling a code-based approach to define data models within the Matter SDK.The
CodeDrivenDataModelProvider
operates over endpoints and server clusters. It uses anEndpointInterfaceRegistry
to manageEndpointInterface
instances and aServerClusterInterfaceRegistry
to manage server clusters. EachEndpointInterface
, such as theSpanEndpoint
, can be configured in code to define its device types, semantic tags, and client clusters. This approach contrasts with the existing more static, codegen-based (zap) approach.The
EndpointInterface
,EndpointInterfaceRegistry
andSpanEndpoint
were introduced earlier in pull/39396 and pull/39751 and they provide the basic mechanisms where applications can define its Data Model by organizing them by endpoints and adding to the CodeDrivenDataModelProvider.To build a real application that's fully code-based/dynamic, we need all of the cluster implementations to be code-driven and implement the
ServerClusterInterface
. The conversion work is ongoing in parallel. Meanwhile, while this work is not finished, we've introduced in pull/39393 theServerClusterShim
which offers a way to wrap ember/codegen-based clusters under theServerClusterInterface
so they can be used with theCodeDrivenDataModelProvider
.The following diagram describes how all these components are related to each other:
Testing
A comprehensive set of unit tests has been added. To test the
CodeDrivenDataModelProvider
, run:ninja -C out src/data-model-providers/codedriven/tests:TestCodeDrivenDataModelProvider && ./out/tests/TestCodeDrivenDataModelProvider
Also, updates to endpoint code can be tested with:
ninja -C out src/data-model-providers/codedriven/endpoint/tests:TestEndpointInterfaceRegistry && ./out/tests/TestEndpointInterfaceRegistry
ninja -C out src/data-model-providers/codedriven/endpoint/tests:TestSpanEndpoint && ./out/tests/TestSpanEndpoint