From fc8ebf205c856eba93a205ccd46323fa670bccbe Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 20 Feb 2024 12:40:53 -0500 Subject: [PATCH 1/5] Move CommandSender and PendingResponseTracker to IM. Previous location of these files was `app` however this created apparent circular dependencies for includes. --- src/app/BUILD.gn | 14 +++++++------- src/app/CommandSender.cpp | 8 +------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 3dfbbbffe56daf..029422b3367310 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -140,6 +140,8 @@ static_library("interaction-model") { "CASEClientPool.h", "CASESessionManager.cpp", "CASESessionManager.h", + "CommandSender.cpp", + "CommandSender.h", "DeviceProxy.cpp", "DeviceProxy.h", "InteractionModelDelegatePointers.cpp", @@ -150,6 +152,9 @@ static_library("interaction-model") { "OperationalSessionSetup.cpp", "OperationalSessionSetup.h", "OperationalSessionSetupPool.h", + "PendingResponseTracker.h", + "PendingResponseTrackerImpl.cpp", + "PendingResponseTrackerImpl.h", "RequiredPrivilege.cpp", "RequiredPrivilege.h", "StatusResponse.cpp", @@ -157,6 +162,8 @@ static_library("interaction-model") { "SubscriptionResumptionStorage.h", "TimedHandler.cpp", "TimedHandler.h", + "TimedRequest.cpp", + "TimedRequest.h", "reporting/Engine.cpp", "reporting/Engine.h", "reporting/ReportScheduler.h", @@ -228,7 +235,6 @@ static_library("app") { "CommandResponseHelper.h", "CommandResponseSender.cpp", "CommandResponseSender.h", - "CommandSender.cpp", "DefaultAttributePersistenceProvider.cpp", "DefaultAttributePersistenceProvider.h", "DeferredAttributePersistenceProvider.cpp", @@ -238,13 +244,8 @@ static_library("app") { "FailSafeContext.cpp", "FailSafeContext.h", "OTAUserConsentCommon.h", - "PendingResponseTracker.h", - "PendingResponseTrackerImpl.cpp", - "PendingResponseTrackerImpl.h", "ReadHandler.cpp", "SafeAttributePersistenceProvider.h", - "TimedRequest.cpp", - "TimedRequest.h", "TimerDelegates.cpp", "TimerDelegates.h", "WriteClient.cpp", @@ -254,7 +255,6 @@ static_library("app") { # (app depending on im and im including these headers): # Name with _ so that linter does not recognize it # "CommandHandler._h" - # "CommandSender._h", # "ReadClient._h", # "ReadHandler._h", # "WriteClient._h", diff --git a/src/app/CommandSender.cpp b/src/app/CommandSender.cpp index 03ce2786b93d8d..5d3a3700eed6ea 100644 --- a/src/app/CommandSender.cpp +++ b/src/app/CommandSender.cpp @@ -16,16 +16,10 @@ * limitations under the License. */ -/** - * @file - * This file defines objects for a CHIP IM Invoke Command Sender - * - */ - #include "CommandSender.h" -#include "InteractionModelEngine.h" #include "StatusResponse.h" #include +#include #include #include #include From c1c3978c9653c425eaeb4e0eda07ac32fb9242bc Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 20 Feb 2024 12:45:35 -0500 Subject: [PATCH 2/5] Restyle --- src/app/CommandSender.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/CommandSender.cpp b/src/app/CommandSender.cpp index 5d3a3700eed6ea..18f4e755835076 100644 --- a/src/app/CommandSender.cpp +++ b/src/app/CommandSender.cpp @@ -18,8 +18,8 @@ #include "CommandSender.h" #include "StatusResponse.h" -#include #include +#include #include #include #include From 95d73e5a27212056139eec2e99fbd16c378d1842 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 20 Feb 2024 13:48:39 -0500 Subject: [PATCH 3/5] CommandSender is now tracked --- .github/workflows/lint.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d811fe05fa888f..29f391d243ae39 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -95,7 +95,6 @@ jobs: --known-failure app/att-storage.h \ --known-failure app/CommandHandler.h \ --known-failure app/CommandHandlerInterface.h \ - --known-failure app/CommandSender.h \ --known-failure app/CommandSenderLegacyCallback.h \ --known-failure app/CompatEnumNames.h \ --known-failure app/data-model/ListLargeSystemExtensions.h \ From 332ad57c98c60f24d7b860c7c66249f0facf022d Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 22 Feb 2024 10:20:55 -0500 Subject: [PATCH 4/5] Move read and write clients to interactionmodel as well --- .github/workflows/lint.yml | 2 -- src/app/BUILD.gn | 15 ++++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e312fd8d8c80f1..bb1586acc39029 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -101,7 +101,6 @@ jobs: --known-failure app/EventHeader.h \ --known-failure app/EventLoggingTypes.h \ --known-failure app/InteractionModelHelper.h \ - --known-failure app/ReadClient.h \ --known-failure app/ReadHandler.h \ --known-failure app/ReadPrepareParams.h \ --known-failure app/reporting/tests/MockReportScheduler.cpp \ @@ -131,7 +130,6 @@ jobs: --known-failure app/util/odd-sized-integers.h \ --known-failure app/util/util.cpp \ --known-failure app/util/util.h \ - --known-failure app/WriteClient.h \ --known-failure app/WriteHandler.h \ --known-failure lib/core/CHIPVendorIdentifiers.hpp \ --known-failure platform/DeviceSafeQueue.cpp \ diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 3b4827d4f1b5a1..e3fc677fe94f59 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -155,6 +155,8 @@ static_library("interaction-model") { "PendingResponseTracker.h", "PendingResponseTrackerImpl.cpp", "PendingResponseTrackerImpl.h", + "ReadClient.h", # TODO: cpp is only included conditionally. Needs logic + # fixing "RequiredPrivilege.cpp", "RequiredPrivilege.h", "StatusResponse.cpp", @@ -164,6 +166,8 @@ static_library("interaction-model") { "TimedHandler.h", "TimedRequest.cpp", "TimedRequest.h", + "WriteClient.cpp", + "WriteClient.h", "reporting/Engine.cpp", "reporting/Engine.h", "reporting/ReportScheduler.h", @@ -191,6 +195,10 @@ static_library("interaction-model") { public_configs = [ "${chip_root}/src:includes" ] + if (chip_enable_read_client) { + sources += [ "ReadClient.cpp" ] + } + if (chip_persist_subscriptions) { sources += [ "SimpleSubscriptionResumptionStorage.cpp", @@ -250,16 +258,13 @@ static_library("app") { "SafeAttributePersistenceProvider.h", "TimerDelegates.cpp", "TimerDelegates.h", - "WriteClient.cpp", "WriteHandler.cpp", # TODO: the following items cannot be included due to interaction-model circularity # (app depending on im and im including these headers): # Name with _ so that linter does not recognize it # "CommandHandler._h" - # "ReadClient._h", # "ReadHandler._h", - # "WriteClient._h", # "WriteHandler._h" # TODO: the following items cannot be included due to platform includes not being @@ -288,10 +293,6 @@ static_library("app") { "BufferedReadCallback.h", "ClusterStateCache.cpp", "ClusterStateCache.h", - "ReadClient.cpp", - - # TODO: cannot include "ReadClient._h" because interaction-model backreference - # Name with _ so that linter does not recognize it ] } From 79427b69b991560488da64b77ec1d4bc393166e6 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 22 Feb 2024 10:23:07 -0500 Subject: [PATCH 5/5] Also pull in interactionmodelhelper .... this is a very poorly named file --- .github/workflows/lint.yml | 1 - src/app/BUILD.gn | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bb1586acc39029..69613217033e8b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -100,7 +100,6 @@ jobs: --known-failure app/data-model/ListLargeSystemExtensions.h \ --known-failure app/EventHeader.h \ --known-failure app/EventLoggingTypes.h \ - --known-failure app/InteractionModelHelper.h \ --known-failure app/ReadHandler.h \ --known-failure app/ReadPrepareParams.h \ --known-failure app/reporting/tests/MockReportScheduler.cpp \ diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index e3fc677fe94f59..f714560afc15cb 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -148,6 +148,7 @@ static_library("interaction-model") { "InteractionModelDelegatePointers.h", "InteractionModelEngine.cpp", "InteractionModelEngine.h", + "InteractionModelHelper.h", "InteractionModelTimeout.h", "OperationalSessionSetup.cpp", "OperationalSessionSetup.h",