From 0ea6f9b2e102f962ff0b294d266a8378089e0b78 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 20 Feb 2024 04:56:48 -0500 Subject: [PATCH] Add more files to be managed and known by GN (#32140) * A first attempt at cleanup: moved ObjectList.h and some renames * Another rename pass * Final rename pass * Restyle * Fix typo in include * Fix typo and include dependencies * Remove handled files from linter check * Added 3 more mock files to be tracked by gn * Added some comments about layering issues and added EventManagement.h since that seems safe * Added more headers that are safe and restyle * Spell out what we could not add in IM because broken dependencies * Also track AppDelegate * Update the comments to not trigger the very basic linter we have * Fix typo * Restyle * Pull linkedlist into support rather than separate source set --- .github/workflows/lint.yml | 14 -------- src/app/AttributePathExpandIterator.cpp | 2 +- src/app/AttributePathExpandIterator.h | 4 +-- src/app/BUILD.gn | 26 +++++++++++++++ src/app/EventLoggingTypes.h | 10 +++--- src/app/EventManagement.cpp | 2 +- src/app/EventManagement.h | 4 +-- src/app/InteractionModelEngine.cpp | 32 ++++++++++--------- src/app/InteractionModelEngine.h | 26 +++++++-------- src/app/ReadHandler.cpp | 2 +- src/app/ReadHandler.h | 14 ++++---- src/app/SubscriptionResumptionStorage.h | 12 +++---- src/app/common/BUILD.gn | 2 ++ src/app/data-model/BUILD.gn | 2 +- src/app/reporting/Engine.cpp | 2 +- src/app/reporting/Engine.h | 2 +- src/app/server/BUILD.gn | 1 + .../tests/TestAttributePathExpandIterator.cpp | 24 +++++++------- src/app/tests/TestEventLogging.cpp | 8 ++--- src/app/tests/TestEventLoggingNoUTCTime.cpp | 8 ++--- .../tests/TestFabricScopedEventLogging.cpp | 8 ++--- src/app/tests/TestInteractionModelEngine.cpp | 12 +++---- src/app/util/BUILD.gn | 8 +++++ src/app/util/mock/BUILD.gn | 3 ++ src/lib/support/BUILD.gn | 1 + .../ObjectList.h => lib/support/LinkedList.h} | 7 ++-- 26 files changed, 132 insertions(+), 104 deletions(-) rename src/{app/ObjectList.h => lib/support/LinkedList.h} (90%) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 189f63837c841e..d811fe05fa888f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -93,35 +93,25 @@ jobs: --known-failure app/AttributeAccessInterface.h \ --known-failure app/AttributeAccessToken.h \ --known-failure app/att-storage.h \ - --known-failure app/BufferedReadCallback.h \ --known-failure app/CommandHandler.h \ --known-failure app/CommandHandlerInterface.h \ - --known-failure app/CommandPathParams.h \ - --known-failure app/CommandPathRegistry.h \ - --known-failure app/CommandResponseSender.h \ --known-failure app/CommandSender.h \ --known-failure app/CommandSenderLegacyCallback.h \ --known-failure app/CompatEnumNames.h \ - --known-failure app/ConcreteAttributePath.h \ - --known-failure app/ConcreteCommandPath.h \ --known-failure app/data-model/ListLargeSystemExtensions.h \ --known-failure app/EventHeader.h \ --known-failure app/EventLoggingDelegate.h \ --known-failure app/EventLogging.h \ --known-failure app/EventLoggingTypes.h \ - --known-failure app/EventManagement.h \ --known-failure app/InteractionModelHelper.h \ - --known-failure app/ObjectList.h \ --known-failure app/ReadClient.h \ --known-failure app/ReadHandler.h \ --known-failure app/ReadPrepareParams.h \ --known-failure app/reporting/tests/MockReportScheduler.cpp \ --known-failure app/reporting/tests/MockReportScheduler.h \ - --known-failure app/server/AppDelegate.h \ --known-failure app/TestEventTriggerDelegate.h \ --known-failure app/util/af.h \ --known-failure app/util/af-types.h \ - --known-failure app/util/attribute-metadata.h \ --known-failure app/util/attribute-storage.cpp \ --known-failure app/util/attribute-storage.h \ --known-failure app/util/attribute-storage-null-handling.h \ @@ -141,11 +131,7 @@ jobs: --known-failure app/util/im-client-callbacks.h \ --known-failure app/util/MatterCallbacks.h \ --known-failure app/util/message.cpp \ - --known-failure app/util/mock/Constants.h \ - --known-failure app/util/mock/Functions.h \ - --known-failure app/util/mock/MockNodeConfig.h \ --known-failure app/util/odd-sized-integers.h \ - --known-failure app/util/types_stub.h \ --known-failure app/util/util.cpp \ --known-failure app/util/util.h \ --known-failure app/WriteClient.h \ diff --git a/src/app/AttributePathExpandIterator.cpp b/src/app/AttributePathExpandIterator.cpp index 5c1bb50c179f47..784499a41c4d74 100644 --- a/src/app/AttributePathExpandIterator.cpp +++ b/src/app/AttributePathExpandIterator.cpp @@ -52,7 +52,7 @@ extern bool emberAfEndpointIndexIsEnabled(uint16_t index); namespace chip { namespace app { -AttributePathExpandIterator::AttributePathExpandIterator(ObjectList * aAttributePath) +AttributePathExpandIterator::AttributePathExpandIterator(SingleLinkedListNode * aAttributePath) { mpAttributePath = aAttributePath; diff --git a/src/app/AttributePathExpandIterator.h b/src/app/AttributePathExpandIterator.h index dbf8382014ce9c..f11e6793822f84 100644 --- a/src/app/AttributePathExpandIterator.h +++ b/src/app/AttributePathExpandIterator.h @@ -69,7 +69,7 @@ namespace app { class AttributePathExpandIterator { public: - AttributePathExpandIterator(ObjectList * aAttributePath); + AttributePathExpandIterator(SingleLinkedListNode * aAttributePath); /** * Proceed the iterator to the next attribute path in the given cluster info. @@ -105,7 +105,7 @@ class AttributePathExpandIterator inline bool Valid() const { return mpAttributePath != nullptr; } private: - ObjectList * mpAttributePath; + SingleLinkedListNode * mpAttributePath; ConcreteAttributePath mOutputPath; diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index c0f30493824f3a..3dfbbbffe56daf 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -87,7 +87,11 @@ source_set("revision_info") { source_set("paths") { sources = [ "AttributePathParams.h", + "CommandPathParams.h", + "CommandPathRegistry.h", + "ConcreteAttributePath.h", "ConcreteClusterPath.h", + "ConcreteCommandPath.h", "ConcreteEventPath.h", "DataVersionFilter.h", "EventPathParams.h", @@ -96,6 +100,7 @@ source_set("paths") { # This source sets also depends on basic-types.h that is not in any dependency we can use public_deps = [ ":app_config", + "${chip_root}/src/app/util:types", "${chip_root}/src/lib/core", "${chip_root}/src/lib/core:types", ] @@ -222,12 +227,14 @@ static_library("app") { "CommandHandler.cpp", "CommandResponseHelper.h", "CommandResponseSender.cpp", + "CommandResponseSender.h", "CommandSender.cpp", "DefaultAttributePersistenceProvider.cpp", "DefaultAttributePersistenceProvider.h", "DeferredAttributePersistenceProvider.cpp", "DeferredAttributePersistenceProvider.h", "EventManagement.cpp", + "EventManagement.h", "FailSafeContext.cpp", "FailSafeContext.h", "OTAUserConsentCommon.h", @@ -242,6 +249,21 @@ static_library("app") { "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" + # "CommandSender._h", + # "ReadClient._h", + # "ReadHandler._h", + # "WriteClient._h", + # "WriteHandler._h" + + # TODO: the following items cannot be included due to platform includes not being + # able to depend on src/app + # Name with _ so that linter does not recognize it + # "_AttributeAccessInterface._h", ] public_deps = [ @@ -261,9 +283,13 @@ static_library("app") { if (chip_enable_read_client) { sources += [ "BufferedReadCallback.cpp", + "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 ] } diff --git a/src/app/EventLoggingTypes.h b/src/app/EventLoggingTypes.h index 35fd37a25045ca..04a843ebcfbd60 100644 --- a/src/app/EventLoggingTypes.h +++ b/src/app/EventLoggingTypes.h @@ -19,11 +19,11 @@ #include #include -#include #include #include #include #include +#include #include inline constexpr size_t kNumPriorityLevel = 3; @@ -151,10 +151,10 @@ struct EventLoadOutContext EventNumber mStartingEventNumber = 0; Timestamp mPreviousTime; Timestamp mCurrentTime; - EventNumber mCurrentEventNumber = 0; - size_t mEventCount = 0; - const ObjectList * mpInterestedEventPaths = nullptr; - bool mFirst = true; + EventNumber mCurrentEventNumber = 0; + size_t mEventCount = 0; + const SingleLinkedListNode * mpInterestedEventPaths = nullptr; + bool mFirst = true; Access::SubjectDescriptor mSubjectDescriptor; }; } // namespace app diff --git a/src/app/EventManagement.cpp b/src/app/EventManagement.cpp index aa3abd67f828d8..8e6d53c24c9636 100644 --- a/src/app/EventManagement.cpp +++ b/src/app/EventManagement.cpp @@ -639,7 +639,7 @@ CHIP_ERROR EventManagement::CopyEventsSince(const TLVReader & aReader, size_t aD return err; } -CHIP_ERROR EventManagement::FetchEventsSince(TLVWriter & aWriter, const ObjectList * apEventPathList, +CHIP_ERROR EventManagement::FetchEventsSince(TLVWriter & aWriter, const SingleLinkedListNode * apEventPathList, EventNumber & aEventMin, size_t & aEventCount, const Access::SubjectDescriptor & aSubjectDescriptor) { diff --git a/src/app/EventManagement.h b/src/app/EventManagement.h index 228c26cca94a68..950efdc2bae867 100644 --- a/src/app/EventManagement.h +++ b/src/app/EventManagement.h @@ -31,10 +31,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -359,7 +359,7 @@ class EventManagement * available. * */ - CHIP_ERROR FetchEventsSince(chip::TLV::TLVWriter & aWriter, const ObjectList * apEventPathList, + CHIP_ERROR FetchEventsSince(chip::TLV::TLVWriter & aWriter, const SingleLinkedListNode * apEventPathList, EventNumber & aEventMin, size_t & aEventCount, const Access::SubjectDescriptor & aSubjectDescriptor); /** diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index ddc8a984f16b72..8e4b5a80e3df7d 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -450,7 +450,7 @@ CHIP_ERROR InteractionModelEngine::ParseAttributePaths(const Access::SubjectDesc // This avoids the 'parse all paths' approach that is employed in ReadHandler since we want to // avoid allocating out of the path store during this minimal initial processing stage. // - ObjectList paramsList; + SingleLinkedListNode paramsList; ReturnErrorOnFailure(path.Init(pathReader)); ReturnErrorOnFailure(path.ParsePath(paramsList.mValue)); @@ -1513,12 +1513,12 @@ bool InteractionModelEngine::HasConflictWriteRequests(const WriteHandler * apWri return false; } -void InteractionModelEngine::ReleaseAttributePathList(ObjectList *& aAttributePathList) +void InteractionModelEngine::ReleaseAttributePathList(SingleLinkedListNode *& aAttributePathList) { ReleasePool(aAttributePathList, mAttributePathPool); } -CHIP_ERROR InteractionModelEngine::PushFrontAttributePathList(ObjectList *& aAttributePathList, +CHIP_ERROR InteractionModelEngine::PushFrontAttributePathList(SingleLinkedListNode *& aAttributePathList, AttributePathParams & aAttributePath) { CHIP_ERROR err = PushFront(aAttributePathList, aAttributePath, mAttributePathPool); @@ -1530,10 +1530,10 @@ CHIP_ERROR InteractionModelEngine::PushFrontAttributePathList(ObjectList *& aAttributePaths) +void InteractionModelEngine::RemoveDuplicateConcreteAttributePath(SingleLinkedListNode *& aAttributePaths) { - ObjectList * prev = nullptr; - auto * path1 = aAttributePaths; + SingleLinkedListNode * prev = nullptr; + auto * path1 = aAttributePaths; while (path1 != nullptr) { @@ -1585,12 +1585,12 @@ void InteractionModelEngine::RemoveDuplicateConcreteAttributePath(ObjectList *& aEventPathList) +void InteractionModelEngine::ReleaseEventPathList(SingleLinkedListNode *& aEventPathList) { ReleasePool(aEventPathList, mEventPathPool); } -CHIP_ERROR InteractionModelEngine::PushFrontEventPathParamsList(ObjectList *& aEventPathList, +CHIP_ERROR InteractionModelEngine::PushFrontEventPathParamsList(SingleLinkedListNode *& aEventPathList, EventPathParams & aEventPath) { CHIP_ERROR err = PushFront(aEventPathList, aEventPath, mEventPathPool); @@ -1602,12 +1602,12 @@ CHIP_ERROR InteractionModelEngine::PushFrontEventPathParamsList(ObjectList *& aDataVersionFilterList) +void InteractionModelEngine::ReleaseDataVersionFilterList(SingleLinkedListNode *& aDataVersionFilterList) { ReleasePool(aDataVersionFilterList, mDataVersionFilterPool); } -CHIP_ERROR InteractionModelEngine::PushFrontDataVersionFilterList(ObjectList *& aDataVersionFilterList, +CHIP_ERROR InteractionModelEngine::PushFrontDataVersionFilterList(SingleLinkedListNode *& aDataVersionFilterList, DataVersionFilter & aDataVersionFilter) { CHIP_ERROR err = PushFront(aDataVersionFilterList, aDataVersionFilter, mDataVersionFilterPool); @@ -1620,12 +1620,13 @@ CHIP_ERROR InteractionModelEngine::PushFrontDataVersionFilterList(ObjectList -void InteractionModelEngine::ReleasePool(ObjectList *& aObjectList, ObjectPool, N> & aObjectPool) +void InteractionModelEngine::ReleasePool(SingleLinkedListNode *& aObjectList, + ObjectPool, N> & aObjectPool) { - ObjectList * current = aObjectList; + SingleLinkedListNode * current = aObjectList; while (current != nullptr) { - ObjectList * nextObject = current->mpNext; + SingleLinkedListNode * nextObject = current->mpNext; aObjectPool.ReleaseObject(current); current = nextObject; } @@ -1634,9 +1635,10 @@ void InteractionModelEngine::ReleasePool(ObjectList *& aObjectList, ObjectPoo } template -CHIP_ERROR InteractionModelEngine::PushFront(ObjectList *& aObjectList, T & aData, ObjectPool, N> & aObjectPool) +CHIP_ERROR InteractionModelEngine::PushFront(SingleLinkedListNode *& aObjectList, T & aData, + ObjectPool, N> & aObjectPool) { - ObjectList * object = aObjectPool.CreateObject(); + SingleLinkedListNode * object = aObjectPool.CreateObject(); if (object == nullptr) { return CHIP_ERROR_NO_MEMORY; diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h index b222087867380f..1c05767299dfbb 100644 --- a/src/app/InteractionModelEngine.h +++ b/src/app/InteractionModelEngine.h @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -54,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -187,22 +187,22 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, reporting::ReportScheduler * GetReportScheduler() { return mReportScheduler; } - void ReleaseAttributePathList(ObjectList *& aAttributePathList); + void ReleaseAttributePathList(SingleLinkedListNode *& aAttributePathList); - CHIP_ERROR PushFrontAttributePathList(ObjectList *& aAttributePathList, + CHIP_ERROR PushFrontAttributePathList(SingleLinkedListNode *& aAttributePathList, AttributePathParams & aAttributePath); // If a concrete path indicates an attribute that is also referenced by a wildcard path in the request, // the path SHALL be removed from the list. - void RemoveDuplicateConcreteAttributePath(ObjectList *& aAttributePaths); + void RemoveDuplicateConcreteAttributePath(SingleLinkedListNode *& aAttributePaths); - void ReleaseEventPathList(ObjectList *& aEventPathList); + void ReleaseEventPathList(SingleLinkedListNode *& aEventPathList); - CHIP_ERROR PushFrontEventPathParamsList(ObjectList *& aEventPathList, EventPathParams & aEventPath); + CHIP_ERROR PushFrontEventPathParamsList(SingleLinkedListNode *& aEventPathList, EventPathParams & aEventPath); - void ReleaseDataVersionFilterList(ObjectList *& aDataVersionFilterList); + void ReleaseDataVersionFilterList(SingleLinkedListNode *& aDataVersionFilterList); - CHIP_ERROR PushFrontDataVersionFilterList(ObjectList *& aDataVersionFilterList, + CHIP_ERROR PushFrontDataVersionFilterList(SingleLinkedListNode *& aDataVersionFilterList, DataVersionFilter & aDataVersionFilter); CHIP_ERROR RegisterCommandHandler(CommandHandlerInterface * handler); @@ -576,9 +576,9 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, static void ResumeSubscriptionsTimerCallback(System::Layer * apSystemLayer, void * apAppState); template - void ReleasePool(ObjectList *& aObjectList, ObjectPool, N> & aObjectPool); + void ReleasePool(SingleLinkedListNode *& aObjectList, ObjectPool, N> & aObjectPool); template - CHIP_ERROR PushFront(ObjectList *& aObjectList, T & aData, ObjectPool, N> & aObjectPool); + CHIP_ERROR PushFront(SingleLinkedListNode *& aObjectList, T & aData, ObjectPool, N> & aObjectPool); Messaging::ExchangeManager * mpExchangeMgr = nullptr; @@ -606,13 +606,13 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, "CHIP_IM_MAX_NUM_READS is too small to match the requirements of spec 8.5.1"); #endif - ObjectPool, + ObjectPool, CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_READS + CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_SUBSCRIPTIONS> mAttributePathPool; - ObjectPool, + ObjectPool, CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_READS + CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_SUBSCRIPTIONS> mEventPathPool; - ObjectPool, + ObjectPool, CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_READS + CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_SUBSCRIPTIONS> mDataVersionFilterPool; diff --git a/src/app/ReadHandler.cpp b/src/app/ReadHandler.cpp index b5fc34484ea8ff..63da2a53aa7470 100644 --- a/src/app/ReadHandler.cpp +++ b/src/app/ReadHandler.cpp @@ -134,7 +134,7 @@ void ReadHandler::OnSubscriptionResumed(const SessionHandle & sessionHandle, MoveToState(HandlerState::CanStartReporting); - ObjectList * attributePath = mpAttributePathList; + SingleLinkedListNode * attributePath = mpAttributePathList; while (attributePath) { mManagementCallback.GetInteractionModelEngine()->GetReportingEngine().SetDirty(attributePath->mValue); diff --git a/src/app/ReadHandler.h b/src/app/ReadHandler.h index 71070c357147df..c597bac8a58d70 100644 --- a/src/app/ReadHandler.h +++ b/src/app/ReadHandler.h @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -45,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -224,9 +224,9 @@ class ReadHandler : public Messaging::ExchangeDelegate ReadHandler(ManagementCallback & apCallback, Observer * observer); #endif - const ObjectList * GetAttributePathList() const { return mpAttributePathList; } - const ObjectList * GetEventPathList() const { return mpEventPathList; } - const ObjectList * GetDataVersionFilterList() const { return mpDataVersionFilterList; } + const SingleLinkedListNode * GetAttributePathList() const { return mpAttributePathList; } + const SingleLinkedListNode * GetEventPathList() const { return mpEventPathList; } + const SingleLinkedListNode * GetDataVersionFilterList() const { return mpDataVersionFilterList; } void GetReportingIntervals(uint16_t & aMinInterval, uint16_t & aMaxInterval) const { @@ -550,9 +550,9 @@ class ReadHandler : public Messaging::ExchangeDelegate Messaging::ExchangeManager * mExchangeMgr = nullptr; #endif // CHIP_CONFIG_UNSAFE_SUBSCRIPTION_EXCHANGE_MANAGER_USE - ObjectList * mpAttributePathList = nullptr; - ObjectList * mpEventPathList = nullptr; - ObjectList * mpDataVersionFilterList = nullptr; + SingleLinkedListNode * mpAttributePathList = nullptr; + SingleLinkedListNode * mpEventPathList = nullptr; + SingleLinkedListNode * mpDataVersionFilterList = nullptr; ManagementCallback & mManagementCallback; diff --git a/src/app/SubscriptionResumptionStorage.h b/src/app/SubscriptionResumptionStorage.h index 316adc3bd3c2e3..19342599f36bbc 100644 --- a/src/app/SubscriptionResumptionStorage.h +++ b/src/app/SubscriptionResumptionStorage.h @@ -78,15 +78,15 @@ class SubscriptionResumptionStorage bool mFabricFiltered; Platform::ScopedMemoryBufferWithSize mAttributePaths; Platform::ScopedMemoryBufferWithSize mEventPaths; - CHIP_ERROR SetAttributePaths(const ObjectList * pAttributePathList) + CHIP_ERROR SetAttributePaths(const SingleLinkedListNode * pAttributePathList) { mAttributePaths.Free(); if (!pAttributePathList) { return CHIP_NO_ERROR; } - const ObjectList * attributePath = pAttributePathList; - size_t attributePathCount = 0; + const SingleLinkedListNode * attributePath = pAttributePathList; + size_t attributePathCount = 0; while (attributePath) { attributePathCount++; @@ -103,15 +103,15 @@ class SubscriptionResumptionStorage } return CHIP_NO_ERROR; } - CHIP_ERROR SetEventPaths(const ObjectList * pEventPathList) + CHIP_ERROR SetEventPaths(const SingleLinkedListNode * pEventPathList) { mEventPaths.Free(); if (!pEventPathList) { return CHIP_NO_ERROR; } - const ObjectList * eventPath = pEventPathList; - size_t eventPathCount = 0; + const SingleLinkedListNode * eventPath = pEventPathList; + size_t eventPathCount = 0; while (eventPath) { eventPathCount++; diff --git a/src/app/common/BUILD.gn b/src/app/common/BUILD.gn index 193d4c362e537e..1af268a477efaf 100644 --- a/src/app/common/BUILD.gn +++ b/src/app/common/BUILD.gn @@ -27,7 +27,9 @@ static_library("cluster-objects") { ] public_deps = [ + "${chip_root}/src/app:paths", "${chip_root}/src/app/data-model", + "${chip_root}/src/app/util:types", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/protocols/interaction_model", diff --git a/src/app/data-model/BUILD.gn b/src/app/data-model/BUILD.gn index 49a49033f0e9f2..9b04882a60ec9c 100644 --- a/src/app/data-model/BUILD.gn +++ b/src/app/data-model/BUILD.gn @@ -37,8 +37,8 @@ source_set("data-model") { # of this, in part due to zap-generated code dependency. # # - app/util/attribute-storage-null-handling.h - # - app/ConcreteAttributePath.h # + "${chip_root}/src/app:paths", "${chip_root}/src/app/common:enums", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", diff --git a/src/app/reporting/Engine.cpp b/src/app/reporting/Engine.cpp index 80dec7ed6d3cd1..2dd730c358fe0a 100644 --- a/src/app/reporting/Engine.cpp +++ b/src/app/reporting/Engine.cpp @@ -58,7 +58,7 @@ void Engine::Shutdown() mGlobalDirtySet.ReleaseAll(); } -bool Engine::IsClusterDataVersionMatch(const ObjectList * aDataVersionFilterList, +bool Engine::IsClusterDataVersionMatch(const SingleLinkedListNode * aDataVersionFilterList, const ConcreteReadAttributePath & aPath) { bool existPathMatch = false; diff --git a/src/app/reporting/Engine.h b/src/app/reporting/Engine.h index 47483d9096bfec..fccf9e08ab020f 100644 --- a/src/app/reporting/Engine.h +++ b/src/app/reporting/Engine.h @@ -179,7 +179,7 @@ class Engine // of those will fail to match. This function should return false if either nothing in the list matches the given // endpoint+cluster in the path or there is an entry in the list that matches the endpoint+cluster in the path but does not // match the current data version of that cluster. - bool IsClusterDataVersionMatch(const ObjectList * aDataVersionFilterList, + bool IsClusterDataVersionMatch(const SingleLinkedListNode * aDataVersionFilterList, const ConcreteReadAttributePath & aPath); /** diff --git a/src/app/server/BUILD.gn b/src/app/server/BUILD.gn index 4d63afda77ad42..7c661464bbaea3 100644 --- a/src/app/server/BUILD.gn +++ b/src/app/server/BUILD.gn @@ -30,6 +30,7 @@ static_library("server") { sources = [ "AclStorage.cpp", "AclStorage.h", + "AppDelegate.h", "CommissioningModeProvider.h", "CommissioningWindowManager.cpp", "CommissioningWindowManager.h", diff --git a/src/app/tests/TestAttributePathExpandIterator.cpp b/src/app/tests/TestAttributePathExpandIterator.cpp index d4da4fc95a2b8c..e5505320193b81 100644 --- a/src/app/tests/TestAttributePathExpandIterator.cpp +++ b/src/app/tests/TestAttributePathExpandIterator.cpp @@ -20,12 +20,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include @@ -41,7 +41,7 @@ using P = app::ConcreteAttributePath; void TestAllWildcard(nlTestSuite * apSuite, void * apContext) { - app::ObjectList clusInfo; + SingleLinkedListNode clusInfo; app::ConcreteAttributePath path; P paths[] = { @@ -144,7 +144,7 @@ void TestAllWildcard(nlTestSuite * apSuite, void * apContext) void TestWildcardEndpoint(nlTestSuite * apSuite, void * apContext) { - app::ObjectList clusInfo; + SingleLinkedListNode clusInfo; clusInfo.mValue.mClusterId = Test::MockClusterId(3); clusInfo.mValue.mAttributeId = Test::MockAttributeId(3); @@ -167,7 +167,7 @@ void TestWildcardEndpoint(nlTestSuite * apSuite, void * apContext) void TestWildcardCluster(nlTestSuite * apSuite, void * apContext) { - app::ObjectList clusInfo; + SingleLinkedListNode clusInfo; clusInfo.mValue.mEndpointId = Test::kMockEndpoint3; clusInfo.mValue.mAttributeId = app::Clusters::Globals::Attributes::ClusterRevision::Id; @@ -193,7 +193,7 @@ void TestWildcardCluster(nlTestSuite * apSuite, void * apContext) void TestWildcardClusterGlobalAttributeNotInMetadata(nlTestSuite * apSuite, void * apContext) { - app::ObjectList clusInfo; + SingleLinkedListNode clusInfo; clusInfo.mValue.mEndpointId = Test::kMockEndpoint3; clusInfo.mValue.mAttributeId = app::Clusters::Globals::Attributes::AttributeList::Id; @@ -219,7 +219,7 @@ void TestWildcardClusterGlobalAttributeNotInMetadata(nlTestSuite * apSuite, void void TestWildcardAttribute(nlTestSuite * apSuite, void * apContext) { - app::ObjectList clusInfo; + SingleLinkedListNode clusInfo; clusInfo.mValue.mEndpointId = Test::kMockEndpoint2; clusInfo.mValue.mClusterId = Test::MockClusterId(3); @@ -252,7 +252,7 @@ void TestWildcardAttribute(nlTestSuite * apSuite, void * apContext) void TestNoWildcard(nlTestSuite * apSuite, void * apContext) { - app::ObjectList clusInfo; + SingleLinkedListNode clusInfo; clusInfo.mValue.mEndpointId = Test::kMockEndpoint2; clusInfo.mValue.mClusterId = Test::MockClusterId(3); clusInfo.mValue.mAttributeId = Test::MockAttributeId(3); @@ -277,21 +277,21 @@ void TestNoWildcard(nlTestSuite * apSuite, void * apContext) void TestMultipleClusInfo(nlTestSuite * apSuite, void * apContext) { - app::ObjectList clusInfo1; + SingleLinkedListNode clusInfo1; - app::ObjectList clusInfo2; + SingleLinkedListNode clusInfo2; clusInfo2.mValue.mClusterId = Test::MockClusterId(3); clusInfo2.mValue.mAttributeId = Test::MockAttributeId(3); - app::ObjectList clusInfo3; + SingleLinkedListNode clusInfo3; clusInfo3.mValue.mEndpointId = Test::kMockEndpoint3; clusInfo3.mValue.mAttributeId = app::Clusters::Globals::Attributes::ClusterRevision::Id; - app::ObjectList clusInfo4; + SingleLinkedListNode clusInfo4; clusInfo4.mValue.mEndpointId = Test::kMockEndpoint2; clusInfo4.mValue.mClusterId = Test::MockClusterId(3); - app::ObjectList clusInfo5; + SingleLinkedListNode clusInfo5; clusInfo5.mValue.mEndpointId = Test::kMockEndpoint2; clusInfo5.mValue.mClusterId = Test::MockClusterId(3); clusInfo5.mValue.mAttributeId = Test::MockAttributeId(3); diff --git a/src/app/tests/TestEventLogging.cpp b/src/app/tests/TestEventLogging.cpp index 08f950517acfde..baf43d6b398707 100644 --- a/src/app/tests/TestEventLogging.cpp +++ b/src/app/tests/TestEventLogging.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -37,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -133,7 +133,7 @@ static void CheckLogState(nlTestSuite * apSuite, chip::app::EventManagement & aL } static void CheckLogReadOut(nlTestSuite * apSuite, chip::app::EventManagement & alogMgmt, chip::EventNumber startingEventNumber, - size_t expectedNumEvents, chip::app::ObjectList * clusterInfo) + size_t expectedNumEvents, chip::SingleLinkedListNode * clusterInfo) { CHIP_ERROR err; chip::TLV::TLVReader reader; @@ -236,7 +236,7 @@ static void CheckLogEventWithEvictToNextBuffer(nlTestSuite * apSuite, void * apC NL_TEST_ASSERT(apSuite, (eid4 + 1) == eid5); NL_TEST_ASSERT(apSuite, (eid5 + 1) == eid6); - chip::app::ObjectList paths[2]; + chip::SingleLinkedListNode paths[2]; paths[0].mValue.mEndpointId = kTestEndpointId1; paths[0].mValue.mClusterId = kLivenessClusterId; @@ -257,7 +257,7 @@ static void CheckLogEventWithEvictToNextBuffer(nlTestSuite * apSuite, void * apC // interested paths are path list, expect to retrieve all events for those interested paths CheckLogReadOut(apSuite, logMgmt, 0, 6, paths); - chip::app::ObjectList pathsWithWildcard[2]; + chip::SingleLinkedListNode pathsWithWildcard[2]; paths[0].mValue.mEndpointId = kTestEndpointId1; paths[0].mValue.mClusterId = kLivenessClusterId; diff --git a/src/app/tests/TestEventLoggingNoUTCTime.cpp b/src/app/tests/TestEventLoggingNoUTCTime.cpp index 43df98a790e2ba..8360f9a0813e98 100644 --- a/src/app/tests/TestEventLoggingNoUTCTime.cpp +++ b/src/app/tests/TestEventLoggingNoUTCTime.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -36,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -177,7 +177,7 @@ static void CheckLogState(nlTestSuite * apSuite, chip::app::EventManagement & aL } static void CheckLogReadOut(nlTestSuite * apSuite, chip::app::EventManagement & alogMgmt, chip::EventNumber startingEventNumber, - size_t expectedNumEvents, chip::app::ObjectList * clusterInfo) + size_t expectedNumEvents, chip::SingleLinkedListNode * clusterInfo) { CHIP_ERROR err; chip::TLV::TLVReader reader; @@ -279,7 +279,7 @@ static void CheckLogEventWithEvictToNextBuffer(nlTestSuite * apSuite, void * apC NL_TEST_ASSERT(apSuite, (eid4 + 1) == eid5); NL_TEST_ASSERT(apSuite, (eid5 + 1) == eid6); - chip::app::ObjectList paths[2]; + chip::SingleLinkedListNode paths[2]; paths[0].mValue.mEndpointId = kTestEndpointId1; paths[0].mValue.mClusterId = kLivenessClusterId; @@ -300,7 +300,7 @@ static void CheckLogEventWithEvictToNextBuffer(nlTestSuite * apSuite, void * apC // interested paths are path list, expect to retrieve all events for those interested paths CheckLogReadOut(apSuite, logMgmt, 0, 6, paths); - chip::app::ObjectList pathsWithWildcard[2]; + chip::SingleLinkedListNode pathsWithWildcard[2]; paths[0].mValue.mEndpointId = kTestEndpointId1; paths[0].mValue.mClusterId = kLivenessClusterId; diff --git a/src/app/tests/TestFabricScopedEventLogging.cpp b/src/app/tests/TestFabricScopedEventLogging.cpp index f55ac63b687491..d016ad5183e1c0 100644 --- a/src/app/tests/TestFabricScopedEventLogging.cpp +++ b/src/app/tests/TestFabricScopedEventLogging.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -37,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -137,7 +137,7 @@ static void CheckLogState(nlTestSuite * apSuite, chip::app::EventManagement & aL } static void CheckLogReadOut(nlTestSuite * apSuite, chip::app::EventManagement & alogMgmt, chip::EventNumber startingEventNumber, - size_t expectedNumEvents, chip::app::ObjectList * clusterInfo, + size_t expectedNumEvents, chip::SingleLinkedListNode * clusterInfo, const chip::Access::SubjectDescriptor & aSubjectDescriptor) { CHIP_ERROR err; @@ -220,7 +220,7 @@ static void CheckLogEventWithEvictToNextBuffer(nlTestSuite * apSuite, void * apC NL_TEST_ASSERT(apSuite, (eid2 + 1) == eid3); NL_TEST_ASSERT(apSuite, (eid3 + 1) == eid4); - chip::app::ObjectList paths[2]; + chip::SingleLinkedListNode paths[2]; paths[0].mValue.mEndpointId = kTestEndpointId1; paths[0].mValue.mClusterId = kLivenessClusterId; @@ -247,7 +247,7 @@ static void CheckLogEventWithEvictToNextBuffer(nlTestSuite * apSuite, void * apC CheckLogReadOut(apSuite, logMgmt, 0, 1, paths, descriptor); // Fabric event + wildcard test, only have one fabric-scoped event with fabric 2 - chip::app::ObjectList pathsWithWildcard[2]; + chip::SingleLinkedListNode pathsWithWildcard[2]; paths[0].mValue.mEndpointId = kTestEndpointId1; paths[0].mValue.mClusterId = kLivenessClusterId; diff --git a/src/app/tests/TestInteractionModelEngine.cpp b/src/app/tests/TestInteractionModelEngine.cpp index f4450635ac0b8f..fcdc7d53e1594f 100644 --- a/src/app/tests/TestInteractionModelEngine.cpp +++ b/src/app/tests/TestInteractionModelEngine.cpp @@ -52,13 +52,13 @@ class TestInteractionModelEngine #if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS && CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION static void TestSubscriptionResumptionTimer(nlTestSuite * apSuite, void * apContext); #endif // CHIP_CONFIG_PERSIST_SUBSCRIPTIONS && CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION - static int GetAttributePathListLength(ObjectList * apattributePathParamsList); + static int GetAttributePathListLength(SingleLinkedListNode * apattributePathParamsList); }; -int TestInteractionModelEngine::GetAttributePathListLength(ObjectList * apAttributePathParamsList) +int TestInteractionModelEngine::GetAttributePathListLength(SingleLinkedListNode * apAttributePathParamsList) { - int length = 0; - ObjectList * runner = apAttributePathParamsList; + int length = 0; + SingleLinkedListNode * runner = apAttributePathParamsList; while (runner != nullptr) { runner = runner->mpNext; @@ -74,7 +74,7 @@ void TestInteractionModelEngine::TestAttributePathParamsPushRelease(nlTestSuite err = InteractionModelEngine::GetInstance()->Init(&ctx.GetExchangeManager(), &ctx.GetFabricTable(), app::reporting::GetDefaultReportScheduler()); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ObjectList * attributePathParamsList = nullptr; + SingleLinkedListNode * attributePathParamsList = nullptr; AttributePathParams attributePathParams1; AttributePathParams attributePathParams2; AttributePathParams attributePathParams3; @@ -112,7 +112,7 @@ void TestInteractionModelEngine::TestRemoveDuplicateConcreteAttribute(nlTestSuit err = InteractionModelEngine::GetInstance()->Init(&ctx.GetExchangeManager(), &ctx.GetFabricTable(), app::reporting::GetDefaultReportScheduler()); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ObjectList * attributePathParamsList = nullptr; + SingleLinkedListNode * attributePathParamsList = nullptr; AttributePathParams attributePathParams1; AttributePathParams attributePathParams2; AttributePathParams attributePathParams3; diff --git a/src/app/util/BUILD.gn b/src/app/util/BUILD.gn index 31d6b9e881956a..821ba51a9badcc 100644 --- a/src/app/util/BUILD.gn +++ b/src/app/util/BUILD.gn @@ -14,3 +14,11 @@ import("//build_overrides/chip.gni") import("${chip_root}/src/app/common_flags.gni") + +source_set("types") { + sources = [ + "attribute-metadata.h", + "basic-types.h", + "types_stub.h", + ] +} diff --git a/src/app/util/mock/BUILD.gn b/src/app/util/mock/BUILD.gn index 5918318107fd35..be56bc69032844 100644 --- a/src/app/util/mock/BUILD.gn +++ b/src/app/util/mock/BUILD.gn @@ -20,7 +20,10 @@ config("mock_include") { source_set("mock_ember") { sources = [ + "Constants.h", + "Functions.h", "MockNodeConfig.cpp", + "MockNodeConfig.h", "attribute-storage.cpp", ] diff --git a/src/lib/support/BUILD.gn b/src/lib/support/BUILD.gn index 2342b26ae66d70..02ca1eef593def 100644 --- a/src/lib/support/BUILD.gn +++ b/src/lib/support/BUILD.gn @@ -212,6 +212,7 @@ static_library("support") { "Iterators.h", "LambdaBridge.h", "LifetimePersistedCounter.h", + "LinkedList.h", "ObjectLifeCycle.h", "OwnerOf.h", "PersistedCounter.h", diff --git a/src/app/ObjectList.h b/src/lib/support/LinkedList.h similarity index 90% rename from src/app/ObjectList.h rename to src/lib/support/LinkedList.h index 416db0bb70a6b5..d830c2b3a23351 100644 --- a/src/app/ObjectList.h +++ b/src/lib/support/LinkedList.h @@ -22,13 +22,13 @@ #include namespace chip { -namespace app { +/// A very basic single-linked list template -struct ObjectList +struct SingleLinkedListNode { T mValue; - ObjectList * mpNext = nullptr; + SingleLinkedListNode * mpNext = nullptr; size_t Count() const { @@ -41,5 +41,4 @@ struct ObjectList } }; -} // namespace app } // namespace chip