From 07fc8cd08273f7d15cfbade2ff480c3bcd29d7db Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Thu, 24 Mar 2022 01:41:28 -0700 Subject: [PATCH] Use AttributePathParams Pool, EventPathParams Pool and DataVersionFilter Pool instead. Roughly there is no logical change. (#16467) --- examples/common/pigweed/rpc_services/Device.h | 3 +- src/app/AttributeAccessInterface.h | 1 - src/app/AttributePathExpandIterator.cpp | 46 ++++---- src/app/AttributePathExpandIterator.h | 39 ++++--- src/app/AttributePathParams.h | 34 ++++-- src/app/ClusterInfo.h | 109 ------------------ src/app/DataVersionFilter.h | 10 +- src/app/EventLoggingTypes.h | 11 +- src/app/EventManagement.cpp | 12 +- src/app/EventManagement.h | 9 +- src/app/EventPathParams.h | 23 ++-- src/app/InteractionModelEngine.cpp | 88 +++++++++++--- src/app/InteractionModelEngine.h | 45 +++++--- src/app/MessageDef/AttributePathIB.h | 1 + src/app/MessageDef/EventPathIB.h | 1 + src/app/ObjectList.h | 31 +++++ src/app/ReadClient.cpp | 1 + src/app/ReadHandler.cpp | 60 +++++----- src/app/ReadHandler.h | 21 ++-- src/app/reporting/Engine.cpp | 57 +++++---- src/app/reporting/Engine.h | 8 +- .../tests/TestAttributePathExpandIterator.cpp | 64 +++++----- src/app/tests/TestClusterInfo.cpp | 66 +++++------ src/app/tests/TestCommissionManager.cpp | 3 +- src/app/tests/TestEventLogging.cpp | 35 +++--- src/app/tests/TestEventOverflow.cpp | 1 - src/app/tests/TestInteractionModelEngine.cpp | 66 ++++++----- src/app/tests/TestReadInteraction.cpp | 24 ++-- src/app/tests/TestReportingEngine.cpp | 8 +- .../suites/certification/Test_TC_IDM_3_2.yaml | 39 +++---- .../util/ember-compatibility-functions.cpp | 5 +- src/app/util/mock/attribute-storage.cpp | 1 - 32 files changed, 472 insertions(+), 450 deletions(-) delete mode 100644 src/app/ClusterInfo.h create mode 100644 src/app/ObjectList.h diff --git a/examples/common/pigweed/rpc_services/Device.h b/examples/common/pigweed/rpc_services/Device.h index fc5605d7dbd538..e0979365529f3f 100644 --- a/examples/common/pigweed/rpc_services/Device.h +++ b/examples/common/pigweed/rpc_services/Device.h @@ -160,8 +160,7 @@ class Device : public pw_rpc::nanopb::Device::Service virtual pw::Status SetPairingInfo(const chip_rpc_PairingInfo & request, pw_protobuf_Empty & response) { if (DeviceLayer::GetCommissionableDataProvider()->SetSetupPasscode(request.code) != CHIP_NO_ERROR || - DeviceLayer::GetCommissionableDataProvider()->SetSetupDiscriminator(request.discriminator) != - CHIP_NO_ERROR) + DeviceLayer::GetCommissionableDataProvider()->SetSetupDiscriminator(request.discriminator) != CHIP_NO_ERROR) { return pw::Status::Unknown(); } diff --git a/src/app/AttributeAccessInterface.h b/src/app/AttributeAccessInterface.h index 7840dac52ebe53..2bb686ba7ca2fd 100644 --- a/src/app/AttributeAccessInterface.h +++ b/src/app/AttributeAccessInterface.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include #include diff --git a/src/app/AttributePathExpandIterator.cpp b/src/app/AttributePathExpandIterator.cpp index 235d45185a2dee..3409808ff7c8b5 100644 --- a/src/app/AttributePathExpandIterator.cpp +++ b/src/app/AttributePathExpandIterator.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include @@ -52,9 +52,9 @@ extern bool emberAfEndpointIndexIsEnabled(uint16_t index); namespace chip { namespace app { -AttributePathExpandIterator::AttributePathExpandIterator(ClusterInfo * aClusterInfo) +AttributePathExpandIterator::AttributePathExpandIterator(ObjectList * aAttributePath) { - mpClusterInfo = aClusterInfo; + mpAttributePath = aAttributePath; // Reset iterator state mEndpointIndex = UINT16_MAX; @@ -71,42 +71,42 @@ AttributePathExpandIterator::AttributePathExpandIterator(ClusterInfo * aClusterI Next(); } -void AttributePathExpandIterator::PrepareEndpointIndexRange(const ClusterInfo & aClusterInfo) +void AttributePathExpandIterator::PrepareEndpointIndexRange(const AttributePathParams & aAttributePath) { - if (aClusterInfo.HasWildcardEndpointId()) + if (aAttributePath.HasWildcardEndpointId()) { mEndpointIndex = 0; mEndEndpointIndex = emberAfEndpointCount(); } else { - mEndpointIndex = emberAfIndexFromEndpoint(aClusterInfo.mEndpointId); + mEndpointIndex = emberAfIndexFromEndpoint(aAttributePath.mEndpointId); // If the given cluster id does not exist on the given endpoint, it will return uint16(0xFFFF), then endEndpointIndex // will be 0, means we should iterate a null endpoint set (skip it). mEndEndpointIndex = static_cast(mEndpointIndex + 1); } } -void AttributePathExpandIterator::PrepareClusterIndexRange(const ClusterInfo & aClusterInfo, EndpointId aEndpointId) +void AttributePathExpandIterator::PrepareClusterIndexRange(const AttributePathParams & aAttributePath, EndpointId aEndpointId) { - if (aClusterInfo.HasWildcardClusterId()) + if (aAttributePath.HasWildcardClusterId()) { mClusterIndex = 0; mEndClusterIndex = emberAfClusterCount(aEndpointId, true /* server */); } else { - mClusterIndex = emberAfClusterIndex(aEndpointId, aClusterInfo.mClusterId, CLUSTER_MASK_SERVER); + mClusterIndex = emberAfClusterIndex(aEndpointId, aAttributePath.mClusterId, CLUSTER_MASK_SERVER); // If the given cluster id does not exist on the given endpoint, it will return uint8(0xFF), then endClusterIndex // will be 0, means we should iterate a null cluster set (skip it). mEndClusterIndex = static_cast(mClusterIndex + 1); } } -void AttributePathExpandIterator::PrepareAttributeIndexRange(const ClusterInfo & aClusterInfo, EndpointId aEndpointId, +void AttributePathExpandIterator::PrepareAttributeIndexRange(const AttributePathParams & aAttributePath, EndpointId aEndpointId, ClusterId aClusterId) { - if (aClusterInfo.HasWildcardAttributeId()) + if (aAttributePath.HasWildcardAttributeId()) { mAttributeIndex = 0; mEndAttributeIndex = emberAfGetServerAttributeCount(aEndpointId, aClusterId); @@ -115,7 +115,7 @@ void AttributePathExpandIterator::PrepareAttributeIndexRange(const ClusterInfo & } else { - mAttributeIndex = emberAfGetServerAttributeIndexByAttributeId(aEndpointId, aClusterId, aClusterInfo.mAttributeId); + mAttributeIndex = emberAfGetServerAttributeIndexByAttributeId(aEndpointId, aClusterId, aAttributePath.mAttributeId); // If the given attribute id does not exist on the given endpoint, it will return uint16(0xFFFF), then endAttributeIndex // will be 0, means we should iterate a null attribute set (skip it). mEndAttributeIndex = static_cast(mAttributeIndex + 1); @@ -129,7 +129,7 @@ void AttributePathExpandIterator::PrepareAttributeIndexRange(const ClusterInfo & mGlobalAttributeIndex = UINT8_MAX; for (uint8_t idx = 0; idx < ArraySize(GlobalAttributesNotInMetadata); ++idx) { - if (GlobalAttributesNotInMetadata[idx] == aClusterInfo.mAttributeId) + if (GlobalAttributesNotInMetadata[idx] == aAttributePath.mAttributeId) { mGlobalAttributeIndex = idx; break; @@ -142,25 +142,25 @@ void AttributePathExpandIterator::PrepareAttributeIndexRange(const ClusterInfo & bool AttributePathExpandIterator::Next() { - for (; mpClusterInfo != nullptr; (mpClusterInfo = mpClusterInfo->mpNext, mEndpointIndex = UINT16_MAX)) + for (; mpAttributePath != nullptr; (mpAttributePath = mpAttributePath->mpNext, mEndpointIndex = UINT16_MAX)) { - mOutputPath.mExpanded = mpClusterInfo->HasAttributeWildcard(); + mOutputPath.mExpanded = mpAttributePath->mValue.HasAttributeWildcard(); if (mEndpointIndex == UINT16_MAX) { // Special case: If this is a concrete path, we just return its value as-is. - if (!mpClusterInfo->HasAttributeWildcard()) + if (!mpAttributePath->mValue.HasAttributeWildcard()) { - mOutputPath.mEndpointId = mpClusterInfo->mEndpointId; - mOutputPath.mClusterId = mpClusterInfo->mClusterId; - mOutputPath.mAttributeId = mpClusterInfo->mAttributeId; + mOutputPath.mEndpointId = mpAttributePath->mValue.mEndpointId; + mOutputPath.mClusterId = mpAttributePath->mValue.mClusterId; + mOutputPath.mAttributeId = mpAttributePath->mValue.mAttributeId; // Prepare for next iteration mEndpointIndex = mEndEndpointIndex = 0; return true; } - PrepareEndpointIndexRange(*mpClusterInfo); + PrepareEndpointIndexRange(mpAttributePath->mValue); mClusterIndex = UINT8_MAX; } @@ -177,7 +177,7 @@ bool AttributePathExpandIterator::Next() if (mClusterIndex == UINT8_MAX) { - PrepareClusterIndexRange(*mpClusterInfo, endpointId); + PrepareClusterIndexRange(mpAttributePath->mValue, endpointId); mAttributeIndex = UINT16_MAX; mGlobalAttributeIndex = UINT8_MAX; } @@ -190,7 +190,7 @@ bool AttributePathExpandIterator::Next() ClusterId clusterId = emberAfGetNthClusterId(endpointId, mClusterIndex, true /* server */).Value(); if (mAttributeIndex == UINT16_MAX && mGlobalAttributeIndex == UINT8_MAX) { - PrepareAttributeIndexRange(*mpClusterInfo, endpointId, clusterId); + PrepareAttributeIndexRange(mpAttributePath->mValue, endpointId, clusterId); } if (mAttributeIndex < mEndAttributeIndex) @@ -202,7 +202,7 @@ bool AttributePathExpandIterator::Next() mOutputPath.mEndpointId = endpointId; mAttributeIndex++; // We found a valid attribute path, now return and increase the attribute index for next iteration. - // Return true will skip the increment of mClusterIndex, mEndpointIndex and mpClusterInfo. + // Return true will skip the increment of mClusterIndex, mEndpointIndex and mpAttributePath. return true; } if (mGlobalAttributeIndex < mGlobalAttributeEndIndex) diff --git a/src/app/AttributePathExpandIterator.h b/src/app/AttributePathExpandIterator.h index 75463aeb823ad4..693c20cb024ba9 100644 --- a/src/app/AttributePathExpandIterator.h +++ b/src/app/AttributePathExpandIterator.h @@ -18,13 +18,13 @@ /** * @file - * Defines an iterator for iterating all possible paths from a list of ClusterInfo-s according to spec section 8.9.2.2 (Valid - * Attribute Paths) + * Defines an iterator for iterating all possible paths from a list of AttributePathParams-s according to spec section 8.9.2.2 + * (Valid Attribute Paths) */ #pragma once -#include +#include #include #include #include @@ -42,18 +42,18 @@ namespace chip { namespace app { /** - * AttributePathExpandIterator is used to iterate over a linked list of ClusterInfo-s. + * AttributePathExpandIterator is used to iterate over a linked list of AttributePathParams-s. * The AttributePathExpandIterator is copiable, however, the given cluster info must be valid when calling Next(). * - * AttributePathExpandIterator will expand attribute paths with wildcards, and only emit existing paths for ClusterInfo with - * wildcards. For ClusterInfo with a concrete path (i.e. does not contain wildcards), AttributePathExpandIterator will emit them - * as-is. + * AttributePathExpandIterator will expand attribute paths with wildcards, and only emit existing paths for AttributePathParams with + * wildcards. For AttributePathParams with a concrete path (i.e. does not contain wildcards), AttributePathExpandIterator will emit + * them as-is. * * The typical use of AttributePathExpandIterator may look like: * ConcreteAttributePath path; - * for (AttributePathExpandIterator iterator(clusterInfo); iterator.Get(path); iterator.Next()) {...} + * for (AttributePathExpandIterator iterator(AttributePathParams); iterator.Get(path); iterator.Next()) {...} * - * The iterator does not copy the given ClusterInfo, The given ClusterInfo must be valid when using the iterator. + * The iterator does not copy the given AttributePathParams, The given AttributePathParams must be valid when using the iterator. * If the set of endpoints, clusters, or attributes that are supported changes, AttributePathExpandIterator must be reinitialized. * * A initialized iterator will return the first valid path, no need to call Next() before calling Get() for the first time. @@ -63,17 +63,18 @@ namespace app { * - Chunk full, return * - In a new chunk, Get() * - * TODO: The ClusterInfo may support a group id, the iterator should be able to call group data provider to expand the group id. + * TODO: The AttributePathParams may support a group id, the iterator should be able to call group data provider to expand the group + * id. */ class AttributePathExpandIterator { public: - AttributePathExpandIterator(ClusterInfo * aClusterInfo); + AttributePathExpandIterator(ObjectList * aAttributePath); /** * Proceed the iterator to the next attribute path in the given cluster info. * - * Returns false if AttributePathExpandIterator has exhausted all paths in the given ClusterInfo list. + * Returns false if AttributePathExpandIterator has exhausted all paths in the given AttributePathParams list. */ bool Next(); @@ -90,12 +91,12 @@ class AttributePathExpandIterator /** * Returns if the iterator is valid (not exhausted). An iterator is exhausted if and only if: * - Next() is called after iterating last path. - * - Iterator is initialized with a null ClusterInfo. + * - Iterator is initialized with a null AttributePathParams. */ - inline bool Valid() const { return mpClusterInfo != nullptr; } + inline bool Valid() const { return mpAttributePath != nullptr; } private: - ClusterInfo * mpClusterInfo; + ObjectList * mpAttributePath; uint16_t mEndpointIndex, mEndEndpointIndex; // Note: should use decltype(EmberAfEndpointType::clusterCount) here, but af-types is including app specific generated files. @@ -109,16 +110,16 @@ class AttributePathExpandIterator /** * Prepare*IndexRange will update mBegin*Index and mEnd*Index variables. - * If ClusterInfo contains a wildcard field, it will set mBegin*Index to 0 and mEnd*Index to count. + * If AttributePathParams contains a wildcard field, it will set mBegin*Index to 0 and mEnd*Index to count. * Or it will set mBegin*Index to the index of the Endpoint/Cluster/Attribute, and mEnd*Index to mBegin*Index + 1. * * If the Endpoint/Cluster/Attribute does not exist, mBegin*Index will be UINT*_MAX, and mEnd*Inde will be 0. * * The index can be used with emberAfEndpointFromIndex, emberAfGetNthClusterId and emberAfGetServerAttributeIdByIndex. */ - void PrepareEndpointIndexRange(const ClusterInfo & aClusterInfo); - void PrepareClusterIndexRange(const ClusterInfo & aClusterInfo, EndpointId aEndpointId); - void PrepareAttributeIndexRange(const ClusterInfo & aClusterInfo, EndpointId aEndpointId, ClusterId aClusterId); + void PrepareEndpointIndexRange(const AttributePathParams & aAttributePath); + void PrepareClusterIndexRange(const AttributePathParams & aAttributePath, EndpointId aEndpointId); + void PrepareAttributeIndexRange(const AttributePathParams & aAttributePath, EndpointId aEndpointId, ClusterId aClusterId); }; } // namespace app } // namespace chip diff --git a/src/app/AttributePathParams.h b/src/app/AttributePathParams.h index 7c79585a027433..6dd9b135ca9f5d 100644 --- a/src/app/AttributePathParams.h +++ b/src/app/AttributePathParams.h @@ -18,10 +18,9 @@ #pragma once +#include #include -#include - namespace chip { namespace app { struct AttributePathParams @@ -30,8 +29,6 @@ struct AttributePathParams // TODO: (Issue #10596) Need to ensure that we do not encode the NodeId over the wire // if it is either not 'set', or is set to a value that matches accessing fabric // on which the interaction is undertaken. - // - // TODO: (#11420) This class is overlapped with ClusterInfo class, need to do a clean up. AttributePathParams(EndpointId aEndpointId, ClusterId aClusterId) : AttributePathParams(aEndpointId, aClusterId, kInvalidAttributeId, kInvalidListIndex) {} @@ -45,7 +42,7 @@ struct AttributePathParams {} AttributePathParams(EndpointId aEndpointId, ClusterId aClusterId, AttributeId aAttributeId, ListIndex aListIndex) : - mEndpointId(aEndpointId), mClusterId(aClusterId), mAttributeId(aAttributeId), mListIndex(aListIndex) + mClusterId(aClusterId), mAttributeId(aAttributeId), mEndpointId(aEndpointId), mListIndex(aListIndex) {} AttributePathParams() {} @@ -65,10 +62,29 @@ struct AttributePathParams inline bool HasWildcardAttributeId() const { return mAttributeId == kInvalidAttributeId; } inline bool HasWildcardListIndex() const { return mListIndex == kInvalidListIndex; } - EndpointId mEndpointId = kInvalidEndpointId; - ClusterId mClusterId = kInvalidClusterId; - AttributeId mAttributeId = kInvalidAttributeId; - ListIndex mListIndex = kInvalidListIndex; + bool IsAttributePathSupersetOf(const AttributePathParams & other) const + { + VerifyOrReturnError(HasWildcardEndpointId() || mEndpointId == other.mEndpointId, false); + VerifyOrReturnError(HasWildcardClusterId() || mClusterId == other.mClusterId, false); + VerifyOrReturnError(HasWildcardAttributeId() || mAttributeId == other.mAttributeId, false); + VerifyOrReturnError(HasWildcardListIndex() || mListIndex == other.mListIndex, false); + + return true; + } + + bool IsAttributePathSupersetOf(const ConcreteAttributePath & other) const + { + VerifyOrReturnError(HasWildcardEndpointId() || mEndpointId == other.mEndpointId, false); + VerifyOrReturnError(HasWildcardClusterId() || mClusterId == other.mClusterId, false); + VerifyOrReturnError(HasWildcardAttributeId() || mAttributeId == other.mAttributeId, false); + + return true; + } + + ClusterId mClusterId = kInvalidClusterId; // uint32 + AttributeId mAttributeId = kInvalidAttributeId; // uint32 + EndpointId mEndpointId = kInvalidEndpointId; // uint16 + ListIndex mListIndex = kInvalidListIndex; // uint16 }; } // namespace app } // namespace chip diff --git a/src/app/ClusterInfo.h b/src/app/ClusterInfo.h deleted file mode 100644 index 2e3e0ddeab3ab1..00000000000000 --- a/src/app/ClusterInfo.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace chip { -namespace app { - -/** - * ClusterInfo is the representation of an attribute path or an event path used by ReadHandler, ReadClient, WriteHandler, - * Report::Engine etc, it uses some invalid values for representing the wildcard values for its fields and contains a mpNext field - * so it can be used as a linked list. - */ -// TODO: The cluster info should be separated into AttributeInfo and EventInfo. -// Note: The user of ClusterInfo today is ReadHandler and ReportEngine, both of them do not accept Null list index (means list -// append operations) -// Note: The change will happen after #11171 with a better linked list. -struct ClusterInfo -{ -public: - bool IsAttributePathSupersetOf(const ClusterInfo & other) const - { - VerifyOrReturnError(HasWildcardEndpointId() || mEndpointId == other.mEndpointId, false); - VerifyOrReturnError(HasWildcardClusterId() || mClusterId == other.mClusterId, false); - VerifyOrReturnError(HasWildcardAttributeId() || mAttributeId == other.mAttributeId, false); - VerifyOrReturnError(HasWildcardListIndex() || mListIndex == other.mListIndex, false); - - return true; - } - - bool IsAttributePathSupersetOf(const ConcreteAttributePath & other) const - { - VerifyOrReturnError(HasWildcardEndpointId() || mEndpointId == other.mEndpointId, false); - VerifyOrReturnError(HasWildcardClusterId() || mClusterId == other.mClusterId, false); - VerifyOrReturnError(HasWildcardAttributeId() || mAttributeId == other.mAttributeId, false); - - return true; - } - - bool IsEventPathSupersetOf(const ConcreteEventPath & other) const - { - VerifyOrReturnError(HasWildcardEndpointId() || mEndpointId == other.mEndpointId, false); - VerifyOrReturnError(HasWildcardClusterId() || mClusterId == other.mClusterId, false); - VerifyOrReturnError(HasWildcardEventId() || mEventId == other.mEventId, false); - - return true; - } - - bool HasAttributeWildcard() const { return HasWildcardEndpointId() || HasWildcardClusterId() || HasWildcardAttributeId(); } - bool HasEventWildcard() const { return HasWildcardEndpointId() || HasWildcardClusterId() || HasWildcardEventId(); } - /** - * Check that the path meets some basic constraints of an attribute path: If list index is not wildcard, then field id must not - * be wildcard. This does not verify that the attribute being targeted is actually of list type when the list index is not - * wildcard. - */ - bool IsValidAttributePath() const { return HasWildcardListIndex() || !HasWildcardAttributeId(); } - - // For event, an event id can only be interpreted if the cluster id is known. - bool IsValidEventPath() const { return !(HasWildcardClusterId() && !HasWildcardEventId()); } - - bool IsValidDataVersionFilter() const { return !HasWildcardEndpointId() && !HasWildcardClusterId() && mDataVersion.HasValue(); } - - inline bool HasWildcardNodeId() const { return mNodeId == kUndefinedNodeId; } - inline bool HasWildcardEndpointId() const { return mEndpointId == kInvalidEndpointId; } - inline bool HasWildcardClusterId() const { return mClusterId == kInvalidClusterId; } - inline bool HasWildcardAttributeId() const { return mAttributeId == kInvalidAttributeId; } - inline bool HasWildcardListIndex() const { return mListIndex == kInvalidListIndex; } - inline bool HasWildcardEventId() const { return mEventId == kInvalidEventId; } - - ClusterInfo() {} - /* - * For better structure alignment - * Below ordering is by bit-size to ensure least amount of memory alignment padding. - * Changing order to something more natural (e.g. endpoint id before cluster id) will result - * in extra memory alignment padding. - */ - NodeId mNodeId = kUndefinedNodeId; // uint64 - ClusterInfo * mpNext = nullptr; // pointer width (32/64 bits) - ClusterId mClusterId = kInvalidClusterId; // uint32 - AttributeId mAttributeId = kInvalidAttributeId; // uint32 - EventId mEventId = kInvalidEventId; // uint32 - ListIndex mListIndex = kInvalidListIndex; // uint16 - EndpointId mEndpointId = kInvalidEndpointId; // uint16 - Optional mDataVersion; // uint32 - bool mIsUrgentEvent = false; // uint8 -}; -} // namespace app -} // namespace chip diff --git a/src/app/DataVersionFilter.h b/src/app/DataVersionFilter.h index 1a6608e04a47eb..2794048170e53f 100644 --- a/src/app/DataVersionFilter.h +++ b/src/app/DataVersionFilter.h @@ -20,14 +20,12 @@ #include -#include - namespace chip { namespace app { struct DataVersionFilter { DataVersionFilter(EndpointId aEndpointId, ClusterId aClusterId, DataVersion aDataVersion) : - mEndpointId(aEndpointId), mClusterId(aClusterId), mDataVersion(aDataVersion) + mClusterId(aClusterId), mDataVersion(aDataVersion), mEndpointId(aEndpointId) {} DataVersionFilter() {} @@ -37,9 +35,9 @@ struct DataVersionFilter return (mEndpointId != kInvalidEndpointId) && (mClusterId != kInvalidClusterId) && (mDataVersion.HasValue()); } - EndpointId mEndpointId = kInvalidEndpointId; - ClusterId mClusterId = kInvalidClusterId; - Optional mDataVersion; + ClusterId mClusterId = kInvalidClusterId; // uint32 + Optional mDataVersion; // uint32 + EndpointId mEndpointId = kInvalidEndpointId; // uint16 }; } // namespace app } // namespace chip diff --git a/src/app/EventLoggingTypes.h b/src/app/EventLoggingTypes.h index 28a891af821e5a..a3805a81a89a06 100644 --- a/src/app/EventLoggingTypes.h +++ b/src/app/EventLoggingTypes.h @@ -18,7 +18,8 @@ #pragma once #include -#include +#include +#include #include #include #include @@ -151,10 +152,10 @@ struct EventLoadOutContext EventNumber mStartingEventNumber = 0; Timestamp mPreviousTime; Timestamp mCurrentTime; - EventNumber mCurrentEventNumber = 0; - size_t mEventCount = 0; - ClusterInfo * mpInterestedEventPaths = nullptr; - bool mFirst = true; + EventNumber mCurrentEventNumber = 0; + size_t mEventCount = 0; + ObjectList * mpInterestedEventPaths = nullptr; + bool mFirst = true; Access::SubjectDescriptor mSubjectDescriptor; }; } // namespace app diff --git a/src/app/EventManagement.cpp b/src/app/EventManagement.cpp index 7de40feb570f12..3ec34237fa4e26 100644 --- a/src/app/EventManagement.cpp +++ b/src/app/EventManagement.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -608,10 +609,10 @@ CHIP_ERROR EventManagement::CheckEventContext(EventLoadOutContext * eventLoadOut for (auto * interestedPath = eventLoadOutContext->mpInterestedEventPaths; interestedPath != nullptr; interestedPath = interestedPath->mpNext) { - if (interestedPath->IsEventPathSupersetOf(path)) + if (interestedPath->mValue.IsEventPathSupersetOf(path)) { ret = CHIP_NO_ERROR; - if (!interestedPath->HasEventWildcard()) + if (!interestedPath->mValue.HasEventWildcard()) { eventReadViaConcretePath = true; break; @@ -732,8 +733,9 @@ CHIP_ERROR EventManagement::CopyEventsSince(const TLVReader & aReader, size_t aD return err; } -CHIP_ERROR EventManagement::FetchEventsSince(TLVWriter & aWriter, ClusterInfo * apClusterInfolist, EventNumber & aEventMin, - size_t & aEventCount, const Access::SubjectDescriptor & aSubjectDescriptor) +CHIP_ERROR EventManagement::FetchEventsSince(TLVWriter & aWriter, ObjectList * apEventPathList, + EventNumber & aEventMin, size_t & aEventCount, + const Access::SubjectDescriptor & aSubjectDescriptor) { // TODO: Add particular set of event Paths in FetchEventsSince so that we can filter the interested paths CHIP_ERROR err = CHIP_NO_ERROR; @@ -747,7 +749,7 @@ CHIP_ERROR EventManagement::FetchEventsSince(TLVWriter & aWriter, ClusterInfo * #endif // !CHIP_SYSTEM_CONFIG_NO_LOCKING context.mSubjectDescriptor = aSubjectDescriptor; - context.mpInterestedEventPaths = apClusterInfolist; + context.mpInterestedEventPaths = apEventPathList; err = GetEventReader(reader, PriorityLevel::Critical, &bufWrapper); SuccessOrExit(err); diff --git a/src/app/EventManagement.h b/src/app/EventManagement.h index 9d6802105cc237..e4dbe9a6bbc530 100644 --- a/src/app/EventManagement.h +++ b/src/app/EventManagement.h @@ -29,9 +29,9 @@ #include "EventLoggingDelegate.h" #include "EventLoggingTypes.h" #include -#include #include #include +#include #include #include #include @@ -320,7 +320,7 @@ class EventManagement * specified by read/subscribe request. * * @param[in] aWriter The writer to use for event storage - * @param[in] apClusterInfolist the interested cluster info list with event path inside + * @param[in] apEventPathList the interested EventPathParams list * * @param[in,out] aEventMin On input, the Event number is the one we're fetching. On * completion, the event number of the next one we plan to fetch. @@ -340,8 +340,9 @@ class EventManagement * available. * */ - CHIP_ERROR FetchEventsSince(chip::TLV::TLVWriter & aWriter, ClusterInfo * apClusterInfolist, EventNumber & aEventMin, - size_t & aEventCount, const Access::SubjectDescriptor & aSubjectDescriptor); + CHIP_ERROR FetchEventsSince(chip::TLV::TLVWriter & aWriter, ObjectList * apEventPathList, + EventNumber & aEventMin, size_t & aEventCount, + const Access::SubjectDescriptor & aSubjectDescriptor); /** * @brief diff --git a/src/app/EventPathParams.h b/src/app/EventPathParams.h index 0516874cf41535..0a8cea3ee1acaa 100644 --- a/src/app/EventPathParams.h +++ b/src/app/EventPathParams.h @@ -18,16 +18,16 @@ #pragma once +#include #include - -#include +#include namespace chip { namespace app { struct EventPathParams { EventPathParams(EndpointId aEndpointId, ClusterId aClusterId, EventId aEventId, bool aUrgentEvent = false) : - mEndpointId(aEndpointId), mClusterId(aClusterId), mEventId(aEventId), mIsUrgentEvent(aUrgentEvent) + mClusterId(aClusterId), mEventId(aEventId), mEndpointId(aEndpointId), mIsUrgentEvent(aUrgentEvent) {} EventPathParams() {} bool IsSamePath(const EventPathParams & other) const @@ -44,10 +44,19 @@ struct EventPathParams inline bool HasWildcardClusterId() const { return mClusterId == kInvalidClusterId; } inline bool HasWildcardEventId() const { return mEventId == kInvalidEventId; } - EndpointId mEndpointId = kInvalidEndpointId; - ClusterId mClusterId = kInvalidClusterId; - EventId mEventId = kInvalidEventId; - bool mIsUrgentEvent = false; + bool IsEventPathSupersetOf(const ConcreteEventPath & other) const + { + VerifyOrReturnError(HasWildcardEndpointId() || mEndpointId == other.mEndpointId, false); + VerifyOrReturnError(HasWildcardClusterId() || mClusterId == other.mClusterId, false); + VerifyOrReturnError(HasWildcardEventId() || mEventId == other.mEventId, false); + + return true; + } + + ClusterId mClusterId = kInvalidClusterId; // uint32 + EventId mEventId = kInvalidEventId; // uint32 + EndpointId mEndpointId = kInvalidEndpointId; // uint16 + bool mIsUrgentEvent = false; // uint8 }; } // namespace app } // namespace chip diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index 12f352e8f2c76c..2a67cc1e8bc20a 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -110,8 +110,9 @@ void InteractionModelEngine::Shutdown() } mReportingEngine.Shutdown(); - mClusterInfoPool.ReleaseAll(); - + mAttributePathPool.ReleaseAll(); + mEventPathPool.ReleaseAll(); + mDataVersionFilterPool.ReleaseAll(); mpExchangeMgr->UnregisterUnsolicitedMessageHandlerForProtocol(Protocols::InteractionModel::Id); } @@ -559,44 +560,93 @@ bool InteractionModelEngine::HasConflictWriteRequests(const WriteHandler * apWri return false; } -void InteractionModelEngine::ReleaseClusterInfoList(ClusterInfo *& aClusterInfo) +void InteractionModelEngine::ReleaseAttributePathList(ObjectList *& aAttributePathList) +{ + ReleasePool(aAttributePathList, mAttributePathPool); +} + +CHIP_ERROR InteractionModelEngine::PushFrontAttributePathList(ObjectList *& aAttributePathList, + AttributePathParams & aAttributePath) +{ + CHIP_ERROR err = PushFront(aAttributePathList, aAttributePath, mAttributePathPool); + if (err == CHIP_ERROR_NO_MEMORY) + { + ChipLogError(InteractionModel, "AttributePath pool full, cannot handle more entries!"); + } + return err; +} + +void InteractionModelEngine::ReleaseEventPathList(ObjectList *& aEventPathList) +{ + ReleasePool(aEventPathList, mEventPathPool); +} + +CHIP_ERROR InteractionModelEngine::PushFrontEventPathParamsList(ObjectList *& aEventPathList, + EventPathParams & aEventPath) +{ + CHIP_ERROR err = PushFront(aEventPathList, aEventPath, mEventPathPool); + if (err == CHIP_ERROR_NO_MEMORY) + { + ChipLogError(InteractionModel, "EventPath pool full, cannot handle more entries!"); + } + return err; +} + +void InteractionModelEngine::ReleaseDataVersionFilterList(ObjectList *& aDataVersionFilterList) +{ + ReleasePool(aDataVersionFilterList, mDataVersionFilterPool); +} + +CHIP_ERROR InteractionModelEngine::PushFrontDataVersionFilterList(ObjectList *& aDataVersionFilterList, + DataVersionFilter & aDataVersionFilter) +{ + CHIP_ERROR err = PushFront(aDataVersionFilterList, aDataVersionFilter, mDataVersionFilterPool); + if (err == CHIP_ERROR_NO_MEMORY) + { + ChipLogError(InteractionModel, "DataVersionFilter pool full, cannot handle more entries, reset this error and continue!"); + err = CHIP_NO_ERROR; + } + return err; +} + +template +void InteractionModelEngine::ReleasePool(ObjectList *& aObjectList, ObjectPool, N> & aObjectPool) { - ClusterInfo * current = aClusterInfo; + ObjectList * current = aObjectList; while (current != nullptr) { - ClusterInfo * next = current->mpNext; - mClusterInfoPool.ReleaseObject(current); + ObjectList * next = current->mpNext; + aObjectPool.ReleaseObject(current); current = next; } - aClusterInfo = nullptr; + aObjectList = nullptr; } -CHIP_ERROR InteractionModelEngine::PushFront(ClusterInfo *& aClusterInfoList, ClusterInfo & aClusterInfo) +template +CHIP_ERROR InteractionModelEngine::PushFront(ObjectList *& aObjectList, T & aData, ObjectPool, N> & aObjectPool) { - ClusterInfo * clusterInfo = mClusterInfoPool.CreateObject(); - if (clusterInfo == nullptr) + ObjectList * object = aObjectPool.CreateObject(); + if (object == nullptr) { - ChipLogError(InteractionModel, "ClusterInfo pool full, cannot handle more entries!"); return CHIP_ERROR_NO_MEMORY; } - *clusterInfo = aClusterInfo; - clusterInfo->mpNext = aClusterInfoList; - aClusterInfoList = clusterInfo; + object->mValue = aData; + object->mpNext = aObjectList; + aObjectList = object; return CHIP_NO_ERROR; } -bool InteractionModelEngine::IsOverlappedAttributePath(ClusterInfo & aAttributePath) +bool InteractionModelEngine::IsOverlappedAttributePath(AttributePathParams & aAttributePath) { return (mReadHandlers.ForEachActiveObject([&aAttributePath](ReadHandler * handler) { if (handler->IsType(ReadHandler::InteractionType::Subscribe) && (handler->IsGeneratingReports() || handler->IsAwaitingReportResponse())) { - for (auto clusterInfo = handler->GetAttributeClusterInfolist(); clusterInfo != nullptr; - clusterInfo = clusterInfo->mpNext) + for (auto object = handler->GetAttributePathList(); object != nullptr; object = object->mpNext) { - if (clusterInfo->IsAttributePathSupersetOf(aAttributePath) || - aAttributePath.IsAttributePathSupersetOf(*clusterInfo)) + if (object->mValue.IsAttributePathSupersetOf(aAttributePath) || + aAttributePath.IsAttributePathSupersetOf(object->mValue)) { return Loop::Break; } diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h index 572e9cbb35e833..6f1482c63ea769 100644 --- a/src/app/InteractionModelEngine.h +++ b/src/app/InteractionModelEngine.h @@ -40,12 +40,15 @@ #include #include -#include +#include #include #include #include #include #include +#include +#include +#include #include #include #include @@ -133,9 +136,21 @@ class InteractionModelEngine : public Messaging::ExchangeDelegate, public Comman reporting::Engine & GetReportingEngine() { return mReportingEngine; } - void ReleaseClusterInfoList(ClusterInfo *& aClusterInfo); - CHIP_ERROR PushFront(ClusterInfo *& aClusterInfoLisst, ClusterInfo & aClusterInfo); - bool IsOverlappedAttributePath(ClusterInfo & aAttributePath); + void ReleaseAttributePathList(ObjectList *& aAttributePathList); + + CHIP_ERROR PushFrontAttributePathList(ObjectList *& aAttributePathList, + AttributePathParams & aAttributePath); + + void ReleaseEventPathList(ObjectList *& aEventPathList); + + CHIP_ERROR PushFrontEventPathParamsList(ObjectList *& aEventPathList, EventPathParams & aEventPath); + + void ReleaseDataVersionFilterList(ObjectList *& aDataVersionFilterList); + + CHIP_ERROR PushFrontDataVersionFilterList(ObjectList *& aDataVersionFilterList, + DataVersionFilter & aDataVersionFilter); + + bool IsOverlappedAttributePath(AttributePathParams & aAttributePath); CHIP_ERROR RegisterCommandHandler(CommandHandlerInterface * handler); CHIP_ERROR UnregisterCommandHandler(CommandHandlerInterface * handler); @@ -291,6 +306,11 @@ class InteractionModelEngine : public Messaging::ExchangeDelegate, public Comman CHIP_ERROR ShutdownExistingSubscriptionsIfNeeded(Messaging::ExchangeContext * apExchangeContext, System::PacketBufferHandle && aPayload); + template + void ReleasePool(ObjectList *& aObjectList, ObjectPool, N> & aObjectPool); + template + CHIP_ERROR PushFront(ObjectList *& aObjectList, T & aData, ObjectPool, N> & aObjectPool); + Messaging::ExchangeManager * mpExchangeMgr = nullptr; CommandHandlerInterface * mCommandHandlerList = nullptr; @@ -300,8 +320,9 @@ class InteractionModelEngine : public Messaging::ExchangeDelegate, public Comman ObjectPool mReadHandlers; WriteHandler mWriteHandlers[CHIP_IM_MAX_NUM_WRITE_HANDLER]; reporting::Engine mReportingEngine; - ObjectPool mClusterInfoPool; - + ObjectPool, CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS> mAttributePathPool; + ObjectPool, CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS> mEventPathPool; + ObjectPool, CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS> mDataVersionFilterPool; ReadClient * mpActiveReadClientList = nullptr; #if CONFIG_IM_BUILD_FOR_UNIT_TEST @@ -328,13 +349,11 @@ Protocols::InteractionModel::Status ServerClusterCommandExists(const ConcreteCom * Fetch attribute value and version info and write to the AttributeReport provided. * The ReadSingleClusterData will do everything required for encoding an attribute, i.e. it will try to put one or more * AttributeReportIB to the AttributeReportIBs::Builder. - * When the endpoint / cluster / attribute / event data specified by aClusterInfo does not exist, corresponding interaction model - * error code will be put into the writer, and CHIP_NO_ERROR will be returned. - * If the data exists on the server, the data (with tag kData) and the data version (with tag kDataVersion) will be put - * into the TLVWriter. TLVWriter error will be returned if any error occurred during encoding - * these values. - * This function is implemented by CHIP as a part of cluster data storage & management. - * The apWriter and apDataExists can be nullptr. + * When the endpoint / cluster / attribute data specified by aPath does not exist, corresponding interaction + * model error code will be put into aAttributeReports, and CHIP_NO_ERROR will be returned. If the data exists on the server, the + * data (with tag kData) and the data version (with tag kDataVersion) will be put into aAttributeReports. TLVWriter error will be + * returned if any error occurred while encoding these values. This function is implemented by CHIP as a part of cluster data + * storage & management. * * @param[in] aSubjectDescriptor The subject descriptor for the read. * @param[in] aPath The concrete path of the data being read. diff --git a/src/app/MessageDef/AttributePathIB.h b/src/app/MessageDef/AttributePathIB.h index a7df656b57d566..24d0bbd03641a4 100644 --- a/src/app/MessageDef/AttributePathIB.h +++ b/src/app/MessageDef/AttributePathIB.h @@ -23,6 +23,7 @@ #include #include +#include #include #include #include diff --git a/src/app/MessageDef/EventPathIB.h b/src/app/MessageDef/EventPathIB.h index e1a77532d460e7..d71c141733496d 100644 --- a/src/app/MessageDef/EventPathIB.h +++ b/src/app/MessageDef/EventPathIB.h @@ -22,6 +22,7 @@ #include "ListParser.h" #include +#include #include #include #include diff --git a/src/app/ObjectList.h b/src/app/ObjectList.h new file mode 100644 index 00000000000000..9069848a2f289f --- /dev/null +++ b/src/app/ObjectList.h @@ -0,0 +1,31 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +namespace chip { +namespace app { + +template +struct ObjectList +{ + T mValue; + ObjectList * mpNext = nullptr; +}; +} // namespace app +} // namespace chip diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index c30dac9849b06c..397acc7e159505 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/src/app/ReadHandler.cpp b/src/app/ReadHandler.cpp index 09f008f683bb2b..7e15f22b708c9d 100644 --- a/src/app/ReadHandler.cpp +++ b/src/app/ReadHandler.cpp @@ -95,9 +95,9 @@ ReadHandler::~ReadHandler() { InteractionModelEngine::GetInstance()->GetReportingEngine().OnReportConfirm(); } - InteractionModelEngine::GetInstance()->ReleaseClusterInfoList(mpAttributeClusterInfoList); - InteractionModelEngine::GetInstance()->ReleaseClusterInfoList(mpEventClusterInfoList); - InteractionModelEngine::GetInstance()->ReleaseClusterInfoList(mpDataVersionFilterList); + InteractionModelEngine::GetInstance()->ReleaseAttributePathList(mpAttributePathList); + InteractionModelEngine::GetInstance()->ReleaseEventPathList(mpEventPathList); + InteractionModelEngine::GetInstance()->ReleaseDataVersionFilterList(mpDataVersionFilterList); } void ReadHandler::Close() @@ -253,6 +253,7 @@ CHIP_ERROR ReadHandler::SendReportData(System::PacketBufferHandle && aPayload, b if (!aMoreChunks) { ClearDirty(); + InteractionModelEngine::GetInstance()->ReleaseDataVersionFilterList(mpDataVersionFilterList); } return err; } @@ -375,27 +376,27 @@ CHIP_ERROR ReadHandler::ProcessAttributePathList(AttributePathIBs::Parser & aAtt while (CHIP_NO_ERROR == (err = reader.Next())) { VerifyOrExit(TLV::AnonymousTag() == reader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG); - ClusterInfo clusterInfo; + AttributePathParams attribute; AttributePathIB::Parser path; err = path.Init(reader); SuccessOrExit(err); // TODO: MEIs (ClusterId and AttributeId) have a invalid pattern instead of a single invalid value, need to add separate // functions for checking if we have received valid values. // TODO: Wildcard cluster id with non-global attributes or wildcard attribute paths should be rejected. - err = path.GetEndpoint(&(clusterInfo.mEndpointId)); + err = path.GetEndpoint(&(attribute.mEndpointId)); if (err == CHIP_NO_ERROR) { - VerifyOrExit(!clusterInfo.HasWildcardEndpointId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); + VerifyOrExit(!attribute.HasWildcardEndpointId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); } else if (err == CHIP_END_OF_TLV) { err = CHIP_NO_ERROR; } SuccessOrExit(err); - err = path.GetCluster(&(clusterInfo.mClusterId)); + err = path.GetCluster(&(attribute.mClusterId)); if (err == CHIP_NO_ERROR) { - VerifyOrExit(!clusterInfo.HasWildcardClusterId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); + VerifyOrExit(!attribute.HasWildcardClusterId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); } else if (err == CHIP_END_OF_TLV) { @@ -403,21 +404,21 @@ CHIP_ERROR ReadHandler::ProcessAttributePathList(AttributePathIBs::Parser & aAtt } SuccessOrExit(err); - err = path.GetAttribute(&(clusterInfo.mAttributeId)); + err = path.GetAttribute(&(attribute.mAttributeId)); if (CHIP_END_OF_TLV == err) { err = CHIP_NO_ERROR; } else if (err == CHIP_NO_ERROR) { - VerifyOrExit(!clusterInfo.HasWildcardAttributeId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); + VerifyOrExit(!attribute.HasWildcardAttributeId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); } SuccessOrExit(err); - err = path.GetListIndex(&(clusterInfo.mListIndex)); + err = path.GetListIndex(&(attribute.mListIndex)); if (CHIP_NO_ERROR == err) { - VerifyOrExit(!clusterInfo.HasWildcardAttributeId() && !clusterInfo.HasWildcardListIndex(), + VerifyOrExit(!attribute.HasWildcardAttributeId() && !attribute.HasWildcardListIndex(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); } else if (CHIP_END_OF_TLV == err) @@ -425,13 +426,13 @@ CHIP_ERROR ReadHandler::ProcessAttributePathList(AttributePathIBs::Parser & aAtt err = CHIP_NO_ERROR; } SuccessOrExit(err); - err = InteractionModelEngine::GetInstance()->PushFront(mpAttributeClusterInfoList, clusterInfo); + err = InteractionModelEngine::GetInstance()->PushFrontAttributePathList(mpAttributePathList, attribute); SuccessOrExit(err); } // if we have exhausted this container if (CHIP_END_OF_TLV == err) { - mAttributePathExpandIterator = AttributePathExpandIterator(mpAttributeClusterInfoList); + mAttributePathExpandIterator = AttributePathExpandIterator(mpAttributePathList); err = CHIP_NO_ERROR; } @@ -448,18 +449,19 @@ CHIP_ERROR ReadHandler::ProcessDataVersionFilterList(DataVersionFilterIBs::Parse while (CHIP_NO_ERROR == (err = reader.Next())) { VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG); - ClusterInfo clusterInfo; + DataVersionFilter versionFilter; ClusterPathIB::Parser path; DataVersionFilterIB::Parser filter; ReturnErrorOnFailure(filter.Init(reader)); DataVersion version = 0; ReturnErrorOnFailure(filter.GetDataVersion(&version)); - clusterInfo.mDataVersion.SetValue(version); + versionFilter.mDataVersion.SetValue(version); ReturnErrorOnFailure(filter.GetPath(&path)); - ReturnErrorOnFailure(path.GetEndpoint(&(clusterInfo.mEndpointId))); - ReturnErrorOnFailure(path.GetCluster(&(clusterInfo.mClusterId))); - VerifyOrReturnError(clusterInfo.IsValidDataVersionFilter(), CHIP_ERROR_IM_MALFORMED_DATA_VERSION_FILTER_IB); - ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->PushFront(mpDataVersionFilterList, clusterInfo)); + ReturnErrorOnFailure(path.GetEndpoint(&(versionFilter.mEndpointId))); + ReturnErrorOnFailure(path.GetCluster(&(versionFilter.mClusterId))); + VerifyOrReturnError(versionFilter.IsValidDataVersionFilter(), CHIP_ERROR_IM_MALFORMED_DATA_VERSION_FILTER_IB); + ReturnErrorOnFailure( + InteractionModelEngine::GetInstance()->PushFrontDataVersionFilterList(mpDataVersionFilterList, versionFilter)); } if (CHIP_END_OF_TLV == err) @@ -478,14 +480,14 @@ CHIP_ERROR ReadHandler::ProcessEventPaths(EventPathIBs::Parser & aEventPathsPars while (CHIP_NO_ERROR == (err = reader.Next())) { VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG); - ClusterInfo clusterInfo; + EventPathParams event; EventPathIB::Parser path; ReturnErrorOnFailure(path.Init(reader)); - err = path.GetEndpoint(&(clusterInfo.mEndpointId)); + err = path.GetEndpoint(&(event.mEndpointId)); if (err == CHIP_NO_ERROR) { - VerifyOrReturnError(!clusterInfo.HasWildcardEndpointId(), err = CHIP_ERROR_IM_MALFORMED_EVENT_PATH); + VerifyOrReturnError(!event.HasWildcardEndpointId(), err = CHIP_ERROR_IM_MALFORMED_EVENT_PATH); } else if (err == CHIP_END_OF_TLV) { @@ -493,10 +495,10 @@ CHIP_ERROR ReadHandler::ProcessEventPaths(EventPathIBs::Parser & aEventPathsPars } ReturnErrorOnFailure(err); - err = path.GetCluster(&(clusterInfo.mClusterId)); + err = path.GetCluster(&(event.mClusterId)); if (err == CHIP_NO_ERROR) { - VerifyOrReturnError(!clusterInfo.HasWildcardClusterId(), err = CHIP_ERROR_IM_MALFORMED_EVENT_PATH); + VerifyOrReturnError(!event.HasWildcardClusterId(), err = CHIP_ERROR_IM_MALFORMED_EVENT_PATH); } else if (err == CHIP_END_OF_TLV) { @@ -504,25 +506,25 @@ CHIP_ERROR ReadHandler::ProcessEventPaths(EventPathIBs::Parser & aEventPathsPars } ReturnErrorOnFailure(err); - err = path.GetEvent(&(clusterInfo.mEventId)); + err = path.GetEvent(&(event.mEventId)); if (CHIP_END_OF_TLV == err) { err = CHIP_NO_ERROR; } else if (err == CHIP_NO_ERROR) { - VerifyOrReturnError(!clusterInfo.HasWildcardEventId(), err = CHIP_ERROR_IM_MALFORMED_EVENT_PATH); + VerifyOrReturnError(!event.HasWildcardEventId(), err = CHIP_ERROR_IM_MALFORMED_EVENT_PATH); } ReturnErrorOnFailure(err); - err = path.GetIsUrgent(&(clusterInfo.mIsUrgentEvent)); + err = path.GetIsUrgent(&(event.mIsUrgentEvent)); if (CHIP_END_OF_TLV == err) { err = CHIP_NO_ERROR; } ReturnErrorOnFailure(err); - ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->PushFront(mpEventClusterInfoList, clusterInfo)); + ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->PushFrontEventPathParamsList(mpEventPathList, event)); } // if we have exhausted this container diff --git a/src/app/ReadHandler.h b/src/app/ReadHandler.h index f2c4bfc390ecb4..8259c455a5a9f5 100644 --- a/src/app/ReadHandler.h +++ b/src/app/ReadHandler.h @@ -27,10 +27,13 @@ #include #include #include -#include +#include +#include #include +#include #include #include +#include #include #include #include @@ -133,9 +136,9 @@ class ReadHandler : public Messaging::ExchangeDelegate bool IsAwaitingReportResponse() const { return mState == HandlerState::AwaitingReportResponse; } CHIP_ERROR ProcessDataVersionFilterList(DataVersionFilterIBs::Parser & aDataVersionFilterListParser); - ClusterInfo * GetAttributeClusterInfolist() { return mpAttributeClusterInfoList; } - ClusterInfo * GetEventClusterInfolist() { return mpEventClusterInfoList; } - ClusterInfo * GetDataVersionFilterlist() const { return mpDataVersionFilterList; } + ObjectList * GetAttributePathList() { return mpAttributePathList; } + ObjectList * GetEventPathList() { return mpEventPathList; } + ObjectList * GetDataVersionFilterList() const { return mpDataVersionFilterList; } EventNumber & GetEventMin() { return mEventMin; } PriorityLevel GetCurrentPriority() { return mCurrentPriority; } @@ -157,7 +160,7 @@ class ReadHandler : public Messaging::ExchangeDelegate mDirty = true; // If the contents of the global dirty set have changed, we need to reset the iterator since the paths // we've sent up till now are no longer valid and need to be invalidated. - mAttributePathExpandIterator = AttributePathExpandIterator(mpAttributeClusterInfoList); + mAttributePathExpandIterator = AttributePathExpandIterator(mpAttributePathList); mAttributeEncoderState = AttributeValueEncoder::AttributeEncodeState(); } void ClearDirty() { mDirty = false; } @@ -240,10 +243,10 @@ class ReadHandler : public Messaging::ExchangeDelegate bool mSuppressResponse = false; // Current Handler state - HandlerState mState = HandlerState::Idle; - ClusterInfo * mpAttributeClusterInfoList = nullptr; - ClusterInfo * mpEventClusterInfoList = nullptr; - ClusterInfo * mpDataVersionFilterList = nullptr; + HandlerState mState = HandlerState::Idle; + ObjectList * mpAttributePathList = nullptr; + ObjectList * mpEventPathList = nullptr; + ObjectList * mpDataVersionFilterList = nullptr; PriorityLevel mCurrentPriority = PriorityLevel::Invalid; diff --git a/src/app/reporting/Engine.cpp b/src/app/reporting/Engine.cpp index c807783dbb47c3..6dff530476d39e 100644 --- a/src/app/reporting/Engine.cpp +++ b/src/app/reporting/Engine.cpp @@ -50,17 +50,18 @@ void Engine::Shutdown() mGlobalDirtySet.ReleaseAll(); } -bool Engine::IsClusterDataVersionMatch(ClusterInfo * aDataVersionFilterList, const ConcreteReadAttributePath & aPath) +bool Engine::IsClusterDataVersionMatch(ObjectList * aDataVersionFilterList, + const ConcreteReadAttributePath & aPath) { bool existPathMatch = false; bool existVersionMismatch = false; for (auto filter = aDataVersionFilterList; filter != nullptr; filter = filter->mpNext) { - if (aPath.mEndpointId == filter->mEndpointId && aPath.mClusterId == filter->mClusterId) + if (aPath.mEndpointId == filter->mValue.mEndpointId && aPath.mClusterId == filter->mValue.mClusterId) { existPathMatch = true; - if (!IsClusterDataVersionEqual(ConcreteClusterPath(filter->mEndpointId, filter->mClusterId), - filter->mDataVersion.Value())) + if (!IsClusterDataVersionEqual(ConcreteClusterPath(filter->mValue.mEndpointId, filter->mValue.mClusterId), + filter->mValue.mDataVersion.Value())) { existVersionMismatch = true; } @@ -135,7 +136,7 @@ CHIP_ERROR Engine::BuildSingleReportDataAttributeReportIBs(ReportDataMessage::Bu } else { - if (IsClusterDataVersionMatch(apReadHandler->GetDataVersionFilterlist(), readPath)) + if (IsClusterDataVersionMatch(apReadHandler->GetDataVersionFilterList(), readPath)) { continue; } @@ -266,15 +267,15 @@ CHIP_ERROR Engine::BuildSingleReportDataEventReports(ReportDataMessage::Builder CHIP_ERROR err = CHIP_NO_ERROR; size_t eventCount = 0; TLV::TLVWriter backup; - bool eventClean = true; - ClusterInfo * clusterInfoList = apReadHandler->GetEventClusterInfolist(); - EventNumber & eventMin = apReadHandler->GetEventMin(); - EventManagement & eventManager = EventManagement::GetInstance(); - bool hasMoreChunks = false; + bool eventClean = true; + ObjectList * eventList = apReadHandler->GetEventPathList(); + EventNumber & eventMin = apReadHandler->GetEventMin(); + EventManagement & eventManager = EventManagement::GetInstance(); + bool hasMoreChunks = false; aReportDataBuilder.Checkpoint(backup); - VerifyOrExit(clusterInfoList != nullptr, ); + VerifyOrExit(eventList != nullptr, ); // If the eventManager is not valid or has not been initialized, // skip the rest of processing @@ -291,7 +292,7 @@ CHIP_ERROR Engine::BuildSingleReportDataEventReports(ReportDataMessage::Builder { EventReportIBs::Builder & eventReportIBs = aReportDataBuilder.CreateEventReports(); SuccessOrExit(err = aReportDataBuilder.GetError()); - err = eventManager.FetchEventsSince(*(eventReportIBs.GetWriter()), clusterInfoList, eventMin, eventCount, + err = eventManager.FetchEventsSince(*(eventReportIBs.GetWriter()), eventList, eventMin, eventCount, apReadHandler->GetSubjectDescriptor()); if ((err == CHIP_END_OF_TLV) || (err == CHIP_ERROR_TLV_UNDERRUN) || (err == CHIP_NO_ERROR)) @@ -583,7 +584,7 @@ void Engine::Run() } } -bool Engine::MergeOverlappedAttributePath(ClusterInfo & aAttributePath) +bool Engine::MergeOverlappedAttributePath(AttributePathParams & aAttributePath) { return Loop::Break == mGlobalDirtySet.ForEachActiveObject([&](auto * path) { if (path->IsAttributePathSupersetOf(aAttributePath)) @@ -600,18 +601,18 @@ bool Engine::MergeOverlappedAttributePath(ClusterInfo & aAttributePath) }); } -CHIP_ERROR Engine::SetDirty(ClusterInfo & aClusterInfo) +CHIP_ERROR Engine::SetDirty(AttributePathParams & aAttributePath) { - InteractionModelEngine::GetInstance()->mReadHandlers.ForEachActiveObject([&aClusterInfo](ReadHandler * handler) { + InteractionModelEngine::GetInstance()->mReadHandlers.ForEachActiveObject([&aAttributePath](ReadHandler * handler) { // We call SetDirty for both read interactions and subscribe interactions, since we may sent inconsistent attribute data // between two chunks. SetDirty will be ignored automatically by read handlers which is waiting for response to last message // chunk for read interactions. if (handler->IsGeneratingReports() || handler->IsAwaitingReportResponse()) { - for (auto clusterInfo = handler->GetAttributeClusterInfolist(); clusterInfo != nullptr; - clusterInfo = clusterInfo->mpNext) + for (auto object = handler->GetAttributePathList(); object != nullptr; object = object->mpNext) { - if (aClusterInfo.IsAttributePathSupersetOf(*clusterInfo) || clusterInfo->IsAttributePathSupersetOf(aClusterInfo)) + if (aAttributePath.IsAttributePathSupersetOf(object->mValue) || + object->mValue.IsAttributePathSupersetOf(aAttributePath)) { handler->SetDirty(); break; @@ -622,16 +623,16 @@ CHIP_ERROR Engine::SetDirty(ClusterInfo & aClusterInfo) return Loop::Continue; }); - if (!MergeOverlappedAttributePath(aClusterInfo) && - InteractionModelEngine::GetInstance()->IsOverlappedAttributePath(aClusterInfo)) + if (!MergeOverlappedAttributePath(aAttributePath) && + InteractionModelEngine::GetInstance()->IsOverlappedAttributePath(aAttributePath)) { - ClusterInfo * clusterInfo = mGlobalDirtySet.CreateObject(); - if (clusterInfo == nullptr) + auto object = mGlobalDirtySet.CreateObject(); + if (object == nullptr) { ChipLogError(DataManagement, "mGlobalDirtySet pool full, cannot handle more entries!"); return CHIP_ERROR_NO_MEMORY; } - *clusterInfo = aClusterInfo; + *object = aAttributePath; } // Schedule work to run asynchronously on the CHIP thread. The scheduled @@ -658,10 +659,10 @@ void Engine::UpdateReadHandlerDirty(ReadHandler & aReadHandler) } bool intersected = false; - for (auto clusterInfo = aReadHandler.GetAttributeClusterInfolist(); clusterInfo != nullptr; clusterInfo = clusterInfo->mpNext) + for (auto object = aReadHandler.GetAttributePathList(); object != nullptr; object = object->mpNext) { mGlobalDirtySet.ForEachActiveObject([&](auto * path) { - if (path->IsAttributePathSupersetOf(*clusterInfo) || clusterInfo->IsAttributePathSupersetOf(*path)) + if (path->IsAttributePathSupersetOf(object->mValue) || object->mValue.IsAttributePathSupersetOf(*path)) { intersected = true; return Loop::Break; @@ -744,10 +745,10 @@ CHIP_ERROR Engine::ScheduleEventDelivery(ConcreteEventPath & aPath, uint32_t aBy return Loop::Continue; } - for (auto * interestedPath = handler->GetEventClusterInfolist(); interestedPath != nullptr; + for (auto * interestedPath = handler->GetEventPathList(); interestedPath != nullptr; interestedPath = interestedPath->mpNext) { - if (interestedPath->IsEventPathSupersetOf(aPath) && interestedPath->mIsUrgentEvent) + if (interestedPath->mValue.IsEventPathSupersetOf(aPath) && interestedPath->mValue.mIsUrgentEvent) { isUrgentEvent = true; handler->UnblockUrgentEventDelivery(); @@ -765,8 +766,6 @@ CHIP_ERROR Engine::ScheduleEventDelivery(ConcreteEventPath & aPath, uint32_t aBy } return ScheduleBufferPressureEventDelivery(aBytesWritten); - - return CHIP_NO_ERROR; } void Engine::ScheduleUrgentEventDeliverySync() diff --git a/src/app/reporting/Engine.h b/src/app/reporting/Engine.h index 3ed8512dad8b47..3a26abba3ef040 100644 --- a/src/app/reporting/Engine.h +++ b/src/app/reporting/Engine.h @@ -87,7 +87,7 @@ class Engine /** * Application marks mutated change path and would be sent out in later report. */ - CHIP_ERROR SetDirty(ClusterInfo & aClusterInfo); + CHIP_ERROR SetDirty(AttributePathParams & aAttributePathParams); /** * @brief @@ -144,7 +144,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(ClusterInfo * aDataVersionFilterList, const ConcreteReadAttributePath & aPath); + bool IsClusterDataVersionMatch(ObjectList * aDataVersionFilterList, const ConcreteReadAttributePath & aPath); /** * Check all active subscription, if the subscription has no paths that intersect with global dirty set, @@ -173,7 +173,7 @@ class Engine * * Return whether one of our paths is now a superset of the provided path. */ - bool MergeOverlappedAttributePath(ClusterInfo & aAttributePath); + bool MergeOverlappedAttributePath(AttributePathParams & aAttributePath); /** * Boolean to indicate if ScheduleRun is pending. This flag is used to prevent calling ScheduleRun multiple times @@ -203,7 +203,7 @@ class Engine * mGlobalDirtySet is used to track the set of attribute/event paths marked dirty for reporting purposes. * */ - ObjectPool mGlobalDirtySet; + ObjectPool mGlobalDirtySet; #if CONFIG_IM_BUILD_FOR_UNIT_TEST uint32_t mReservedSize = 0; diff --git a/src/app/tests/TestAttributePathExpandIterator.cpp b/src/app/tests/TestAttributePathExpandIterator.cpp index ffa1109020a6ae..fe0d18477614ad 100644 --- a/src/app/tests/TestAttributePathExpandIterator.cpp +++ b/src/app/tests/TestAttributePathExpandIterator.cpp @@ -18,9 +18,9 @@ #include #include -#include #include #include +#include #include #include #include @@ -41,7 +41,7 @@ using P = app::ConcreteAttributePath; void TestAllWildcard(nlTestSuite * apSuite, void * apContext) { - app::ClusterInfo clusInfo; + app::ObjectList clusInfo; app::ConcreteAttributePath path; P paths[] = { @@ -117,9 +117,9 @@ void TestAllWildcard(nlTestSuite * apSuite, void * apContext) void TestWildcardEndpoint(nlTestSuite * apSuite, void * apContext) { - app::ClusterInfo clusInfo; - clusInfo.mClusterId = Test::MockClusterId(3); - clusInfo.mAttributeId = Test::MockAttributeId(3); + app::ObjectList clusInfo; + clusInfo.mValue.mClusterId = Test::MockClusterId(3); + clusInfo.mValue.mAttributeId = Test::MockAttributeId(3); app::ConcreteAttributePath path; P paths[] = { @@ -140,9 +140,9 @@ void TestWildcardEndpoint(nlTestSuite * apSuite, void * apContext) void TestWildcardCluster(nlTestSuite * apSuite, void * apContext) { - app::ClusterInfo clusInfo; - clusInfo.mEndpointId = Test::kMockEndpoint3; - clusInfo.mAttributeId = app::Clusters::Globals::Attributes::ClusterRevision::Id; + app::ObjectList clusInfo; + clusInfo.mValue.mEndpointId = Test::kMockEndpoint3; + clusInfo.mValue.mAttributeId = app::Clusters::Globals::Attributes::ClusterRevision::Id; app::ConcreteAttributePath path; P paths[] = { @@ -166,9 +166,9 @@ void TestWildcardCluster(nlTestSuite * apSuite, void * apContext) void TestWildcardClusterGlobalAttributeNotInMetadata(nlTestSuite * apSuite, void * apContext) { - app::ClusterInfo clusInfo; - clusInfo.mEndpointId = Test::kMockEndpoint3; - clusInfo.mAttributeId = app::Clusters::Globals::Attributes::AttributeList::Id; + app::ObjectList clusInfo; + clusInfo.mValue.mEndpointId = Test::kMockEndpoint3; + clusInfo.mValue.mAttributeId = app::Clusters::Globals::Attributes::AttributeList::Id; app::ConcreteAttributePath path; P paths[] = { @@ -192,9 +192,9 @@ void TestWildcardClusterGlobalAttributeNotInMetadata(nlTestSuite * apSuite, void void TestWildcardAttribute(nlTestSuite * apSuite, void * apContext) { - app::ClusterInfo clusInfo; - clusInfo.mEndpointId = Test::kMockEndpoint2; - clusInfo.mClusterId = Test::MockClusterId(3); + app::ObjectList clusInfo; + clusInfo.mValue.mEndpointId = Test::kMockEndpoint2; + clusInfo.mValue.mClusterId = Test::MockClusterId(3); app::ConcreteAttributePath path; P paths[] = { @@ -222,10 +222,10 @@ void TestWildcardAttribute(nlTestSuite * apSuite, void * apContext) void TestNoWildcard(nlTestSuite * apSuite, void * apContext) { - app::ClusterInfo clusInfo; - clusInfo.mEndpointId = Test::kMockEndpoint2; - clusInfo.mClusterId = Test::MockClusterId(3); - clusInfo.mAttributeId = Test::MockAttributeId(3); + app::ObjectList clusInfo; + clusInfo.mValue.mEndpointId = Test::kMockEndpoint2; + clusInfo.mValue.mClusterId = Test::MockClusterId(3); + clusInfo.mValue.mAttributeId = Test::MockAttributeId(3); app::ConcreteAttributePath path; P paths[] = { @@ -247,24 +247,24 @@ void TestNoWildcard(nlTestSuite * apSuite, void * apContext) void TestMultipleClusInfo(nlTestSuite * apSuite, void * apContext) { - app::ClusterInfo clusInfo1; + app::ObjectList clusInfo1; - app::ClusterInfo clusInfo2; - clusInfo2.mClusterId = Test::MockClusterId(3); - clusInfo2.mAttributeId = Test::MockAttributeId(3); + app::ObjectList clusInfo2; + clusInfo2.mValue.mClusterId = Test::MockClusterId(3); + clusInfo2.mValue.mAttributeId = Test::MockAttributeId(3); - app::ClusterInfo clusInfo3; - clusInfo3.mEndpointId = Test::kMockEndpoint3; - clusInfo3.mAttributeId = app::Clusters::Globals::Attributes::ClusterRevision::Id; + app::ObjectList clusInfo3; + clusInfo3.mValue.mEndpointId = Test::kMockEndpoint3; + clusInfo3.mValue.mAttributeId = app::Clusters::Globals::Attributes::ClusterRevision::Id; - app::ClusterInfo clusInfo4; - clusInfo4.mEndpointId = Test::kMockEndpoint2; - clusInfo4.mClusterId = Test::MockClusterId(3); + app::ObjectList clusInfo4; + clusInfo4.mValue.mEndpointId = Test::kMockEndpoint2; + clusInfo4.mValue.mClusterId = Test::MockClusterId(3); - app::ClusterInfo clusInfo5; - clusInfo5.mEndpointId = Test::kMockEndpoint2; - clusInfo5.mClusterId = Test::MockClusterId(3); - clusInfo5.mAttributeId = Test::MockAttributeId(3); + app::ObjectList clusInfo5; + clusInfo5.mValue.mEndpointId = Test::kMockEndpoint2; + clusInfo5.mValue.mClusterId = Test::MockClusterId(3); + clusInfo5.mValue.mAttributeId = Test::MockAttributeId(3); clusInfo1.mpNext = &clusInfo2; clusInfo2.mpNext = &clusInfo3; diff --git a/src/app/tests/TestClusterInfo.cpp b/src/app/tests/TestClusterInfo.cpp index 0c007cdf284833..fc7d1cee60a9d7 100644 --- a/src/app/tests/TestClusterInfo.cpp +++ b/src/app/tests/TestClusterInfo.cpp @@ -22,7 +22,9 @@ * */ -#include +#include +#include +#include #include #include #include @@ -31,12 +33,12 @@ using namespace chip::Test; namespace chip { namespace app { -namespace TestClusterInfo { +namespace TestPath { void TestAttributePathIncludedSameFieldId(nlTestSuite * apSuite, void * apContext) { - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; - ClusterInfo clusterInfo3; + AttributePathParams clusterInfo1; + AttributePathParams clusterInfo2; + AttributePathParams clusterInfo3; clusterInfo1.mAttributeId = 1; clusterInfo2.mAttributeId = 1; clusterInfo3.mAttributeId = 1; @@ -54,26 +56,26 @@ void TestAttributePathIncludedSameFieldId(nlTestSuite * apSuite, void * apContex void TestAttributePathIncludedDifferentFieldId(nlTestSuite * apSuite, void * apContext) { { - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; + AttributePathParams clusterInfo1; + AttributePathParams clusterInfo2; clusterInfo1.mAttributeId = 1; clusterInfo2.mAttributeId = 2; NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); } { - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; + AttributePathParams clusterInfo1; + AttributePathParams clusterInfo2; clusterInfo2.mAttributeId = 2; NL_TEST_ASSERT(apSuite, clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); } { - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; + AttributePathParams clusterInfo1; + AttributePathParams clusterInfo2; NL_TEST_ASSERT(apSuite, clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); } { - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; + AttributePathParams clusterInfo1; + AttributePathParams clusterInfo2; clusterInfo1.mAttributeId = 1; NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); @@ -82,8 +84,8 @@ void TestAttributePathIncludedDifferentFieldId(nlTestSuite * apSuite, void * apC void TestAttributePathIncludedDifferentEndpointId(nlTestSuite * apSuite, void * apContext) { - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; + AttributePathParams clusterInfo1; + AttributePathParams clusterInfo2; clusterInfo1.mEndpointId = 1; clusterInfo2.mEndpointId = 2; NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); @@ -91,8 +93,8 @@ void TestAttributePathIncludedDifferentEndpointId(nlTestSuite * apSuite, void * void TestAttributePathIncludedDifferentClusterId(nlTestSuite * apSuite, void * apContext) { - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; + AttributePathParams clusterInfo1; + AttributePathParams clusterInfo2; clusterInfo1.mClusterId = 1; clusterInfo2.mClusterId = 2; NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); @@ -106,7 +108,7 @@ void TestAttributePathIncludedDifferentClusterId(nlTestSuite * apSuite, void * a {kMockEndpoint1, MockClusterId(1), kInvalidEventId}, {kMockEndpoint1, MockClusterId(1), MockEventId(1)}, */ -chip::app::ClusterInfo validEventpaths[6]; +chip::app::EventPathParams validEventpaths[6]; void InitEventPaths() { validEventpaths[1].mClusterId = MockClusterId(1); @@ -163,33 +165,31 @@ void TestEventPathDifferentEndpointId(nlTestSuite * apSuite, void * apContext) NL_TEST_ASSERT(apSuite, !validEventpaths[5].IsEventPathSupersetOf(testPath)); } -} // namespace TestClusterInfo +} // namespace TestPath } // namespace app } // namespace chip namespace { const nlTest sTests[] = { - NL_TEST_DEF("TestAttributePathIncludedSameFieldId", chip::app::TestClusterInfo::TestAttributePathIncludedSameFieldId), - NL_TEST_DEF("TestAttributePathIncludedDifferentFieldId", chip::app::TestClusterInfo::TestAttributePathIncludedDifferentFieldId), - NL_TEST_DEF("TestAttributePathIncludedDifferentEndpointId", - chip::app::TestClusterInfo::TestAttributePathIncludedDifferentEndpointId), - NL_TEST_DEF("TestAttributePathIncludedDifferentClusterId", - chip::app::TestClusterInfo::TestAttributePathIncludedDifferentClusterId), - NL_TEST_DEF("TestEventPathSameEventId", chip::app::TestClusterInfo::TestEventPathSameEventId), - NL_TEST_DEF("TestEventPathDifferentEventId", chip::app::TestClusterInfo::TestEventPathDifferentEventId), - NL_TEST_DEF("TestEventPathDifferentClusterId", chip::app::TestClusterInfo::TestEventPathDifferentClusterId), - NL_TEST_DEF("TestEventPathDifferentEndpointId", chip::app::TestClusterInfo::TestEventPathDifferentEndpointId), + NL_TEST_DEF("TestAttributePathIncludedSameFieldId", chip::app::TestPath::TestAttributePathIncludedSameFieldId), + NL_TEST_DEF("TestAttributePathIncludedDifferentFieldId", chip::app::TestPath::TestAttributePathIncludedDifferentFieldId), + NL_TEST_DEF("TestAttributePathIncludedDifferentEndpointId", chip::app::TestPath::TestAttributePathIncludedDifferentEndpointId), + NL_TEST_DEF("TestAttributePathIncludedDifferentClusterId", chip::app::TestPath::TestAttributePathIncludedDifferentClusterId), + NL_TEST_DEF("TestEventPathSameEventId", chip::app::TestPath::TestEventPathSameEventId), + NL_TEST_DEF("TestEventPathDifferentEventId", chip::app::TestPath::TestEventPathDifferentEventId), + NL_TEST_DEF("TestEventPathDifferentClusterId", chip::app::TestPath::TestEventPathDifferentClusterId), + NL_TEST_DEF("TestEventPathDifferentEndpointId", chip::app::TestPath::TestEventPathDifferentEndpointId), NL_TEST_SENTINEL() }; } -int TestClusterInfo() +int TestPath() { - nlTestSuite theSuite = { "ClusterInfo", &sTests[0], nullptr, nullptr }; - chip::app::TestClusterInfo::InitEventPaths(); + nlTestSuite theSuite = { "TestPath", &sTests[0], nullptr, nullptr }; + chip::app::TestPath::InitEventPaths(); nlTestRunner(&theSuite, nullptr); return (nlTestRunnerStats(&theSuite)); } -CHIP_REGISTER_TEST_SUITE(TestClusterInfo) +CHIP_REGISTER_TEST_SUITE(TestPath) diff --git a/src/app/tests/TestCommissionManager.cpp b/src/app/tests/TestCommissionManager.cpp index efcb270eaedddf..6580e543d25abf 100644 --- a/src/app/tests/TestCommissionManager.cpp +++ b/src/app/tests/TestCommissionManager.cpp @@ -143,8 +143,7 @@ void CheckCommissioningWindowManagerEnhancedWindowTask(intptr_t context) nlTestSuite * suite = reinterpret_cast(context); CommissioningWindowManager & commissionMgr = Server::GetInstance().GetCommissioningWindowManager(); uint16_t originDiscriminator; - CHIP_ERROR err = - chip::DeviceLayer::GetCommissionableDataProvider()->GetSetupDiscriminator(originDiscriminator); + CHIP_ERROR err = chip::DeviceLayer::GetCommissionableDataProvider()->GetSetupDiscriminator(originDiscriminator); NL_TEST_ASSERT(suite, err == CHIP_NO_ERROR); uint16_t newDiscriminator = static_cast(originDiscriminator + 1); chip::Spake2pVerifier verifier; diff --git a/src/app/tests/TestEventLogging.cpp b/src/app/tests/TestEventLogging.cpp index db9104bec40b55..da3fbe613149d9 100644 --- a/src/app/tests/TestEventLogging.cpp +++ b/src/app/tests/TestEventLogging.cpp @@ -23,11 +23,11 @@ */ #include -#include #include #include #include #include +#include #include #include #include @@ -46,7 +46,6 @@ namespace { -static const chip::NodeId kTestDeviceNodeId1 = 0x18B4300000000001ULL; static const chip::ClusterId kLivenessClusterId = 0x00000022; static const uint32_t kLivenessChangeEvent = 1; static const chip::EndpointId kTestEndpointId1 = 2; @@ -133,7 +132,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::ClusterInfo * clusterInfo) + size_t expectedNumEvents, chip::app::ObjectList * clusterInfo) { CHIP_ERROR err; chip::TLV::TLVReader reader; @@ -224,22 +223,20 @@ static void CheckLogEventWithEvictToNextBuffer(nlTestSuite * apSuite, void * apC NL_TEST_ASSERT(apSuite, (eid4 + 1) == eid5); NL_TEST_ASSERT(apSuite, (eid5 + 1) == eid6); - chip::app::ClusterInfo testClusterInfo1; - testClusterInfo1.mNodeId = kTestDeviceNodeId1; - testClusterInfo1.mEndpointId = kTestEndpointId1; - testClusterInfo1.mClusterId = kLivenessClusterId; - chip::app::ClusterInfo testClusterInfo2; - testClusterInfo2.mNodeId = kTestDeviceNodeId1; - testClusterInfo2.mEndpointId = kTestEndpointId2; - testClusterInfo2.mClusterId = kLivenessClusterId; - testClusterInfo2.mEventId = kLivenessChangeEvent; - - CheckLogReadOut(apSuite, logMgmt, 0, 3, &testClusterInfo1); - CheckLogReadOut(apSuite, logMgmt, 1, 2, &testClusterInfo1); - CheckLogReadOut(apSuite, logMgmt, 2, 1, &testClusterInfo1); - CheckLogReadOut(apSuite, logMgmt, 3, 3, &testClusterInfo2); - CheckLogReadOut(apSuite, logMgmt, 4, 2, &testClusterInfo2); - CheckLogReadOut(apSuite, logMgmt, 5, 1, &testClusterInfo2); + chip::app::ObjectList testEventPathParams1; + testEventPathParams1.mValue.mEndpointId = kTestEndpointId1; + testEventPathParams1.mValue.mClusterId = kLivenessClusterId; + chip::app::ObjectList testEventPathParams2; + testEventPathParams2.mValue.mEndpointId = kTestEndpointId2; + testEventPathParams2.mValue.mClusterId = kLivenessClusterId; + testEventPathParams2.mValue.mEventId = kLivenessChangeEvent; + + CheckLogReadOut(apSuite, logMgmt, 0, 3, &testEventPathParams1); + CheckLogReadOut(apSuite, logMgmt, 1, 2, &testEventPathParams1); + CheckLogReadOut(apSuite, logMgmt, 2, 1, &testEventPathParams1); + CheckLogReadOut(apSuite, logMgmt, 3, 3, &testEventPathParams2); + CheckLogReadOut(apSuite, logMgmt, 4, 2, &testEventPathParams2); + CheckLogReadOut(apSuite, logMgmt, 5, 1, &testEventPathParams2); } static void CheckLogEventWithDiscardLowEvent(nlTestSuite * apSuite, void * apContext) diff --git a/src/app/tests/TestEventOverflow.cpp b/src/app/tests/TestEventOverflow.cpp index 57b203b0b2880e..9178b36718c7fc 100644 --- a/src/app/tests/TestEventOverflow.cpp +++ b/src/app/tests/TestEventOverflow.cpp @@ -22,7 +22,6 @@ * */ -#include #include #include #include diff --git a/src/app/tests/TestInteractionModelEngine.cpp b/src/app/tests/TestInteractionModelEngine.cpp index 2e0407b6cdf917..fe5814d6511df0 100644 --- a/src/app/tests/TestInteractionModelEngine.cpp +++ b/src/app/tests/TestInteractionModelEngine.cpp @@ -43,14 +43,14 @@ namespace app { class TestInteractionModelEngine { public: - static void TestClusterInfoPushRelease(nlTestSuite * apSuite, void * apContext); - static int GetClusterInfoListLength(ClusterInfo * apClusterInfoList); + static void TestAttributePathParamsPushRelease(nlTestSuite * apSuite, void * apContext); + static int GetAttributePathListLength(ObjectList * apattributePathParamsList); }; -int TestInteractionModelEngine::GetClusterInfoListLength(ClusterInfo * apClusterInfoList) +int TestInteractionModelEngine::GetAttributePathListLength(ObjectList * apAttributePathParamsList) { - int length = 0; - ClusterInfo * runner = apClusterInfoList; + int length = 0; + ObjectList * runner = apAttributePathParamsList; while (runner != nullptr) { runner = runner->mpNext; @@ -59,35 +59,41 @@ int TestInteractionModelEngine::GetClusterInfoListLength(ClusterInfo * apCluster return length; } -void TestInteractionModelEngine::TestClusterInfoPushRelease(nlTestSuite * apSuite, void * apContext) +void TestInteractionModelEngine::TestAttributePathParamsPushRelease(nlTestSuite * apSuite, void * apContext) { TestContext & ctx = *static_cast(apContext); CHIP_ERROR err = CHIP_NO_ERROR; err = InteractionModelEngine::GetInstance()->Init(&ctx.GetExchangeManager()); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ClusterInfo * clusterInfoList = nullptr; - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; - ClusterInfo clusterInfo3; - - clusterInfo1.mEndpointId = 1; - clusterInfo2.mEndpointId = 2; - clusterInfo3.mEndpointId = 3; - - InteractionModelEngine::GetInstance()->PushFront(clusterInfoList, clusterInfo1); - NL_TEST_ASSERT(apSuite, clusterInfoList != nullptr && clusterInfo1.mEndpointId == clusterInfoList->mEndpointId); - NL_TEST_ASSERT(apSuite, GetClusterInfoListLength(clusterInfoList) == 1); - - InteractionModelEngine::GetInstance()->PushFront(clusterInfoList, clusterInfo2); - NL_TEST_ASSERT(apSuite, clusterInfoList != nullptr && clusterInfo2.mEndpointId == clusterInfoList->mEndpointId); - NL_TEST_ASSERT(apSuite, GetClusterInfoListLength(clusterInfoList) == 2); - - InteractionModelEngine::GetInstance()->PushFront(clusterInfoList, clusterInfo3); - NL_TEST_ASSERT(apSuite, clusterInfoList != nullptr && clusterInfo3.mEndpointId == clusterInfoList->mEndpointId); - NL_TEST_ASSERT(apSuite, GetClusterInfoListLength(clusterInfoList) == 3); - - InteractionModelEngine::GetInstance()->ReleaseClusterInfoList(clusterInfoList); - NL_TEST_ASSERT(apSuite, GetClusterInfoListLength(clusterInfoList) == 0); + ObjectList * attributePathParamsList = nullptr; + AttributePathParams attributePathParams1; + AttributePathParams attributePathParams2; + AttributePathParams attributePathParams3; + + attributePathParams1.mEndpointId = 1; + attributePathParams2.mEndpointId = 2; + attributePathParams3.mEndpointId = 3; + + InteractionModelEngine::GetInstance()->PushFrontAttributePathList(attributePathParamsList, attributePathParams1); + NL_TEST_ASSERT(apSuite, + attributePathParamsList != nullptr && + attributePathParams1.mEndpointId == attributePathParamsList->mValue.mEndpointId); + NL_TEST_ASSERT(apSuite, GetAttributePathListLength(attributePathParamsList) == 1); + + InteractionModelEngine::GetInstance()->PushFrontAttributePathList(attributePathParamsList, attributePathParams2); + NL_TEST_ASSERT(apSuite, + attributePathParamsList != nullptr && + attributePathParams2.mEndpointId == attributePathParamsList->mValue.mEndpointId); + NL_TEST_ASSERT(apSuite, GetAttributePathListLength(attributePathParamsList) == 2); + + InteractionModelEngine::GetInstance()->PushFrontAttributePathList(attributePathParamsList, attributePathParams3); + NL_TEST_ASSERT(apSuite, + attributePathParamsList != nullptr && + attributePathParams3.mEndpointId == attributePathParamsList->mValue.mEndpointId); + NL_TEST_ASSERT(apSuite, GetAttributePathListLength(attributePathParamsList) == 3); + + InteractionModelEngine::GetInstance()->ReleaseAttributePathList(attributePathParamsList); + NL_TEST_ASSERT(apSuite, GetAttributePathListLength(attributePathParamsList) == 0); } } // namespace app } // namespace chip @@ -97,7 +103,7 @@ namespace { // clang-format off const nlTest sTests[] = { - NL_TEST_DEF("TestClusterInfoPushRelease", chip::app::TestInteractionModelEngine::TestClusterInfoPushRelease), + NL_TEST_DEF("TestAttributePathParamsPushRelease", chip::app::TestInteractionModelEngine::TestAttributePathParamsPushRelease), NL_TEST_SENTINEL() }; // clang-format on diff --git a/src/app/tests/TestReadInteraction.cpp b/src/app/tests/TestReadInteraction.cpp index 186fa251843b05..e9ed676ec99b69 100644 --- a/src/app/tests/TestReadInteraction.cpp +++ b/src/app/tests/TestReadInteraction.cpp @@ -1282,7 +1282,7 @@ void TestReadInteraction::TestSetDirtyBetweenChunks(nlTestSuite * apSuite, void { mDidSetDirty = true; - ClusterInfo dirtyPath; + AttributePathParams dirtyPath; dirtyPath.mEndpointId = Test::kMockEndpoint3; dirtyPath.mClusterId = Test::MockClusterId(2); dirtyPath.mAttributeId = Test::MockAttributeId(4); @@ -1524,28 +1524,28 @@ void TestReadInteraction::TestSubscribeRoundtrip(nlTestSuite * apSuite, void * a GenerateEvents(apSuite, apContext); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mHoldReport == false); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mDirty == true); - chip::app::ClusterInfo dirtyPath1; + chip::app::AttributePathParams dirtyPath1; dirtyPath1.mClusterId = kTestClusterId; dirtyPath1.mEndpointId = kTestEndpointId; dirtyPath1.mAttributeId = 1; - chip::app::ClusterInfo dirtyPath2; + chip::app::AttributePathParams dirtyPath2; dirtyPath2.mClusterId = kTestClusterId; dirtyPath2.mEndpointId = kTestEndpointId; dirtyPath2.mAttributeId = 2; - chip::app::ClusterInfo dirtyPath3; + chip::app::AttributePathParams dirtyPath3; dirtyPath3.mClusterId = kTestClusterId; dirtyPath3.mEndpointId = kTestEndpointId; dirtyPath3.mAttributeId = 2; dirtyPath3.mListIndex = 1; - chip::app::ClusterInfo dirtyPath4; + chip::app::AttributePathParams dirtyPath4; dirtyPath4.mClusterId = kTestClusterId; dirtyPath4.mEndpointId = kTestEndpointId; dirtyPath4.mAttributeId = 3; - chip::app::ClusterInfo dirtyPath5; + chip::app::AttributePathParams dirtyPath5; dirtyPath5.mClusterId = kTestClusterId; dirtyPath5.mEndpointId = kTestEndpointId; dirtyPath5.mAttributeId = 4; @@ -1774,7 +1774,7 @@ void TestReadInteraction::TestSubscribeWildcard(nlTestSuite * apSuite, void * ap delegate.mGotReport = false; delegate.mNumAttributeResponse = 0; - ClusterInfo dirtyPath; + AttributePathParams dirtyPath; dirtyPath.mEndpointId = Test::kMockEndpoint2; dirtyPath.mClusterId = Test::MockClusterId(3); dirtyPath.mAttributeId = Test::MockAttributeId(1); @@ -1795,7 +1795,7 @@ void TestReadInteraction::TestSubscribeWildcard(nlTestSuite * apSuite, void * ap delegate.mGotReport = false; delegate.mNumAttributeResponse = 0; - ClusterInfo dirtyPath; + AttributePathParams dirtyPath; dirtyPath.mEndpointId = Test::kMockEndpoint3; err = engine->GetReportingEngine().SetDirty(dirtyPath); @@ -2084,12 +2084,12 @@ void TestReadInteraction::TestPostSubscribeRoundtripStatusReportTimeout(nlTestSu GenerateEvents(apSuite, apContext); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mHoldReport == false); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mDirty == true); - chip::app::ClusterInfo dirtyPath1; + chip::app::AttributePathParams dirtyPath1; dirtyPath1.mClusterId = kTestClusterId; dirtyPath1.mEndpointId = kTestEndpointId; dirtyPath1.mAttributeId = 1; - chip::app::ClusterInfo dirtyPath2; + chip::app::AttributePathParams dirtyPath2; dirtyPath2.mClusterId = kTestClusterId; dirtyPath2.mEndpointId = kTestEndpointId; dirtyPath2.mAttributeId = 2; @@ -2403,7 +2403,7 @@ void TestReadInteraction::TestPostSubscribeRoundtripChunkStatusReportTimeout(nlT GenerateEvents(apSuite, apContext); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mHoldReport == false); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mDirty == true); - chip::app::ClusterInfo dirtyPath1; + chip::app::AttributePathParams dirtyPath1; dirtyPath1.mClusterId = Test::MockClusterId(2); dirtyPath1.mEndpointId = Test::kMockEndpoint3; dirtyPath1.mAttributeId = Test::MockAttributeId(4); @@ -2500,7 +2500,7 @@ void TestReadInteraction::TestPostSubscribeRoundtripChunkReportTimeout(nlTestSui GenerateEvents(apSuite, apContext); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mHoldReport == false); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mDirty == true); - chip::app::ClusterInfo dirtyPath1; + chip::app::AttributePathParams dirtyPath1; dirtyPath1.mClusterId = Test::MockClusterId(2); dirtyPath1.mEndpointId = Test::kMockEndpoint3; dirtyPath1.mAttributeId = Test::MockAttributeId(4); diff --git a/src/app/tests/TestReportingEngine.cpp b/src/app/tests/TestReportingEngine.cpp index e67ef72759fed1..f4e22fa8a30f79 100644 --- a/src/app/tests/TestReportingEngine.cpp +++ b/src/app/tests/TestReportingEngine.cpp @@ -120,17 +120,17 @@ void TestReportingEngine::TestMergeOverlappedAttributePath(nlTestSuite * apSuite err = InteractionModelEngine::GetInstance()->Init(&ctx.GetExchangeManager()); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ClusterInfo * clusterInfo = InteractionModelEngine::GetInstance()->GetReportingEngine().mGlobalDirtySet.CreateObject(); - clusterInfo->mAttributeId = 1; + AttributePathParams * clusterInfo = InteractionModelEngine::GetInstance()->GetReportingEngine().mGlobalDirtySet.CreateObject(); + clusterInfo->mAttributeId = 1; { - chip::app::ClusterInfo testClusterInfo; + AttributePathParams testClusterInfo; testClusterInfo.mAttributeId = 3; NL_TEST_ASSERT(apSuite, !InteractionModelEngine::GetInstance()->GetReportingEngine().MergeOverlappedAttributePath(testClusterInfo)); } { - chip::app::ClusterInfo testClusterInfo; + AttributePathParams testClusterInfo; testClusterInfo.mAttributeId = 1; testClusterInfo.mListIndex = 2; NL_TEST_ASSERT(apSuite, diff --git a/src/app/tests/suites/certification/Test_TC_IDM_3_2.yaml b/src/app/tests/suites/certification/Test_TC_IDM_3_2.yaml index 992ff201697457..3204ceb5d01f15 100644 --- a/src/app/tests/suites/certification/Test_TC_IDM_3_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_IDM_3_2.yaml @@ -27,8 +27,8 @@ tests: Specific Attribute. On receipt of this message, DUT should send a write response action with the modified attribute value to the TH." verification: - "In case of chip tool, here is an example command to use - ./chip-tool levelcontrol write on-level 2 1 1" + "In case of chip tool, here is an example command to use ./chip-tool + levelcontrol write on-level 2 1 1" disabled: true - label: @@ -36,8 +36,8 @@ tests: receipt of this message, DUT should send a Write Response action with the attribute value to the DUT." verification: - "In case of chip tool, here is an example command to use - ./chip-tool any write-by-id 0x0008 0x0010 1 1 0xffff" + "In case of chip tool, here is an example command to use ./chip-tool + any write-by-id 0x0008 0x0010 1 1 0xffff" disabled: true - label: @@ -45,8 +45,8 @@ tests: attribute of data type bool. DUT responds with the Write Response action with the right attribute value." verification: - "In case of chip tool, here is an example command to use - ./chip-tool basic write local-config-disabled 1 1 0" + "In case of chip tool, here is an example command to use ./chip-tool + basic write local-config-disabled 1 1 0" disabled: true - label: @@ -54,8 +54,8 @@ tests: attribute of data type string. DUT responds with the Write Response action with the right attribute value." verification: - "In case of chip tool, here is an example command to use - ./chip-tool basic write node-label 1 1 0" + "In case of chip tool, here is an example command to use ./chip-tool + basic write node-label 1 1 0" disabled: true - label: @@ -63,8 +63,8 @@ tests: attribute of data type unsigned integer. DUT responds with the Write Response action with the right attribute value." verification: - "In case of chip tool, here is an example command to use - ./chip-tool any write-by-id 0x0008 0x0010 1 1 1" + "In case of chip tool, here is an example command to use ./chip-tool + any write-by-id 0x0008 0x0010 1 1 1" disabled: true - label: @@ -108,8 +108,8 @@ tests: attribute of data type enum. DUT responds with the Write Response action with the right attribute value." verification: - "In case of chip tool, here is an example command to use - ./chip-tool any write-by-id 0x0204 0 1 1 1" + "In case of chip tool, here is an example command to use ./chip-tool + any write-by-id 0x0204 0 1 1 1" disabled: true - label: @@ -117,8 +117,8 @@ tests: attribute of data type bitmap. DUT responds with the Write Response action with the right attribute value." verification: - "In case of chip tool, here is an example command to use - ./chip-tool colorcontrol write-by-id 0x000f 1 1 1" + "In case of chip tool, here is an example command to use ./chip-tool + colorcontrol write-by-id 0x000f 1 1 1" disabled: true - label: @@ -150,8 +150,8 @@ tests: "TH sends the Write Request Message to the DUT to read an unsupported attribute DUT responds with the Write Response action" verification: - "In case of chip tool, here is an example command to use - ./chip-tool any read-by-id 0x03 -900 1 1" + "In case of chip tool, here is an example command to use ./chip-tool + any read-by-id 0x03 -900 1 1" disabled: true - label: @@ -186,10 +186,9 @@ tests: write response action with the modified attribute value to the TH. Repeat the above steps 3 times." verification: - "In case of chip tool, here is an example command to use - ./chip-tool basic write node-label TE8 1 1 ./chip-tool basic - write node-label TE7 1 1 ./chip-tool basic write node-label TE6 1 - 1" + "In case of chip tool, here is an example command to use ./chip-tool + basic write node-label TE8 1 1 ./chip-tool basic write node-label TE7 + 1 1 ./chip-tool basic write node-label TE6 1 1" disabled: true - label: diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp index e6c46a6b13d076..3f696df7e03674 100644 --- a/src/app/util/ember-compatibility-functions.cpp +++ b/src/app/util/ember-compatibility-functions.cpp @@ -22,7 +22,6 @@ */ #include -#include #include #include #include @@ -990,7 +989,7 @@ void MatterReportingAttributeChangeCallback(EndpointId endpoint, ClusterId clust // applications notifying about changes from their end. assertChipStackLockedByCurrentThread(); - ClusterInfo info; + AttributePathParams info; info.mClusterId = clusterId; info.mAttributeId = attributeId; info.mEndpointId = endpoint; @@ -1010,7 +1009,7 @@ void MatterReportingAttributeChangeCallback(EndpointId endpoint) // applications notifying about changes from their end. assertChipStackLockedByCurrentThread(); - ClusterInfo info; + AttributePathParams info; info.mEndpointId = endpoint; // We are adding or enabling a whole endpoint, in this case, we do not touch the cluster data version. diff --git a/src/app/util/mock/attribute-storage.cpp b/src/app/util/mock/attribute-storage.cpp index 9cb0fa6a172cce..6371b179cdfe8a 100644 --- a/src/app/util/mock/attribute-storage.cpp +++ b/src/app/util/mock/attribute-storage.cpp @@ -37,7 +37,6 @@ #include #include -#include #include #include #include