From 27152339bdc8db5619ed526898ee32aef7fb7851 Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Mon, 1 Nov 2021 15:13:44 -0700 Subject: [PATCH] Rename EventPath and EventPathList (#11278) --- src/app/BUILD.gn | 8 +-- src/app/EventManagement.cpp | 8 +-- src/app/MessageDef/EventDataElement.cpp | 6 +- src/app/MessageDef/EventDataElement.h | 12 ++-- .../{EventPath.cpp => EventPathIB.cpp} | 64 ++++--------------- .../MessageDef/{EventPath.h => EventPathIB.h} | 62 +++++------------- .../{EventPathList.cpp => EventPaths.cpp} | 33 ++++------ .../{EventPathList.h => EventPaths.h} | 26 ++++---- src/app/MessageDef/ReadRequest.cpp | 24 +++---- src/app/MessageDef/ReadRequest.h | 18 +++--- src/app/MessageDef/SubscribeRequest.cpp | 20 +++--- src/app/MessageDef/SubscribeRequest.h | 14 ++-- src/app/MessageDef/SubscribeResponse.h | 2 +- src/app/MessageDef/WriteRequest.h | 2 +- src/app/ReadClient.cpp | 26 ++++---- src/app/ReadClient.h | 4 +- src/app/ReadHandler.cpp | 20 +++--- src/app/ReadHandler.h | 2 +- src/app/WriteHandler.cpp | 2 +- src/app/tests/TestMessageDef.cpp | 52 +++++++-------- src/app/tests/TestReadInteraction.cpp | 20 +++--- 21 files changed, 175 insertions(+), 250 deletions(-) rename src/app/MessageDef/{EventPath.cpp => EventPathIB.cpp} (74%) rename src/app/MessageDef/{EventPath.h => EventPathIB.h} (69%) rename src/app/MessageDef/{EventPathList.cpp => EventPaths.cpp} (71%) rename src/app/MessageDef/{EventPathList.h => EventPaths.h} (77%) diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 3cd8ff62e19e7d..8f44bcab0613fc 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -71,10 +71,10 @@ static_library("app") { "MessageDef/EventFilters.cpp", "MessageDef/EventList.cpp", "MessageDef/EventList.h", - "MessageDef/EventPath.cpp", - "MessageDef/EventPath.h", - "MessageDef/EventPathList.cpp", - "MessageDef/EventPathList.h", + "MessageDef/EventPathIB.cpp", + "MessageDef/EventPathIB.h", + "MessageDef/EventPaths.cpp", + "MessageDef/EventPaths.h", "MessageDef/InvokeCommand.cpp", "MessageDef/InvokeCommand.h", "MessageDef/ListBuilder.cpp", diff --git a/src/app/EventManagement.cpp b/src/app/EventManagement.cpp index 2df0de0f36945e..7144d06f93e437 100644 --- a/src/app/EventManagement.cpp +++ b/src/app/EventManagement.cpp @@ -303,7 +303,7 @@ CHIP_ERROR EventManagement::ConstructEvent(EventLoadOutContext * apContext, Even TLVWriter checkpoint = apContext->mWriter; TLV::TLVType dataContainerType; EventDataElement::Builder eventDataElementBuilder; - EventPath::Builder eventPathBuilder; + EventPathIB::Builder eventPathBuilder; uint64_t deltatime = 0; VerifyOrExit(apContext->mCurrentEventNumber >= apContext->mStartingEventNumber, @@ -313,7 +313,7 @@ CHIP_ERROR EventManagement::ConstructEvent(EventLoadOutContext * apContext, Even VerifyOrExit(apOptions->mTimestamp.mType != Timestamp::Type::kInvalid, err = CHIP_ERROR_INVALID_ARGUMENT); eventDataElementBuilder.Init(&(apContext->mWriter)); - eventPathBuilder = eventDataElementBuilder.CreateEventPathBuilder(); + eventPathBuilder = eventDataElementBuilder.CreateEventPath(); err = eventPathBuilder.GetError(); SuccessOrExit(err); @@ -322,7 +322,7 @@ CHIP_ERROR EventManagement::ConstructEvent(EventLoadOutContext * apContext, Even .EndpointId(apOptions->mpEventSchema->mEndpointId) .ClusterId(apOptions->mpEventSchema->mClusterId) .EventId(apOptions->mpEventSchema->mEventId) - .EndOfEventPath(); + .EndOfEventPathIB(); err = eventPathBuilder.GetError(); SuccessOrExit(err); @@ -751,7 +751,7 @@ CHIP_ERROR EventManagement::FetchEventParameters(const TLVReader & aReader, size if (reader.GetTag() == TLV::ContextTag(EventDataElement::kCsTag_EventPath)) { - EventPath::Parser path; + EventPathIB::Parser path; ReturnErrorOnFailure(path.Init(aReader)); ReturnErrorOnFailure(path.GetNodeId(&(envelope->mNodeId))); ReturnErrorOnFailure(path.GetEndpointId(&(envelope->mEndpointId))); diff --git a/src/app/MessageDef/EventDataElement.cpp b/src/app/MessageDef/EventDataElement.cpp index da507e06d18a89..2e5ac2c99ddd58 100644 --- a/src/app/MessageDef/EventDataElement.cpp +++ b/src/app/MessageDef/EventDataElement.cpp @@ -241,7 +241,7 @@ CHIP_ERROR EventDataElement::Parser::CheckSchemaValidity() const #if CHIP_DETAIL_LOGGING { - EventPath::Parser path; + EventPathIB::Parser path; err = path.Init(reader); SuccessOrExit(err); @@ -395,7 +395,7 @@ CHIP_ERROR EventDataElement::Parser::CheckSchemaValidity() const } #endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR EventDataElement::Parser::GetEventPath(EventPath::Parser * const apEventPath) +CHIP_ERROR EventDataElement::Parser::GetEventPath(EventPathIB::Parser * const apEventPath) { CHIP_ERROR err = CHIP_NO_ERROR; chip::TLV::TLVReader reader; @@ -458,7 +458,7 @@ CHIP_ERROR EventDataElement::Builder::Init(chip::TLV::TLVWriter * const apWriter return InitAnonymousStructure(apWriter); } -EventPath::Builder & EventDataElement::Builder::CreateEventPathBuilder() +EventPathIB::Builder & EventDataElement::Builder::CreateEventPath() { // skip if error has already been set if (mError == CHIP_NO_ERROR) diff --git a/src/app/MessageDef/EventDataElement.h b/src/app/MessageDef/EventDataElement.h index 0ca56e9229125f..fcaf100141e6e4 100644 --- a/src/app/MessageDef/EventDataElement.h +++ b/src/app/MessageDef/EventDataElement.h @@ -24,7 +24,7 @@ #pragma once #include "Builder.h" -#include "EventPath.h" +#include "EventPathIB.h" #include "Parser.h" @@ -88,7 +88,7 @@ class Parser : public chip::app::Parser * #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not a Path * #CHIP_END_OF_TLV if there is no such element */ - CHIP_ERROR GetEventPath(EventPath::Parser * const apEventPath); + CHIP_ERROR GetEventPath(EventPathIB::Parser * const apEventPath); /** * @brief Get a TLVReader for the Number. Next() must be called before accessing them. @@ -184,11 +184,11 @@ class Builder : public chip::app::Builder CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter); /** - * @brief Initialize a EventPath::Builder for writing into the TLV stream + * @brief Initialize a EventPathIB::Builder for writing into the TLV stream * - * @return A reference to EventPath::Builder + * @return A reference to EventPathIB::Builder */ - EventPath::Builder & CreateEventPathBuilder(); + EventPathIB::Builder & CreateEventPath(); /** * @brief Inject PriorityLevel into the TLV stream to indicate the priority level associated with @@ -261,7 +261,7 @@ class Builder : public chip::app::Builder EventDataElement::Builder & EndOfEventDataElement(); private: - EventPath::Builder mEventPathBuilder; + EventPathIB::Builder mEventPathBuilder; }; }; // namespace EventDataElement }; // namespace app diff --git a/src/app/MessageDef/EventPath.cpp b/src/app/MessageDef/EventPathIB.cpp similarity index 74% rename from src/app/MessageDef/EventPath.cpp rename to src/app/MessageDef/EventPathIB.cpp index 5c134550b5af43..a4f8ca846a8f97 100644 --- a/src/app/MessageDef/EventPath.cpp +++ b/src/app/MessageDef/EventPathIB.cpp @@ -21,7 +21,7 @@ * */ -#include "EventPath.h" +#include "EventPathIB.h" #include "MessageDefHelper.h" @@ -36,24 +36,8 @@ using namespace chip::TLV; namespace chip { namespace app { -CHIP_ERROR EventPath::Parser::Init(const chip::TLV::TLVReader & aReader) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - // make a copy of the reader here - mReader.Init(aReader); - - VerifyOrExit(chip::TLV::kTLVType_List == mReader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE); - - err = mReader.EnterContainer(mOuterContainerType); - -exit: - - return err; -} - #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR EventPath::Parser::CheckSchemaValidity() const +CHIP_ERROR EventPathIB::Parser::CheckSchemaValidity() const { CHIP_ERROR err = CHIP_NO_ERROR; uint16_t TagPresenceMask = 0; @@ -110,10 +94,10 @@ CHIP_ERROR EventPath::Parser::CheckSchemaValidity() const } #endif // CHIP_DETAIL_LOGGING break; - case chip::app::EventPath::kCsTag_EventId: + case chip::app::EventPathIB::kCsTag_EventId: // check if this tag has appeared before - VerifyOrExit(!(TagPresenceMask & (1 << chip::app::EventPath::kCsTag_EventId)), err = CHIP_ERROR_INVALID_TLV_TAG); - TagPresenceMask |= (1 << chip::app::EventPath::kCsTag_EventId); + VerifyOrExit(!(TagPresenceMask & (1 << chip::app::EventPathIB::kCsTag_EventId)), err = CHIP_ERROR_INVALID_TLV_TAG); + TagPresenceMask |= (1 << chip::app::EventPathIB::kCsTag_EventId); VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE); #if CHIP_DETAIL_LOGGING @@ -156,47 +140,27 @@ CHIP_ERROR EventPath::Parser::CheckSchemaValidity() const } #endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR EventPath::Parser::GetNodeId(chip::NodeId * const apNodeId) const +CHIP_ERROR EventPathIB::Parser::GetNodeId(chip::NodeId * const apNodeId) const { return GetUnsignedInteger(kCsTag_NodeId, apNodeId); } -CHIP_ERROR EventPath::Parser::GetEndpointId(chip::EndpointId * const apEndpointID) const +CHIP_ERROR EventPathIB::Parser::GetEndpointId(chip::EndpointId * const apEndpointID) const { return GetUnsignedInteger(kCsTag_EndpointId, apEndpointID); } -CHIP_ERROR EventPath::Parser::GetClusterId(chip::ClusterId * const apClusterId) const +CHIP_ERROR EventPathIB::Parser::GetClusterId(chip::ClusterId * const apClusterId) const { return GetUnsignedInteger(kCsTag_ClusterId, apClusterId); } -CHIP_ERROR EventPath::Parser::GetEventId(chip::EventId * const apEventId) const +CHIP_ERROR EventPathIB::Parser::GetEventId(chip::EventId * const apEventId) const { return GetUnsignedInteger(kCsTag_EventId, apEventId); } -CHIP_ERROR EventPath::Builder::_Init(chip::TLV::TLVWriter * const apWriter, const Tag aTag) -{ - mpWriter = apWriter; - mError = mpWriter->StartContainer(aTag, chip::TLV::kTLVType_List, mOuterContainerType); - SuccessOrExit(mError); - -exit: - return mError; -} - -CHIP_ERROR EventPath::Builder::Init(chip::TLV::TLVWriter * const apWriter) -{ - return _Init(apWriter, chip::TLV::AnonymousTag); -} - -CHIP_ERROR EventPath::Builder::Init(chip::TLV::TLVWriter * const apWriter, const uint8_t aContextTagToUse) -{ - return _Init(apWriter, chip::TLV::ContextTag(aContextTagToUse)); -} - -EventPath::Builder & EventPath::Builder::NodeId(const uint64_t aNodeId) +EventPathIB::Builder & EventPathIB::Builder::NodeId(const uint64_t aNodeId) { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -206,7 +170,7 @@ EventPath::Builder & EventPath::Builder::NodeId(const uint64_t aNodeId) return *this; } -EventPath::Builder & EventPath::Builder::EndpointId(const chip::EndpointId aEndpointId) +EventPathIB::Builder & EventPathIB::Builder::EndpointId(const chip::EndpointId aEndpointId) { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -216,7 +180,7 @@ EventPath::Builder & EventPath::Builder::EndpointId(const chip::EndpointId aEndp return *this; } -EventPath::Builder & EventPath::Builder::ClusterId(const chip::ClusterId aClusterId) +EventPathIB::Builder & EventPathIB::Builder::ClusterId(const chip::ClusterId aClusterId) { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -226,7 +190,7 @@ EventPath::Builder & EventPath::Builder::ClusterId(const chip::ClusterId aCluste return *this; } -EventPath::Builder & EventPath::Builder::EventId(const chip::EventId aEventId) +EventPathIB::Builder & EventPathIB::Builder::EventId(const chip::EventId aEventId) { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -236,7 +200,7 @@ EventPath::Builder & EventPath::Builder::EventId(const chip::EventId aEventId) return *this; } -EventPath::Builder & EventPath::Builder::EndOfEventPath() +EventPathIB::Builder & EventPathIB::Builder::EndOfEventPathIB() { EndOfContainer(); return *this; diff --git a/src/app/MessageDef/EventPath.h b/src/app/MessageDef/EventPathIB.h similarity index 69% rename from src/app/MessageDef/EventPath.h rename to src/app/MessageDef/EventPathIB.h index 6acec4fcff2982..e159c2868a8c32 100644 --- a/src/app/MessageDef/EventPath.h +++ b/src/app/MessageDef/EventPathIB.h @@ -23,8 +23,8 @@ #pragma once -#include "Builder.h" -#include "Parser.h" +#include "ListBuilder.h" +#include "ListParser.h" #include #include @@ -35,7 +35,7 @@ namespace chip { namespace app { -namespace EventPath { +namespace EventPathIB { enum { kCsTag_NodeId = 0, @@ -44,18 +44,9 @@ enum kCsTag_EventId = 3, }; -class Parser : public chip::app::Parser +class Parser : public ListParser { public: - /** - * @brief Initialize the parser object with TLVReader - * - * @param [in] aReader A pointer to a TLVReader, which should point to the beginning of this EventPath - * - * @return #CHIP_NO_ERROR on success - */ - CHIP_ERROR Init(const chip::TLV::TLVReader & aReader); - #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK /** * @brief Roughly verify the message is correctly formed @@ -82,7 +73,7 @@ class Parser : public chip::app::Parser * #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types * #CHIP_END_OF_TLV if there is no such element */ - CHIP_ERROR GetNodeId(chip::NodeId * const apNodeId) const; + CHIP_ERROR GetNodeId(NodeId * const apNodeId) const; /** * @brief Get a TLVReader for the EndpointId. Next() must be called before accessing them. @@ -93,7 +84,7 @@ class Parser : public chip::app::Parser * #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types * #CHIP_END_OF_TLV if there is no such element */ - CHIP_ERROR GetEndpointId(chip::EndpointId * const apEndpointId) const; + CHIP_ERROR GetEndpointId(EndpointId * const apEndpointId) const; /** * @brief Get a TLVReader for the ClusterId. Next() must be called before accessing them. @@ -104,7 +95,7 @@ class Parser : public chip::app::Parser * #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types * #CHIP_END_OF_TLV if there is no such element */ - CHIP_ERROR GetClusterId(chip::ClusterId * const apClusterId) const; + CHIP_ERROR GetClusterId(ClusterId * const apClusterId) const; /** * @brief Get a TLVReader for the EventId. Next() must be called before accessing them. @@ -115,32 +106,12 @@ class Parser : public chip::app::Parser * #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types * #CHIP_END_OF_TLV if there is no such element */ - CHIP_ERROR GetEventId(chip::EventId * const apEventId) const; + CHIP_ERROR GetEventId(EventId * const apEventId) const; }; -class Builder : public chip::app::Builder +class Builder : public ListBuilder { public: - /** - * @brief Initialize a EventPath::Builder for writing into a TLV stream - * - * @param [in] apWriter A pointer to TLVWriter - * - * @return #CHIP_NO_ERROR on success - */ - CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter); - - /** - * Init the EventPath container with an particular context tag. - * Required to implement arrays of arrays, and to test ListBuilder. - * - * @param[in] apWriter Pointer to the TLVWriter that is encoding the message. - * @param[in] aContextTagToUse A contextTag to use. - * - * @return CHIP_ERROR codes returned by chip::TLV objects. - */ - CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter, const uint8_t aContextTagToUse); - /** * @brief Inject NodeId into the TLV stream. * @@ -148,7 +119,7 @@ class Builder : public chip::app::Builder * * @return A reference to *this */ - EventPath::Builder & NodeId(const chip::NodeId aNodeId); + EventPathIB::Builder & NodeId(const chip::NodeId aNodeId); /** * @brief Inject EndpointId into the TLV stream. @@ -157,7 +128,7 @@ class Builder : public chip::app::Builder * * @return A reference to *this */ - EventPath::Builder & EndpointId(const chip::EndpointId aEndpointId); + EventPathIB::Builder & EndpointId(const chip::EndpointId aEndpointId); /** * @brief Inject ClusterId into the TLV stream. @@ -166,7 +137,7 @@ class Builder : public chip::app::Builder * * @return A reference to *this */ - EventPath::Builder & ClusterId(const chip::ClusterId aClusterId); + EventPathIB::Builder & ClusterId(const chip::ClusterId aClusterId); /** * @brief Inject EventId into the TLV stream. @@ -175,18 +146,15 @@ class Builder : public chip::app::Builder * * @return A reference to *this */ - EventPath::Builder & EventId(const chip::EventId aEventId); + EventPathIB::Builder & EventId(const chip::EventId aEventId); /** * @brief Mark the end of this EventPath * * @return A reference to *this */ - EventPath::Builder & EndOfEventPath(); - -private: - CHIP_ERROR _Init(TLV::TLVWriter * const apWriter, const TLV::Tag aTag); + EventPathIB::Builder & EndOfEventPathIB(); }; -}; // namespace EventPath +}; // namespace EventPathIB }; // namespace app }; // namespace chip diff --git a/src/app/MessageDef/EventPathList.cpp b/src/app/MessageDef/EventPaths.cpp similarity index 71% rename from src/app/MessageDef/EventPathList.cpp rename to src/app/MessageDef/EventPaths.cpp index 73354cf3c36ec9..61639ef41dc3fb 100644 --- a/src/app/MessageDef/EventPathList.cpp +++ b/src/app/MessageDef/EventPaths.cpp @@ -17,11 +17,11 @@ */ /** * @file - * This file defines EventPathList parser and builder in CHIP interaction model + * This file defines EventPaths parser and builder in CHIP interaction model * */ -#include "EventPathList.h" +#include "EventPaths.h" #include "MessageDefHelper.h" @@ -31,22 +31,19 @@ #include -using namespace chip; -using namespace chip::TLV; - namespace chip { namespace app { #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR EventPathList::Parser::CheckSchemaValidity() const +CHIP_ERROR EventPaths::Parser::CheckSchemaValidity() const { CHIP_ERROR err = CHIP_NO_ERROR; size_t NumPath = 0; chip::TLV::TLVReader reader; - PRETTY_PRINT("EventPathList ="); + PRETTY_PRINT("EventPaths ="); PRETTY_PRINT("["); - // make a copy of the EventPathList reader + // make a copy of the EventPaths reader reader.Init(mReader); while (CHIP_NO_ERROR == (err = reader.Next())) @@ -55,7 +52,7 @@ CHIP_ERROR EventPathList::Parser::CheckSchemaValidity() const VerifyOrExit(chip::TLV::kTLVType_List == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE); { - EventPath::Parser path; + EventPathIB::Parser path; err = path.Init(reader); SuccessOrExit(err); @@ -85,22 +82,18 @@ CHIP_ERROR EventPathList::Parser::CheckSchemaValidity() const } #endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -EventPath::Builder & EventPathList::Builder::CreateEventPathBuilder() +EventPathIB::Builder & EventPaths::Builder::CreateEventPath() { - // skip if error has already been set - VerifyOrExit(CHIP_NO_ERROR == mError, mEventPathBuilder.ResetError(mError)); - - mError = mEventPathBuilder.Init(mpWriter); - -exit: - // on error, mPathBuilder would be un-/partial initialized and cannot be used to write anything - return mEventPathBuilder; + if (mError == CHIP_NO_ERROR) + { + mError = mEventPath.Init(mpWriter); + } + return mEventPath; } -EventPathList::Builder & EventPathList::Builder::EndOfEventPathList() +EventPaths::Builder & EventPaths::Builder::EndOfEventPaths() { EndOfContainer(); - return *this; } }; // namespace app diff --git a/src/app/MessageDef/EventPathList.h b/src/app/MessageDef/EventPaths.h similarity index 77% rename from src/app/MessageDef/EventPathList.h rename to src/app/MessageDef/EventPaths.h index f236a04ceb3c8f..454a73c7c0023b 100644 --- a/src/app/MessageDef/EventPathList.h +++ b/src/app/MessageDef/EventPaths.h @@ -17,7 +17,7 @@ */ /** * @file - * This file defines EventPathList parser and builder in CHIP interaction model + * This file defines EventPaths parser and builder in CHIP interaction model * */ @@ -25,8 +25,8 @@ #include "ArrayBuilder.h" #include "ArrayParser.h" -#include "EventPath.h" -#include "EventPathList.h" +#include "EventPathIB.h" +#include "EventPaths.h" #include #include @@ -37,7 +37,7 @@ namespace chip { namespace app { -namespace EventPathList { +namespace EventPaths { class Parser : public ArrayParser { public: @@ -63,22 +63,22 @@ class Builder : public ArrayBuilder { public: /** - * @brief Initialize a EventPath::Builder for writing into the TLV stream + * @brief Initialize a EventPathIB::Builder for writing into the TLV stream * - * @return A reference to EventPath::Builder + * @return A reference to EventPathIB::Builder */ - EventPath::Builder & CreateEventPathBuilder(); + EventPathIB::Builder & CreateEventPath(); /** - * @brief Mark the end of this EventPathList + * @brief Mark the end of this EventPaths * * @return A reference to *this */ - EventPathList::Builder & EndOfEventPathList(); + EventPaths::Builder & EndOfEventPaths(); private: - EventPath::Builder mEventPathBuilder; + EventPathIB::Builder mEventPath; }; -}; // namespace EventPathList -}; // namespace app -}; // namespace chip +} // namespace EventPaths +} // namespace app +} // namespace chip diff --git a/src/app/MessageDef/ReadRequest.cpp b/src/app/MessageDef/ReadRequest.cpp index 6458e32c8f8815..905a3da77e5753 100644 --- a/src/app/MessageDef/ReadRequest.cpp +++ b/src/app/MessageDef/ReadRequest.cpp @@ -56,7 +56,7 @@ CHIP_ERROR ReadRequest::Parser::CheckSchemaValidity() const uint16_t TagPresenceMask = 0; chip::TLV::TLVReader reader; AttributePathList::Parser attributePathList; - EventPathList::Parser eventPathList; + EventPaths::Parser eventPathList; AttributeDataVersionList::Parser attributeDataVersionList; PRETTY_PRINT("ReadRequest ="); PRETTY_PRINT("{"); @@ -83,10 +83,10 @@ CHIP_ERROR ReadRequest::Parser::CheckSchemaValidity() const PRETTY_PRINT_DECDEPTH(); } - else if (chip::TLV::ContextTag(kCsTag_EventPathList) == tag) + else if (chip::TLV::ContextTag(kCsTag_EventPaths) == tag) { - VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_EventPathList)), err = CHIP_ERROR_INVALID_TLV_TAG); - TagPresenceMask |= (1 << kCsTag_EventPathList); + VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_EventPaths)), err = CHIP_ERROR_INVALID_TLV_TAG); + TagPresenceMask |= (1 << kCsTag_EventPaths); VerifyOrExit(chip::TLV::kTLVType_Array == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE); eventPathList.Init(reader); @@ -180,17 +180,17 @@ CHIP_ERROR ReadRequest::Parser::GetAttributePathList(AttributePathList::Parser * return err; } -CHIP_ERROR ReadRequest::Parser::GetEventPathList(EventPathList::Parser * const apEventPathList) const +CHIP_ERROR ReadRequest::Parser::GetEventPaths(EventPaths::Parser * const apEventPaths) const { CHIP_ERROR err = CHIP_NO_ERROR; chip::TLV::TLVReader reader; - err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_EventPathList), reader); + err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_EventPaths), reader); SuccessOrExit(err); VerifyOrExit(chip::TLV::kTLVType_Array == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE); - err = apEventPathList->Init(reader); + err = apEventPaths->Init(reader); SuccessOrExit(err); exit: @@ -241,16 +241,16 @@ AttributePathList::Builder & ReadRequest::Builder::CreateAttributePathListBuilde return mAttributePathListBuilder; } -EventPathList::Builder & ReadRequest::Builder::CreateEventPathListBuilder() +EventPaths::Builder & ReadRequest::Builder::CreateEventPathsBuilder() { // skip if error has already been set - VerifyOrExit(CHIP_NO_ERROR == mError, mEventPathListBuilder.ResetError(mError)); + VerifyOrExit(CHIP_NO_ERROR == mError, mEventPathsBuilder.ResetError(mError)); - mError = mEventPathListBuilder.Init(mpWriter, kCsTag_EventPathList); + mError = mEventPathsBuilder.Init(mpWriter, kCsTag_EventPaths); exit: - // on error, mEventPathListBuilder would be un-/partial initialized and cannot be used to write anything - return mEventPathListBuilder; + // on error, mEventPathsBuilder would be un-/partial initialized and cannot be used to write anything + return mEventPathsBuilder; } AttributeDataVersionList::Builder & ReadRequest::Builder::CreateAttributeDataVersionListBuilder() diff --git a/src/app/MessageDef/ReadRequest.h b/src/app/MessageDef/ReadRequest.h index 2fa6c905f6e5cc..abbd5a82d0da3f 100644 --- a/src/app/MessageDef/ReadRequest.h +++ b/src/app/MessageDef/ReadRequest.h @@ -26,7 +26,7 @@ #include "AttributeDataVersionList.h" #include "AttributePathList.h" #include "Builder.h" -#include "EventPathList.h" +#include "EventPaths.h" #include "Parser.h" @@ -43,7 +43,7 @@ namespace ReadRequest { enum { kCsTag_AttributePathList = 0, - kCsTag_EventPathList = 1, + kCsTag_EventPaths = 1, kCsTag_AttributeDataVersionList = 2, kCsTag_EventNumber = 3, }; @@ -87,14 +87,14 @@ class Parser : public chip::app::Parser CHIP_ERROR GetAttributePathList(AttributePathList::Parser * const apAttributePathList) const; /** - * @brief Get a TLVReader for the EventPathList. Next() must be called before accessing them. + * @brief Get a TLVReader for the EventPaths. Next() must be called before accessing them. * - * @param [in] apEventPathList A pointer to apEventPathList + * @param [in] apEventPaths A pointer to apEventPaths * * @return #CHIP_NO_ERROR on success * #CHIP_END_OF_TLV if there is no such element */ - CHIP_ERROR GetEventPathList(EventPathList::Parser * const apEventPathList) const; + CHIP_ERROR GetEventPaths(EventPaths::Parser * const apEventPaths) const; /** * @brief Get a parser for the AttributeDataVersionList. Next() must be called before accessing them. @@ -137,11 +137,11 @@ class Builder : public chip::app::Builder AttributePathList::Builder & CreateAttributePathListBuilder(); /** - * @brief Initialize a EventPathList::Builder for writing into the TLV stream + * @brief Initialize a EventPaths::Builder for writing into the TLV stream * - * @return A reference to EventPathList::Builder + * @return A reference to EventPaths::Builder */ - EventPathList::Builder & CreateEventPathListBuilder(); + EventPaths::Builder & CreateEventPathsBuilder(); /** * @brief Initialize a AttributeDataVersionList::Builder for writing into the TLV stream @@ -166,7 +166,7 @@ class Builder : public chip::app::Builder private: AttributePathList::Builder mAttributePathListBuilder; - EventPathList::Builder mEventPathListBuilder; + EventPaths::Builder mEventPathsBuilder; AttributeDataVersionList::Builder mAttributeDataVersionListBuilder; }; }; // namespace ReadRequest diff --git a/src/app/MessageDef/SubscribeRequest.cpp b/src/app/MessageDef/SubscribeRequest.cpp index 51bfab0fa2aff0..e6c12a6f7680bc 100644 --- a/src/app/MessageDef/SubscribeRequest.cpp +++ b/src/app/MessageDef/SubscribeRequest.cpp @@ -36,7 +36,7 @@ CHIP_ERROR SubscribeRequest::Parser::CheckSchemaValidity() const uint16_t TagPresenceMask = 0; chip::TLV::TLVReader reader; AttributePathList::Parser attributePathList; - EventPathList::Parser eventPathList; + EventPaths::Parser eventPathList; AttributeDataVersionList::Parser attributeDataVersionList; PRETTY_PRINT("SubscribeRequest ="); PRETTY_PRINT("{"); @@ -60,9 +60,9 @@ CHIP_ERROR SubscribeRequest::Parser::CheckSchemaValidity() const ReturnLogErrorOnFailure(attributePathList.CheckSchemaValidity()); PRETTY_PRINT_DECDEPTH(); break; - case kCsTag_EventPathList: - VerifyOrReturnLogError(!(TagPresenceMask & (1 << kCsTag_EventPathList)), CHIP_ERROR_INVALID_TLV_TAG); - TagPresenceMask |= (1 << kCsTag_EventPathList); + case kCsTag_EventPaths: + VerifyOrReturnLogError(!(TagPresenceMask & (1 << kCsTag_EventPaths)), CHIP_ERROR_INVALID_TLV_TAG); + TagPresenceMask |= (1 << kCsTag_EventPaths); VerifyOrReturnLogError(chip::TLV::kTLVType_Array == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); eventPathList.Init(reader); @@ -173,12 +173,12 @@ CHIP_ERROR SubscribeRequest::Parser::GetAttributePathList(AttributePathList::Par return apAttributePathList->Init(reader); } -CHIP_ERROR SubscribeRequest::Parser::GetEventPathList(EventPathList::Parser * const apEventPathList) const +CHIP_ERROR SubscribeRequest::Parser::GetEventPaths(EventPaths::Parser * const apEventPaths) const { TLV::TLVReader reader; - ReturnLogErrorOnFailure(mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_EventPathList), reader)); + ReturnLogErrorOnFailure(mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_EventPaths), reader)); VerifyOrReturnLogError(chip::TLV::kTLVType_Array == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - return apEventPathList->Init(reader); + return apEventPaths->Init(reader); } CHIP_ERROR @@ -230,14 +230,14 @@ AttributePathList::Builder & SubscribeRequest::Builder::CreateAttributePathListB return mAttributePathListBuilder; } -EventPathList::Builder & SubscribeRequest::Builder::CreateEventPathListBuilder() +EventPaths::Builder & SubscribeRequest::Builder::CreateEventPathsBuilder() { if (mError == CHIP_NO_ERROR) { - mError = mEventPathListBuilder.Init(mpWriter, kCsTag_EventPathList); + mError = mEventPathsBuilder.Init(mpWriter, kCsTag_EventPaths); } - return mEventPathListBuilder; + return mEventPathsBuilder; } AttributeDataVersionList::Builder & SubscribeRequest::Builder::CreateAttributeDataVersionListBuilder() diff --git a/src/app/MessageDef/SubscribeRequest.h b/src/app/MessageDef/SubscribeRequest.h index e59e3a1e6b92d1..6b98e30045e35c 100644 --- a/src/app/MessageDef/SubscribeRequest.h +++ b/src/app/MessageDef/SubscribeRequest.h @@ -20,7 +20,7 @@ #include "AttributeDataVersionList.h" #include "AttributePathList.h" #include "Builder.h" -#include "EventPathList.h" +#include "EventPaths.h" #include "Parser.h" #include #include @@ -35,7 +35,7 @@ namespace SubscribeRequest { enum { kCsTag_AttributePathList = 0, - kCsTag_EventPathList = 1, + kCsTag_EventPaths = 1, kCsTag_AttributeDataVersionList = 2, kCsTag_EventNumber = 3, kCsTag_MinIntervalSeconds = 4, @@ -75,12 +75,12 @@ class Parser : public chip::app::Parser CHIP_ERROR GetAttributePathList(AttributePathList::Parser * const apAttributePathList) const; /** - * @brief Get a TLVReader for the EventPathList. Next() must be called before accessing them. + * @brief Get a TLVReader for the EventPaths. Next() must be called before accessing them. * * @return #CHIP_NO_ERROR on success * #CHIP_END_OF_TLV if there is no such element */ - CHIP_ERROR GetEventPathList(EventPathList::Parser * const apEventPathList) const; + CHIP_ERROR GetEventPaths(EventPaths::Parser * const apEventPaths) const; /** * @brief Get a parser for the AttributeDataVersionList. Next() must be called before accessing them. @@ -136,9 +136,9 @@ class Builder : public chip::app::Builder AttributePathList::Builder & CreateAttributePathListBuilder(); /** - * @brief Initialize a EventPathList::Builder for writing into the TLV stream + * @brief Initialize a EventPaths::Builder for writing into the TLV stream */ - EventPathList::Builder & CreateEventPathListBuilder(); + EventPaths::Builder & CreateEventPathsBuilder(); /** * @brief Initialize a AttributeDataVersionList::Builder for writing into the TLV stream @@ -175,7 +175,7 @@ class Builder : public chip::app::Builder private: AttributePathList::Builder mAttributePathListBuilder; - EventPathList::Builder mEventPathListBuilder; + EventPaths::Builder mEventPathsBuilder; AttributeDataVersionList::Builder mAttributeDataVersionListBuilder; }; } // namespace SubscribeRequest diff --git a/src/app/MessageDef/SubscribeResponse.h b/src/app/MessageDef/SubscribeResponse.h index 0ba9ca4f27d438..2845ef144b7258 100644 --- a/src/app/MessageDef/SubscribeResponse.h +++ b/src/app/MessageDef/SubscribeResponse.h @@ -17,7 +17,7 @@ #pragma once #include "Builder.h" -#include "EventPathList.h" +#include "EventPaths.h" #include "Parser.h" #include #include diff --git a/src/app/MessageDef/WriteRequest.h b/src/app/MessageDef/WriteRequest.h index f3083ac721dc87..44ce0adc99815d 100644 --- a/src/app/MessageDef/WriteRequest.h +++ b/src/app/MessageDef/WriteRequest.h @@ -138,7 +138,7 @@ class Builder : public chip::app::Builder /** * @brief Initialize a AttributeDataVersionList::Builder for writing into the TLV stream * - * @return A reference to EventPathList::Builder + * @return A reference to EventPaths::Builder */ AttributeDataVersionList::Builder & CreateAttributeDataVersionListBuilder(); diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index ba263eb4ae021a..7182a98d431a9f 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -137,10 +137,10 @@ CHIP_ERROR ReadClient::SendReadRequest(ReadPrepareParams & aReadPrepareParams) if (aReadPrepareParams.mEventPathParamsListSize != 0 && aReadPrepareParams.mpEventPathParamsList != nullptr) { - EventPathList::Builder & eventPathListBuilder = request.CreateEventPathListBuilder(); + EventPaths::Builder & eventPathListBuilder = request.CreateEventPathsBuilder(); SuccessOrExit(err = eventPathListBuilder.GetError()); - err = GenerateEventPathList(eventPathListBuilder, aReadPrepareParams.mpEventPathParamsList, - aReadPrepareParams.mEventPathParamsListSize); + err = GenerateEventPaths(eventPathListBuilder, aReadPrepareParams.mpEventPathParamsList, + aReadPrepareParams.mEventPathParamsListSize); SuccessOrExit(err); if (aReadPrepareParams.mEventNumber != 0) { @@ -227,25 +227,25 @@ CHIP_ERROR ReadClient::SendStatusResponse(CHIP_ERROR aError) return CHIP_NO_ERROR; } -CHIP_ERROR ReadClient::GenerateEventPathList(EventPathList::Builder & aEventPathListBuilder, - EventPathParams * apEventPathParamsList, size_t aEventPathParamsListSize) +CHIP_ERROR ReadClient::GenerateEventPaths(EventPaths::Builder & aEventPathsBuilder, EventPathParams * apEventPathParamsList, + size_t aEventPathParamsListSize) { CHIP_ERROR err = CHIP_NO_ERROR; for (size_t eventIndex = 0; eventIndex < aEventPathParamsListSize; ++eventIndex) { - EventPath::Builder eventPathBuilder = aEventPathListBuilder.CreateEventPathBuilder(); - EventPathParams eventPath = apEventPathParamsList[eventIndex]; + EventPathIB::Builder eventPathBuilder = aEventPathsBuilder.CreateEventPath(); + EventPathParams eventPath = apEventPathParamsList[eventIndex]; eventPathBuilder.NodeId(eventPath.mNodeId) .EventId(eventPath.mEventId) .EndpointId(eventPath.mEndpointId) .ClusterId(eventPath.mClusterId) - .EndOfEventPath(); + .EndOfEventPathIB(); SuccessOrExit(err = eventPathBuilder.GetError()); } - aEventPathListBuilder.EndOfEventPathList(); - SuccessOrExit(err = aEventPathListBuilder.GetError()); + aEventPathsBuilder.EndOfEventPaths(); + SuccessOrExit(err = aEventPathsBuilder.GetError()); exit: return err; @@ -613,10 +613,10 @@ CHIP_ERROR ReadClient::SendSubscribeRequest(ReadPrepareParams & aReadPreparePara if (aReadPrepareParams.mEventPathParamsListSize != 0 && aReadPrepareParams.mpEventPathParamsList != nullptr) { - EventPathList::Builder & eventPathListBuilder = request.CreateEventPathListBuilder(); + EventPaths::Builder & eventPathListBuilder = request.CreateEventPathsBuilder(); SuccessOrExit(err = eventPathListBuilder.GetError()); - err = GenerateEventPathList(eventPathListBuilder, aReadPrepareParams.mpEventPathParamsList, - aReadPrepareParams.mEventPathParamsListSize); + err = GenerateEventPaths(eventPathListBuilder, aReadPrepareParams.mpEventPathParamsList, + aReadPrepareParams.mEventPathParamsListSize); SuccessOrExit(err); if (aReadPrepareParams.mEventNumber != 0) diff --git a/src/app/ReadClient.h b/src/app/ReadClient.h index 2b77a6194c2539..31d0583f2b578e 100644 --- a/src/app/ReadClient.h +++ b/src/app/ReadClient.h @@ -237,8 +237,8 @@ class ReadClient : public Messaging::ExchangeDelegate bool IsAwaitingInitialReport() const { return mState == ClientState::AwaitingInitialReport; } bool IsAwaitingSubscribeResponse() const { return mState == ClientState::AwaitingSubscribeResponse; } - CHIP_ERROR GenerateEventPathList(EventPathList::Builder & aEventPathListBuilder, EventPathParams * apEventPathParamsList, - size_t aEventPathParamsListSize); + CHIP_ERROR GenerateEventPaths(EventPaths::Builder & aEventPathsBuilder, EventPathParams * apEventPathParamsList, + size_t aEventPathParamsListSize); CHIP_ERROR GenerateAttributePathList(AttributePathList::Builder & aAttributeathListBuilder, AttributePathParams * apAttributePathParamsList, size_t aAttributePathParamsListSize); CHIP_ERROR ProcessAttributeDataList(TLV::TLVReader & aAttributeDataListReader); diff --git a/src/app/ReadHandler.cpp b/src/app/ReadHandler.cpp index 0383cfdc235961..9a2ff896c84ef7 100644 --- a/src/app/ReadHandler.cpp +++ b/src/app/ReadHandler.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include @@ -256,7 +256,7 @@ CHIP_ERROR ReadHandler::ProcessReadRequest(System::PacketBufferHandle && aPayloa System::PacketBufferTLVReader reader; ReadRequest::Parser readRequestParser; - EventPathList::Parser eventPathListParser; + EventPaths::Parser eventPathListParser; AttributePathList::Parser attributePathListParser; reader.Init(std::move(aPayload)); @@ -282,7 +282,7 @@ CHIP_ERROR ReadHandler::ProcessReadRequest(System::PacketBufferHandle && aPayloa err = ProcessAttributePathList(attributePathListParser); } SuccessOrExit(err); - err = readRequestParser.GetEventPathList(&eventPathListParser); + err = readRequestParser.GetEventPaths(&eventPathListParser); if (err == CHIP_END_OF_TLV) { err = CHIP_NO_ERROR; @@ -290,7 +290,7 @@ CHIP_ERROR ReadHandler::ProcessReadRequest(System::PacketBufferHandle && aPayloa else { SuccessOrExit(err); - err = ProcessEventPathList(eventPathListParser); + err = ProcessEventPaths(eventPathListParser); } SuccessOrExit(err); @@ -375,18 +375,18 @@ CHIP_ERROR ReadHandler::ProcessAttributePathList(AttributePathList::Parser & aAt return err; } -CHIP_ERROR ReadHandler::ProcessEventPathList(EventPathList::Parser & aEventPathListParser) +CHIP_ERROR ReadHandler::ProcessEventPaths(EventPaths::Parser & aEventPathsParser) { CHIP_ERROR err = CHIP_NO_ERROR; TLV::TLVReader reader; - aEventPathListParser.GetReader(&reader); + aEventPathsParser.GetReader(&reader); while (CHIP_NO_ERROR == (err = reader.Next())) { VerifyOrExit(TLV::AnonymousTag == reader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG); VerifyOrExit(TLV::kTLVType_List == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE); ClusterInfo clusterInfo; - EventPath::Parser path; + EventPathIB::Parser path; err = path.Init(reader); SuccessOrExit(err); err = path.GetNodeId(&(clusterInfo.mNodeId)); @@ -542,15 +542,15 @@ CHIP_ERROR ReadHandler::ProcessSubscribeRequest(System::PacketBufferHandle && aP } ReturnLogErrorOnFailure(err); - EventPathList::Parser eventPathListParser; - err = subscribeRequestParser.GetEventPathList(&eventPathListParser); + EventPaths::Parser eventPathListParser; + err = subscribeRequestParser.GetEventPaths(&eventPathListParser); if (err == CHIP_END_OF_TLV) { err = CHIP_NO_ERROR; } else if (err == CHIP_NO_ERROR) { - ReturnLogErrorOnFailure(ProcessEventPathList(eventPathListParser)); + ReturnLogErrorOnFailure(ProcessEventPaths(eventPathListParser)); } ReturnLogErrorOnFailure(err); diff --git a/src/app/ReadHandler.h b/src/app/ReadHandler.h index 1d60dc82599c58..da7e3dcc76866f 100644 --- a/src/app/ReadHandler.h +++ b/src/app/ReadHandler.h @@ -153,7 +153,7 @@ class ReadHandler : public Messaging::ExchangeDelegate CHIP_ERROR ProcessSubscribeRequest(System::PacketBufferHandle && aPayload); CHIP_ERROR ProcessReadRequest(System::PacketBufferHandle && aPayload); CHIP_ERROR ProcessAttributePathList(AttributePathList::Parser & aAttributePathListParser); - CHIP_ERROR ProcessEventPathList(EventPathList::Parser & aEventPathListParser); + CHIP_ERROR ProcessEventPaths(EventPaths::Parser & aEventPathsParser); CHIP_ERROR OnStatusResponse(Messaging::ExchangeContext * apExchangeContext, System::PacketBufferHandle && aPayload); CHIP_ERROR OnMessageReceived(Messaging::ExchangeContext * apExchangeContext, const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload) override; diff --git a/src/app/WriteHandler.cpp b/src/app/WriteHandler.cpp index 7145f8c275536d..d700336e85853b 100644 --- a/src/app/WriteHandler.cpp +++ b/src/app/WriteHandler.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/app/tests/TestMessageDef.cpp b/src/app/tests/TestMessageDef.cpp index 61ff09e96c1935..20d779c37ac81d 100644 --- a/src/app/tests/TestMessageDef.cpp +++ b/src/app/tests/TestMessageDef.cpp @@ -188,15 +188,15 @@ void ParseAttributePathList(nlTestSuite * apSuite, chip::TLV::TLVReader & aReade #endif } -void BuildEventPath(nlTestSuite * apSuite, EventPath::Builder & aEventPathBuilder) +void BuildEventPath(nlTestSuite * apSuite, EventPathIB::Builder & aEventPathBuilder) { CHIP_ERROR err = CHIP_NO_ERROR; - aEventPathBuilder.NodeId(1).EndpointId(2).ClusterId(3).EventId(4).EndOfEventPath(); + aEventPathBuilder.NodeId(1).EndpointId(2).ClusterId(3).EventId(4).EndOfEventPathIB(); err = aEventPathBuilder.GetError(); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); } -void ParseEventPath(nlTestSuite * apSuite, EventPath::Parser & aEventPathParser) +void ParseEventPath(nlTestSuite * apSuite, EventPathIB::Parser & aEventPathParser) { CHIP_ERROR err = CHIP_NO_ERROR; chip::NodeId nodeId = 1; @@ -221,20 +221,20 @@ void ParseEventPath(nlTestSuite * apSuite, EventPath::Parser & aEventPathParser) NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && eventId == 4); } -void BuildEventPathList(nlTestSuite * apSuite, EventPathList::Builder & aEventPathListBuilder) +void BuildEventPaths(nlTestSuite * apSuite, EventPaths::Builder & aEventPathsBuilder) { - EventPath::Builder eventPathBuilder = aEventPathListBuilder.CreateEventPathBuilder(); + EventPathIB::Builder eventPathBuilder = aEventPathsBuilder.CreateEventPath(); NL_TEST_ASSERT(apSuite, eventPathBuilder.GetError() == CHIP_NO_ERROR); BuildEventPath(apSuite, eventPathBuilder); - aEventPathListBuilder.EndOfEventPathList(); - NL_TEST_ASSERT(apSuite, aEventPathListBuilder.GetError() == CHIP_NO_ERROR); + aEventPathsBuilder.EndOfEventPaths(); + NL_TEST_ASSERT(apSuite, aEventPathsBuilder.GetError() == CHIP_NO_ERROR); } -void ParseEventPathList(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseEventPaths(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; - EventPathList::Parser eventPathListParser; + EventPaths::Parser eventPathListParser; err = eventPathListParser.Init(aReader); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -279,7 +279,7 @@ void BuildEventDataElement(nlTestSuite * apSuite, EventDataElement::Builder & aE { CHIP_ERROR err = CHIP_NO_ERROR; - EventPath::Builder eventPathBuilder = aEventDataElementBuilder.CreateEventPathBuilder(); + EventPathIB::Builder eventPathBuilder = aEventDataElementBuilder.CreateEventPath(); NL_TEST_ASSERT(apSuite, eventPathBuilder.GetError() == CHIP_NO_ERROR); BuildEventPath(apSuite, eventPathBuilder); @@ -325,7 +325,7 @@ void ParseEventDataElement(nlTestSuite * apSuite, EventDataElement::Parser & aEv #endif { { - EventPath::Parser eventPath; + EventPathIB::Parser eventPath; err = aEventDataElementParser.GetEventPath(&eventPath); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); } @@ -801,9 +801,9 @@ void BuildReadRequest(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); BuildAttributePathList(apSuite, attributePathList); - EventPathList::Builder eventPathList = readRequestBuilder.CreateEventPathListBuilder(); + EventPaths::Builder eventPathList = readRequestBuilder.CreateEventPathsBuilder(); NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); - BuildEventPathList(apSuite, eventPathList); + BuildEventPaths(apSuite, eventPathList); AttributeDataVersionList::Builder attributeDataVersionList = readRequestBuilder.CreateAttributeDataVersionListBuilder(); NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); @@ -822,7 +822,7 @@ void ParseReadRequest(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) ReadRequest::Parser readRequestParser; AttributePathList::Parser attributePathListParser; - EventPathList::Parser eventPathListParser; + EventPaths::Parser eventPathListParser; AttributeDataVersionList::Parser attributeDataVersionListParser; uint64_t eventNumber; @@ -835,7 +835,7 @@ void ParseReadRequest(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) err = readRequestParser.GetAttributePathList(&attributePathListParser); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - err = readRequestParser.GetEventPathList(&eventPathListParser); + err = readRequestParser.GetEventPaths(&eventPathListParser); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); err = readRequestParser.GetAttributeDataVersionList(&attributeDataVersionListParser); @@ -944,9 +944,9 @@ void BuildSubscribeRequest(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); BuildAttributePathList(apSuite, attributePathList); - EventPathList::Builder eventPathList = subscribeRequestBuilder.CreateEventPathListBuilder(); + EventPaths::Builder eventPathList = subscribeRequestBuilder.CreateEventPathsBuilder(); NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); - BuildEventPathList(apSuite, eventPathList); + BuildEventPaths(apSuite, eventPathList); AttributeDataVersionList::Builder attributeDataVersionList = subscribeRequestBuilder.CreateAttributeDataVersionListBuilder(); NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); @@ -977,7 +977,7 @@ void ParseSubscribeRequest(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader SubscribeRequest::Parser subscribeRequestParser; AttributePathList::Parser attributePathListParser; - EventPathList::Parser eventPathListParser; + EventPaths::Parser eventPathListParser; AttributeDataVersionList::Parser attributeDataVersionListParser; uint64_t eventNumber = 0; uint16_t minIntervalSeconds = 0; @@ -994,7 +994,7 @@ void ParseSubscribeRequest(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader err = subscribeRequestParser.GetAttributePathList(&attributePathListParser); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - err = subscribeRequestParser.GetEventPathList(&eventPathListParser); + err = subscribeRequestParser.GetEventPaths(&eventPathListParser); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); err = subscribeRequestParser.GetAttributeDataVersionList(&attributeDataVersionListParser); @@ -1187,8 +1187,8 @@ void AttributePathListTest(nlTestSuite * apSuite, void * apContext) void EventPathTest(nlTestSuite * apSuite, void * apContext) { CHIP_ERROR err = CHIP_NO_ERROR; - EventPath::Parser eventPathParser; - EventPath::Builder eventPathBuilder; + EventPathIB::Parser eventPathParser; + EventPathIB::Builder eventPathBuilder; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); @@ -1208,19 +1208,19 @@ void EventPathTest(nlTestSuite * apSuite, void * apContext) ParseEventPath(apSuite, eventPathParser); } -void EventPathListTest(nlTestSuite * apSuite, void * apContext) +void EventPathsTest(nlTestSuite * apSuite, void * apContext) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; - EventPathList::Builder eventPathListBuilder; + EventPaths::Builder eventPathListBuilder; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); err = eventPathListBuilder.Init(&writer); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - BuildEventPathList(apSuite, eventPathListBuilder); + BuildEventPaths(apSuite, eventPathListBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -1230,7 +1230,7 @@ void EventPathListTest(nlTestSuite * apSuite, void * apContext) reader.Init(std::move(buf)); err = reader.Next(); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseEventPathList(apSuite, reader); + ParseEventPaths(apSuite, reader); } void CommandPathTest(nlTestSuite * apSuite, void * apContext) @@ -1725,7 +1725,7 @@ const nlTest sTests[] = NL_TEST_DEF("AttributePathTest", AttributePathTest), NL_TEST_DEF("AttributePathListTest", AttributePathListTest), NL_TEST_DEF("EventPathTest", EventPathTest), - NL_TEST_DEF("EventPathListTest", EventPathListTest), + NL_TEST_DEF("EventPathsTest", EventPathsTest), NL_TEST_DEF("CommandPathTest", CommandPathTest), NL_TEST_DEF("EventDataElementTest", EventDataElementTest), NL_TEST_DEF("EventListTest", EventListTest), diff --git a/src/app/tests/TestReadInteraction.cpp b/src/app/tests/TestReadInteraction.cpp index 15faa65fa764ed..0dada8dfda048b 100644 --- a/src/app/tests/TestReadInteraction.cpp +++ b/src/app/tests/TestReadInteraction.cpp @@ -258,8 +258,8 @@ class TestReadInteraction static void TestReadHandler(nlTestSuite * apSuite, void * apContext); static void TestReadClientGenerateAttributePathList(nlTestSuite * apSuite, void * apContext); static void TestReadClientGenerateInvalidAttributePathList(nlTestSuite * apSuite, void * apContext); - static void TestReadClientGenerateOneEventPathList(nlTestSuite * apSuite, void * apContext); - static void TestReadClientGenerateTwoEventPathList(nlTestSuite * apSuite, void * apContext); + static void TestReadClientGenerateOneEventPaths(nlTestSuite * apSuite, void * apContext); + static void TestReadClientGenerateTwoEventPaths(nlTestSuite * apSuite, void * apContext); static void TestReadClientInvalidReport(nlTestSuite * apSuite, void * apContext); static void TestReadHandlerInvalidAttributePath(nlTestSuite * apSuite, void * apContext); static void TestProcessSubscribeResponse(nlTestSuite * apSuite, void * apContext); @@ -547,7 +547,7 @@ void TestReadInteraction::TestReadHandlerInvalidAttributePath(nlTestSuite * apSu engine->Shutdown(); } -void TestReadInteraction::TestReadClientGenerateOneEventPathList(nlTestSuite * apSuite, void * apContext) +void TestReadInteraction::TestReadClientGenerateOneEventPaths(nlTestSuite * apSuite, void * apContext) { CHIP_ERROR err = CHIP_NO_ERROR; TestContext & ctx = *static_cast(apContext); @@ -571,8 +571,8 @@ void TestReadInteraction::TestReadClientGenerateOneEventPathList(nlTestSuite * a eventPathParams[0].mClusterId = 3; eventPathParams[0].mEventId = 4; - EventPathList::Builder & eventPathListBuilder = request.CreateEventPathListBuilder(); - err = readClient.GenerateEventPathList(eventPathListBuilder, eventPathParams, 1 /*aEventPathParamsListSize*/); + EventPaths::Builder & eventPathListBuilder = request.CreateEventPathsBuilder(); + err = readClient.GenerateEventPaths(eventPathListBuilder, eventPathParams, 1 /*aEventPathParamsListSize*/); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); request.EndOfReadRequest(); @@ -596,7 +596,7 @@ void TestReadInteraction::TestReadClientGenerateOneEventPathList(nlTestSuite * a #endif } -void TestReadInteraction::TestReadClientGenerateTwoEventPathList(nlTestSuite * apSuite, void * apContext) +void TestReadInteraction::TestReadClientGenerateTwoEventPaths(nlTestSuite * apSuite, void * apContext) { CHIP_ERROR err = CHIP_NO_ERROR; TestContext & ctx = *static_cast(apContext); @@ -625,8 +625,8 @@ void TestReadInteraction::TestReadClientGenerateTwoEventPathList(nlTestSuite * a eventPathParams[1].mClusterId = 3; eventPathParams[1].mEventId = 5; - EventPathList::Builder & eventPathListBuilder = request.CreateEventPathListBuilder(); - err = readClient.GenerateEventPathList(eventPathListBuilder, eventPathParams, 2 /*aEventPathParamsListSize*/); + EventPaths::Builder & eventPathListBuilder = request.CreateEventPathsBuilder(); + err = readClient.GenerateEventPaths(eventPathListBuilder, eventPathParams, 2 /*aEventPathParamsListSize*/); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); request.EndOfReadRequest(); @@ -1099,8 +1099,8 @@ const nlTest sTests[] = NL_TEST_DEF("CheckReadHandler", chip::app::TestReadInteraction::TestReadHandler), NL_TEST_DEF("TestReadClientGenerateAttributePathList", chip::app::TestReadInteraction::TestReadClientGenerateAttributePathList), NL_TEST_DEF("TestReadClientGenerateInvalidAttributePathList", chip::app::TestReadInteraction::TestReadClientGenerateInvalidAttributePathList), - NL_TEST_DEF("TestReadClientGenerateOneEventPathList", chip::app::TestReadInteraction::TestReadClientGenerateOneEventPathList), - NL_TEST_DEF("TestReadClientGenerateTwoEventPathList", chip::app::TestReadInteraction::TestReadClientGenerateTwoEventPathList), + NL_TEST_DEF("TestReadClientGenerateOneEventPaths", chip::app::TestReadInteraction::TestReadClientGenerateOneEventPaths), + NL_TEST_DEF("TestReadClientGenerateTwoEventPaths", chip::app::TestReadInteraction::TestReadClientGenerateTwoEventPaths), NL_TEST_DEF("TestReadClientInvalidReport", chip::app::TestReadInteraction::TestReadClientInvalidReport), NL_TEST_DEF("TestReadHandlerInvalidAttributePath", chip::app::TestReadInteraction::TestReadHandlerInvalidAttributePath), NL_TEST_DEF("TestProcessSubscribeResponse", chip::app::TestReadInteraction::TestProcessSubscribeResponse),