diff --git a/src/BUILD.gn b/src/BUILD.gn index 0c7597b11d94db..c6c8fa9b5e2d81 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -55,8 +55,8 @@ 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/app/codegen-data-model/tests", + "${chip_root}/src/app/data-model-interface/tests", "${chip_root}/src/access/tests", "${chip_root}/src/crypto/tests", "${chip_root}/src/inet/tests", diff --git a/src/app/codegen-interaction-model/BUILD.gn b/src/app/codegen-data-model/BUILD.gn similarity index 100% rename from src/app/codegen-interaction-model/BUILD.gn rename to src/app/codegen-data-model/BUILD.gn diff --git a/src/app/codegen-interaction-model/CodegenDataModel.cpp b/src/app/codegen-data-model/CodegenDataModel.cpp similarity index 99% rename from src/app/codegen-interaction-model/CodegenDataModel.cpp rename to src/app/codegen-data-model/CodegenDataModel.cpp index f917a8e9c9c4b0..e1597dbdc4f8b4 100644 --- a/src/app/codegen-interaction-model/CodegenDataModel.cpp +++ b/src/app/codegen-data-model/CodegenDataModel.cpp @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include +#include #include #include diff --git a/src/app/codegen-interaction-model/CodegenDataModel.h b/src/app/codegen-data-model/CodegenDataModel.h similarity index 98% rename from src/app/codegen-interaction-model/CodegenDataModel.h rename to src/app/codegen-data-model/CodegenDataModel.h index 43117fa48d2312..f8d997451bdace 100644 --- a/src/app/codegen-interaction-model/CodegenDataModel.h +++ b/src/app/codegen-data-model/CodegenDataModel.h @@ -16,7 +16,7 @@ */ #pragma once -#include +#include #include @@ -35,7 +35,7 @@ namespace app { /// Given that this relies on global data at link time, there generally can be /// only one CodegenDataModel per application (you can create more instances, /// however they would share the exact same underlying data and storage). -class CodegenDataModel : public chip::app::InteractionModel::Model +class CodegenDataModel : public chip::app::InteractionModel::DataModel { private: /// Ember commands are stored as a `CommandId *` pointer that is either null (i.e. no commands) diff --git a/src/app/codegen-interaction-model/model.gni b/src/app/codegen-data-model/model.gni similarity index 87% rename from src/app/codegen-interaction-model/model.gni rename to src/app/codegen-data-model/model.gni index d1c4e85b90b433..c8dce5617b9a7b 100644 --- a/src/app/codegen-interaction-model/model.gni +++ b/src/app/codegen-data-model/model.gni @@ -25,11 +25,11 @@ import("//build_overrides/chip.gni") # be cleanly built as a stand-alone and instead have to be imported as part of # a different data model or compilation unit. codegen_interaction_model_SOURCES = [ - "${chip_root}/src/app/codegen-interaction-model/CodegenDataModel.h", - "${chip_root}/src/app/codegen-interaction-model/CodegenDataModel.cpp", + "${chip_root}/src/app/codegen-data-model/CodegenDataModel.h", + "${chip_root}/src/app/codegen-data-model/CodegenDataModel.cpp", ] codegen_interaction_model_PUBLIC_DEPS = [ "${chip_root}/src/app/common:attribute-type", - "${chip_root}/src/app/interaction-model", + "${chip_root}/src/app/data-model-interface", ] diff --git a/src/app/codegen-interaction-model/tests/BUILD.gn b/src/app/codegen-data-model/tests/BUILD.gn similarity index 94% rename from src/app/codegen-interaction-model/tests/BUILD.gn rename to src/app/codegen-data-model/tests/BUILD.gn index f543bc8d0cc24b..a3857184c25b74 100644 --- a/src/app/codegen-interaction-model/tests/BUILD.gn +++ b/src/app/codegen-data-model/tests/BUILD.gn @@ -13,7 +13,7 @@ # limitations under the License. import("//build_overrides/chip.gni") import("${chip_root}/build/chip/chip_test_suite.gni") -import("${chip_root}/src/app/codegen-interaction-model/model.gni") +import("${chip_root}/src/app/codegen-data-model/model.gni") source_set("mock_model") { sources = codegen_interaction_model_SOURCES diff --git a/src/app/codegen-interaction-model/tests/TestCodegenModelViaMocks.cpp b/src/app/codegen-data-model/tests/TestCodegenModelViaMocks.cpp similarity index 99% rename from src/app/codegen-interaction-model/tests/TestCodegenModelViaMocks.cpp rename to src/app/codegen-data-model/tests/TestCodegenModelViaMocks.cpp index e8175bf8d3f340..4403303c70cbb3 100644 --- a/src/app/codegen-interaction-model/tests/TestCodegenModelViaMocks.cpp +++ b/src/app/codegen-data-model/tests/TestCodegenModelViaMocks.cpp @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include +#include #include #include diff --git a/src/app/interaction-model/ActionContext.h b/src/app/data-model-interface/ActionContext.h similarity index 100% rename from src/app/interaction-model/ActionContext.h rename to src/app/data-model-interface/ActionContext.h diff --git a/src/app/interaction-model/BUILD.gn b/src/app/data-model-interface/BUILD.gn similarity index 91% rename from src/app/interaction-model/BUILD.gn rename to src/app/data-model-interface/BUILD.gn index 19dd3de6c26291..65cde75612e2ba 100644 --- a/src/app/interaction-model/BUILD.gn +++ b/src/app/data-model-interface/BUILD.gn @@ -13,17 +13,17 @@ # limitations under the License. import("//build_overrides/chip.gni") -source_set("interaction-model") { +source_set("data-model-interface") { sources = [ "ActionContext.h", "Context.h", - "Events.h", + "DataModel.h", + "DataModelChangeListener.h", + "EventsGenerator.h", "InvokeResponder.h", "MetadataTypes.cpp", "MetadataTypes.h", - "Model.h", "OperationTypes.h", - "Paths.h", ] public_deps = [ diff --git a/src/app/interaction-model/Context.h b/src/app/data-model-interface/Context.h similarity index 82% rename from src/app/interaction-model/Context.h rename to src/app/data-model-interface/Context.h index 5f7f442664ff20..1ccfd1eb6586b7 100644 --- a/src/app/interaction-model/Context.h +++ b/src/app/data-model-interface/Context.h @@ -16,9 +16,9 @@ */ #pragma once -#include -#include -#include +#include +#include +#include namespace chip { namespace app { @@ -31,8 +31,8 @@ namespace InteractionModel { /// as well as fetching current state (via actionContext) struct InteractionModelContext { - Events * events; - Paths * paths; + EventsGenerator * eventsGenerator; + DataModelChangeListener * dataModelChangeListener; ActionContext * actionContext; }; diff --git a/src/app/interaction-model/Model.h b/src/app/data-model-interface/DataModel.h similarity index 94% rename from src/app/interaction-model/Model.h rename to src/app/data-model-interface/DataModel.h index 5ab973901a433b..0ecfd6fb624532 100644 --- a/src/app/interaction-model/Model.h +++ b/src/app/data-model-interface/DataModel.h @@ -22,10 +22,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace chip { namespace app { @@ -38,10 +38,10 @@ namespace InteractionModel { /// thread or equivalent /// - class is allowed to attempt to cache indexes/locations for faster /// lookups of things (e.g during iterations) -class Model : public DataModelMetadataTree +class DataModel : public DataModelMetadataTree { public: - virtual ~Model() = default; + virtual ~DataModel() = default; // `context` pointers will be guaranteed valid until Shutdown is called() virtual CHIP_ERROR Startup(InteractionModelContext context) diff --git a/src/app/interaction-model/Paths.h b/src/app/data-model-interface/DataModelChangeListener.h similarity index 89% rename from src/app/interaction-model/Paths.h rename to src/app/data-model-interface/DataModelChangeListener.h index 9241222a990cb5..37c278c76b92c8 100644 --- a/src/app/interaction-model/Paths.h +++ b/src/app/data-model-interface/DataModelChangeListener.h @@ -22,7 +22,8 @@ namespace chip { namespace app { namespace InteractionModel { -/// Notification listener for attribute changes. +/// Notification listener for changes of the underlying data in a +/// data model. /// /// Used to notify that a specific attribute path (or several attributes /// via wildcards) have changed their underlying content. @@ -30,10 +31,10 @@ namespace InteractionModel { /// Methods on this class MUST be called from within the matter /// main loop as they will likely trigger interaction model /// internal updates and subscription data reporting. -class Paths +class DataModelChangeListener { public: - virtual ~Paths() = 0; + virtual ~DataModelChangeListener() = 0; /// Mark all attributes matching the given path (which may be a wildcard) dirty. /// diff --git a/src/app/interaction-model/Events.h b/src/app/data-model-interface/EventsGenerator.h similarity index 97% rename from src/app/interaction-model/Events.h rename to src/app/data-model-interface/EventsGenerator.h index 0fc3fc56b974bd..b37d5107ca76c4 100644 --- a/src/app/interaction-model/Events.h +++ b/src/app/data-model-interface/EventsGenerator.h @@ -104,14 +104,14 @@ std::optional GenerateEvent(G & generator, const T & aEventData, En } // namespace internal -/// Exposes event access capabilities. +/// Exposes event generation capabilities. /// /// Allows callers to "generate events" which effectively notifies of an event having /// ocurred. -class Events +class EventsGenerator { public: - virtual ~Events() = default; + virtual ~EventsGenerator() = default; /// Generates the given event. /// diff --git a/src/app/interaction-model/InvokeResponder.h b/src/app/data-model-interface/InvokeResponder.h similarity index 100% rename from src/app/interaction-model/InvokeResponder.h rename to src/app/data-model-interface/InvokeResponder.h diff --git a/src/app/interaction-model/MetadataTypes.cpp b/src/app/data-model-interface/MetadataTypes.cpp similarity index 96% rename from src/app/interaction-model/MetadataTypes.cpp rename to src/app/data-model-interface/MetadataTypes.cpp index 48c2e3db733a52..92104b9bf90115 100644 --- a/src/app/interaction-model/MetadataTypes.cpp +++ b/src/app/data-model-interface/MetadataTypes.cpp @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include +#include namespace chip { namespace app { diff --git a/src/app/interaction-model/MetadataTypes.h b/src/app/data-model-interface/MetadataTypes.h similarity index 100% rename from src/app/interaction-model/MetadataTypes.h rename to src/app/data-model-interface/MetadataTypes.h diff --git a/src/app/interaction-model/OperationTypes.h b/src/app/data-model-interface/OperationTypes.h similarity index 100% rename from src/app/interaction-model/OperationTypes.h rename to src/app/data-model-interface/OperationTypes.h diff --git a/src/app/interaction-model/tests/BUILD.gn b/src/app/data-model-interface/tests/BUILD.gn similarity index 92% rename from src/app/interaction-model/tests/BUILD.gn rename to src/app/data-model-interface/tests/BUILD.gn index 4767d61dd12ed1..f366ee718fc3a3 100644 --- a/src/app/interaction-model/tests/BUILD.gn +++ b/src/app/data-model-interface/tests/BUILD.gn @@ -21,5 +21,5 @@ chip_test_suite("tests") { cflags = [ "-Wconversion" ] - public_deps = [ "${chip_root}/src/app/interaction-model" ] + public_deps = [ "${chip_root}/src/app/data-model-interface" ] } diff --git a/src/app/interaction-model/tests/TestEventEmitting.cpp b/src/app/data-model-interface/tests/TestEventEmitting.cpp similarity index 96% rename from src/app/interaction-model/tests/TestEventEmitting.cpp rename to src/app/data-model-interface/tests/TestEventEmitting.cpp index 3196636f621653..81a89f1603a04b 100644 --- a/src/app/interaction-model/tests/TestEventEmitting.cpp +++ b/src/app/data-model-interface/tests/TestEventEmitting.cpp @@ -17,8 +17,8 @@ */ #include +#include #include -#include #include #include @@ -36,7 +36,7 @@ constexpr uint32_t kFakeSoftwareVersion = 0x1234abcd; /// Keeps the "last event" in-memory to allow tests to validate /// that event writing and encoding worked. -class LogOnlyEvents : public Events +class LogOnlyEvents : public EventsGenerator { public: CHIP_ERROR GenerateEvent(EventLoggingDelegate * eventContentWriter, const EventOptions & options, @@ -96,7 +96,7 @@ class LogOnlyEvents : public Events TEST(TestInteractionModelEventEmitting, TestBasicType) { LogOnlyEvents logOnlyEvents; - Events * events = &logOnlyEvents; + EventsGenerator * events = &logOnlyEvents; StartUpEventType event{ kFakeSoftwareVersion }; @@ -131,7 +131,7 @@ TEST(TestInteractionModelEventEmitting, TestFabricScoped) static_assert(kTestFabricIndex != kUndefinedFabricIndex); LogOnlyEvents logOnlyEvents; - Events * events = &logOnlyEvents; + EventsGenerator * events = &logOnlyEvents; AccessControlEntryChangedType event; event.adminNodeID = chip::app::DataModel::MakeNullable(kTestNodeId);