From 12ec702ff4e6bdcd40deb9e54a7b9614b989cdaf Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Mon, 1 Nov 2021 19:53:29 -0700 Subject: [PATCH] Rename several IM message with Message postfix (#11289) * Rename several IM message with Message postfix -- Per IM spec, need to update SubscribeRequest/Response, ReadRequest, ReportData, StatusResponse wtih Message postfix --- src/app/BUILD.gn | 18 +-- src/app/InteractionModelEngine.cpp | 4 +- src/app/InteractionModelEngine.h | 2 +- ...ReadRequest.cpp => ReadRequestMessage.cpp} | 30 ++--- .../{ReadRequest.h => ReadRequestMessage.h} | 14 +- .../{ReportData.cpp => ReportDataMessage.cpp} | 34 ++--- .../{ReportData.h => ReportDataMessage.h} | 28 ++-- ...Response.cpp => StatusResponseMessage.cpp} | 14 +- ...atusResponse.h => StatusResponseMessage.h} | 6 +- ...equest.cpp => SubscribeRequestMessage.cpp} | 45 +++---- ...ibeRequest.h => SubscribeRequestMessage.h} | 18 +-- ...ponse.cpp => SubscribeResponseMessage.cpp} | 26 ++-- ...eResponse.h => SubscribeResponseMessage.h} | 14 +- ...iteRequest.cpp => WriteRequestMessage.cpp} | 32 ++--- .../{WriteRequest.h => WriteRequestMessage.h} | 16 +-- ...eResponse.cpp => WriteResponseMessage.cpp} | 20 +-- ...WriteResponse.h => WriteResponseMessage.h} | 12 +- src/app/ReadClient.cpp | 14 +- src/app/ReadClient.h | 8 +- src/app/ReadHandler.cpp | 18 +-- src/app/WriteClient.cpp | 4 +- src/app/WriteClient.h | 4 +- src/app/WriteHandler.cpp | 4 +- src/app/WriteHandler.h | 4 +- src/app/reporting/Engine.cpp | 11 +- src/app/reporting/Engine.h | 6 +- src/app/tests/BUILD.gn | 2 +- src/app/tests/TestMessageDef.cpp | 120 +++++++++--------- src/app/tests/TestReadInteraction.cpp | 36 +++--- src/app/tests/TestReportingEngine.cpp | 4 +- ...onse.cpp => TestStatusResponseMessage.cpp} | 32 ++--- src/app/tests/TestWriteInteraction.cpp | 8 +- .../tests/integration/chip_im_initiator.cpp | 18 +-- 33 files changed, 316 insertions(+), 310 deletions(-) rename src/app/MessageDef/{ReadRequest.cpp => ReadRequestMessage.cpp} (85%) rename src/app/MessageDef/{ReadRequest.h => ReadRequestMessage.h} (92%) rename src/app/MessageDef/{ReportData.cpp => ReportDataMessage.cpp} (84%) rename src/app/MessageDef/{ReportData.h => ReportDataMessage.h} (86%) rename src/app/MessageDef/{StatusResponse.cpp => StatusResponseMessage.cpp} (83%) rename src/app/MessageDef/{StatusResponse.h => StatusResponseMessage.h} (93%) rename src/app/MessageDef/{SubscribeRequest.cpp => SubscribeRequestMessage.cpp} (81%) rename src/app/MessageDef/{SubscribeRequest.h => SubscribeRequestMessage.h} (90%) rename src/app/MessageDef/{SubscribeResponse.cpp => SubscribeResponseMessage.cpp} (80%) rename src/app/MessageDef/{SubscribeResponse.h => SubscribeResponseMessage.h} (86%) rename src/app/MessageDef/{WriteRequest.cpp => WriteRequestMessage.cpp} (82%) rename src/app/MessageDef/{WriteRequest.h => WriteRequestMessage.h} (90%) rename src/app/MessageDef/{WriteResponse.cpp => WriteResponseMessage.cpp} (81%) rename src/app/MessageDef/{WriteResponse.h => WriteResponseMessage.h} (89%) rename src/app/tests/{TestStatusResponse.cpp => TestStatusResponseMessage.cpp} (77%) diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 8f44bcab0613fc..066723102194f9 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -83,20 +83,20 @@ static_library("app") { "MessageDef/MessageDefHelper.h", "MessageDef/Parser.cpp", "MessageDef/Parser.h", - "MessageDef/ReadRequest.cpp", - "MessageDef/ReadRequest.h", - "MessageDef/ReportData.cpp", - "MessageDef/ReportData.h", + "MessageDef/ReadRequestMessage.cpp", + "MessageDef/ReadRequestMessage.h", + "MessageDef/ReportDataMessage.cpp", + "MessageDef/ReportDataMessage.h", "MessageDef/StatusIB.cpp", "MessageDef/StatusIB.h", - "MessageDef/StatusResponse.cpp", + "MessageDef/StatusResponseMessage.cpp", "MessageDef/StructBuilder.cpp", "MessageDef/StructParser.cpp", - "MessageDef/SubscribeRequest.cpp", - "MessageDef/SubscribeResponse.cpp", + "MessageDef/SubscribeRequestMessage.cpp", + "MessageDef/SubscribeResponseMessage.cpp", "MessageDef/TimedRequestMessage.cpp", - "MessageDef/WriteRequest.cpp", - "MessageDef/WriteResponse.cpp", + "MessageDef/WriteRequestMessage.cpp", + "MessageDef/WriteResponseMessage.cpp", "ReadClient.cpp", "ReadHandler.cpp", "WriteClient.cpp", diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index 06c859a2c7f6b0..b4135df49fa0df 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -297,7 +297,7 @@ CHIP_ERROR InteractionModelEngine::OnReadInitialRequest(Messaging::ExchangeConte System::PacketBufferTLVReader reader; reader.Init(aPayload.Retain()); SuccessOrExit(err = reader.Next()); - SubscribeRequest::Parser subscribeRequestParser; + SubscribeRequestMessage::Parser subscribeRequestParser; SuccessOrExit(err = subscribeRequestParser.Init(reader)); err = subscribeRequestParser.GetKeepSubscriptions(&keepSubscriptions); if (err == CHIP_NO_ERROR && !keepSubscriptions) @@ -364,7 +364,7 @@ CHIP_ERROR InteractionModelEngine::OnUnsolicitedReportData(Messaging::ExchangeCo reader.Init(aPayload.Retain()); ReturnLogErrorOnFailure(reader.Next()); - ReportData::Parser report; + ReportDataMessage::Parser report; ReturnLogErrorOnFailure(report.Init(reader)); uint64_t subscriptionId = 0; diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h index fec05f058738bf..517d83b66f8dba 100644 --- a/src/app/InteractionModelEngine.h +++ b/src/app/InteractionModelEngine.h @@ -25,7 +25,7 @@ #pragma once -#include +#include #include #include #include diff --git a/src/app/MessageDef/ReadRequest.cpp b/src/app/MessageDef/ReadRequestMessage.cpp similarity index 85% rename from src/app/MessageDef/ReadRequest.cpp rename to src/app/MessageDef/ReadRequestMessage.cpp index 905a3da77e5753..911f33a48841f1 100644 --- a/src/app/MessageDef/ReadRequest.cpp +++ b/src/app/MessageDef/ReadRequestMessage.cpp @@ -15,11 +15,11 @@ */ /** * @file - * This file defines ReadRequest parser and builder in CHIP interaction model + * This file defines ReadRequestMessage parser and builder in CHIP interaction model * */ -#include "ReadRequest.h" +#include "ReadRequestMessage.h" #include "MessageDefHelper.h" #include @@ -33,7 +33,7 @@ using namespace chip::TLV; namespace chip { namespace app { -CHIP_ERROR ReadRequest::Parser::Init(const chip::TLV::TLVReader & aReader) +CHIP_ERROR ReadRequestMessage::Parser::Init(const chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -50,7 +50,7 @@ CHIP_ERROR ReadRequest::Parser::Init(const chip::TLV::TLVReader & aReader) } #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR ReadRequest::Parser::CheckSchemaValidity() const +CHIP_ERROR ReadRequestMessage::Parser::CheckSchemaValidity() const { CHIP_ERROR err = CHIP_NO_ERROR; uint16_t TagPresenceMask = 0; @@ -58,7 +58,7 @@ CHIP_ERROR ReadRequest::Parser::CheckSchemaValidity() const AttributePathList::Parser attributePathList; EventPaths::Parser eventPathList; AttributeDataVersionList::Parser attributeDataVersionList; - PRETTY_PRINT("ReadRequest ="); + PRETTY_PRINT("ReadRequestMessage ="); PRETTY_PRINT("{"); // make a copy of the reader @@ -161,7 +161,7 @@ CHIP_ERROR ReadRequest::Parser::CheckSchemaValidity() const } #endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR ReadRequest::Parser::GetAttributePathList(AttributePathList::Parser * const apAttributePathList) const +CHIP_ERROR ReadRequestMessage::Parser::GetAttributePathList(AttributePathList::Parser * const apAttributePathList) const { CHIP_ERROR err = CHIP_NO_ERROR; chip::TLV::TLVReader reader; @@ -180,7 +180,7 @@ CHIP_ERROR ReadRequest::Parser::GetAttributePathList(AttributePathList::Parser * return err; } -CHIP_ERROR ReadRequest::Parser::GetEventPaths(EventPaths::Parser * const apEventPaths) const +CHIP_ERROR ReadRequestMessage::Parser::GetEventPaths(EventPaths::Parser * const apEventPaths) const { CHIP_ERROR err = CHIP_NO_ERROR; chip::TLV::TLVReader reader; @@ -200,7 +200,7 @@ CHIP_ERROR ReadRequest::Parser::GetEventPaths(EventPaths::Parser * const apEvent } CHIP_ERROR -ReadRequest::Parser::GetAttributeDataVersionList(AttributeDataVersionList::Parser * const apAttributeDataVersionList) const +ReadRequestMessage::Parser::GetAttributeDataVersionList(AttributeDataVersionList::Parser * const apAttributeDataVersionList) const { CHIP_ERROR err = CHIP_NO_ERROR; chip::TLV::TLVReader reader; @@ -219,17 +219,17 @@ ReadRequest::Parser::GetAttributeDataVersionList(AttributeDataVersionList::Parse return err; } -CHIP_ERROR ReadRequest::Parser::GetEventNumber(uint64_t * const apEventNumber) const +CHIP_ERROR ReadRequestMessage::Parser::GetEventNumber(uint64_t * const apEventNumber) const { return GetUnsignedInteger(kCsTag_EventNumber, apEventNumber); } -CHIP_ERROR ReadRequest::Builder::Init(chip::TLV::TLVWriter * const apWriter) +CHIP_ERROR ReadRequestMessage::Builder::Init(chip::TLV::TLVWriter * const apWriter) { return InitAnonymousStructure(apWriter); } -AttributePathList::Builder & ReadRequest::Builder::CreateAttributePathListBuilder() +AttributePathList::Builder & ReadRequestMessage::Builder::CreateAttributePathListBuilder() { // skip if error has already been set VerifyOrExit(CHIP_NO_ERROR == mError, mAttributePathListBuilder.ResetError(mError)); @@ -241,7 +241,7 @@ AttributePathList::Builder & ReadRequest::Builder::CreateAttributePathListBuilde return mAttributePathListBuilder; } -EventPaths::Builder & ReadRequest::Builder::CreateEventPathsBuilder() +EventPaths::Builder & ReadRequestMessage::Builder::CreateEventPathsBuilder() { // skip if error has already been set VerifyOrExit(CHIP_NO_ERROR == mError, mEventPathsBuilder.ResetError(mError)); @@ -253,7 +253,7 @@ EventPaths::Builder & ReadRequest::Builder::CreateEventPathsBuilder() return mEventPathsBuilder; } -AttributeDataVersionList::Builder & ReadRequest::Builder::CreateAttributeDataVersionListBuilder() +AttributeDataVersionList::Builder & ReadRequestMessage::Builder::CreateAttributeDataVersionListBuilder() { // skip if error has already been set VerifyOrExit(CHIP_NO_ERROR == mError, mAttributeDataVersionListBuilder.ResetError(mError)); @@ -265,7 +265,7 @@ AttributeDataVersionList::Builder & ReadRequest::Builder::CreateAttributeDataVer return mAttributeDataVersionListBuilder; } -ReadRequest::Builder & ReadRequest::Builder::EventNumber(const uint64_t aEventNumber) +ReadRequestMessage::Builder & ReadRequestMessage::Builder::EventNumber(const uint64_t aEventNumber) { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -275,7 +275,7 @@ ReadRequest::Builder & ReadRequest::Builder::EventNumber(const uint64_t aEventNu return *this; } -ReadRequest::Builder & ReadRequest::Builder::EndOfReadRequest() +ReadRequestMessage::Builder & ReadRequestMessage::Builder::EndOfReadRequestMessage() { EndOfContainer(); return *this; diff --git a/src/app/MessageDef/ReadRequest.h b/src/app/MessageDef/ReadRequestMessage.h similarity index 92% rename from src/app/MessageDef/ReadRequest.h rename to src/app/MessageDef/ReadRequestMessage.h index abbd5a82d0da3f..116b5fe903be79 100644 --- a/src/app/MessageDef/ReadRequest.h +++ b/src/app/MessageDef/ReadRequestMessage.h @@ -17,7 +17,7 @@ */ /** * @file - * This file defines ReadRequest parser and builder in CHIP interaction model + * This file defines ReadRequestMessage parser and builder in CHIP interaction model * */ @@ -39,7 +39,7 @@ namespace chip { namespace app { -namespace ReadRequest { +namespace ReadRequestMessage { enum { kCsTag_AttributePathList = 0, @@ -121,7 +121,7 @@ class Builder : public chip::app::Builder { public: /** - * @brief Initialize a ReadRequest::Builder for writing into a TLV stream + * @brief Initialize a ReadRequestMessage::Builder for writing into a TLV stream * * @param [in] apWriter A pointer to TLVWriter * @@ -156,19 +156,19 @@ class Builder : public chip::app::Builder * @param [in] aEventNumber The event number * @return A reference to *this */ - ReadRequest::Builder & EventNumber(const uint64_t aEventNumber); + ReadRequestMessage::Builder & EventNumber(const uint64_t aEventNumber); /** - * @brief Mark the end of this ReadRequest + * @brief Mark the end of this ReadRequestMessage * * @return A reference to *this */ - ReadRequest::Builder & EndOfReadRequest(); + ReadRequestMessage::Builder & EndOfReadRequestMessage(); private: AttributePathList::Builder mAttributePathListBuilder; EventPaths::Builder mEventPathsBuilder; AttributeDataVersionList::Builder mAttributeDataVersionListBuilder; }; -}; // namespace ReadRequest +}; // namespace ReadRequestMessage }; // namespace app }; // namespace chip diff --git a/src/app/MessageDef/ReportData.cpp b/src/app/MessageDef/ReportDataMessage.cpp similarity index 84% rename from src/app/MessageDef/ReportData.cpp rename to src/app/MessageDef/ReportDataMessage.cpp index 570082c46aace6..0e50621a37ffad 100644 --- a/src/app/MessageDef/ReportData.cpp +++ b/src/app/MessageDef/ReportDataMessage.cpp @@ -17,11 +17,11 @@ */ /** * @file - * This file defines ReportData parser and builder in CHIP interaction model + * This file defines ReportDataMessage parser and builder in CHIP interaction model * */ -#include "ReportData.h" +#include "ReportDataMessage.h" #include "MessageDefHelper.h" @@ -36,7 +36,7 @@ using namespace chip::TLV; namespace chip { namespace app { -CHIP_ERROR ReportData::Parser::Init(const chip::TLV::TLVReader & aReader) +CHIP_ERROR ReportDataMessage::Parser::Init(const chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -53,7 +53,7 @@ CHIP_ERROR ReportData::Parser::Init(const chip::TLV::TLVReader & aReader) } #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR ReportData::Parser::CheckSchemaValidity() const +CHIP_ERROR ReportDataMessage::Parser::CheckSchemaValidity() const { CHIP_ERROR err = CHIP_NO_ERROR; uint16_t TagPresenceMask = 0; @@ -61,7 +61,7 @@ CHIP_ERROR ReportData::Parser::CheckSchemaValidity() const AttributeDataList::Parser attributeDataList; EventList::Parser eventList; - PRETTY_PRINT("ReportData ="); + PRETTY_PRINT("ReportDataMessage ="); PRETTY_PRINT("{"); // make a copy of the reader @@ -165,17 +165,17 @@ CHIP_ERROR ReportData::Parser::CheckSchemaValidity() const } #endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR ReportData::Parser::GetSuppressResponse(bool * const apSuppressResponse) const +CHIP_ERROR ReportDataMessage::Parser::GetSuppressResponse(bool * const apSuppressResponse) const { return GetSimpleValue(kCsTag_SuppressResponse, chip::TLV::kTLVType_Boolean, apSuppressResponse); } -CHIP_ERROR ReportData::Parser::GetSubscriptionId(uint64_t * const apSubscriptionId) const +CHIP_ERROR ReportDataMessage::Parser::GetSubscriptionId(uint64_t * const apSubscriptionId) const { return GetUnsignedInteger(kCsTag_SubscriptionId, apSubscriptionId); } -CHIP_ERROR ReportData::Parser::GetAttributeDataList(AttributeDataList::Parser * const apAttributeDataList) const +CHIP_ERROR ReportDataMessage::Parser::GetAttributeDataList(AttributeDataList::Parser * const apAttributeDataList) const { CHIP_ERROR err = CHIP_NO_ERROR; chip::TLV::TLVReader reader; @@ -194,7 +194,7 @@ CHIP_ERROR ReportData::Parser::GetAttributeDataList(AttributeDataList::Parser * return err; } -CHIP_ERROR ReportData::Parser::GetEventDataList(EventList::Parser * const apEventDataList) const +CHIP_ERROR ReportDataMessage::Parser::GetEventDataList(EventList::Parser * const apEventDataList) const { CHIP_ERROR err = CHIP_NO_ERROR; chip::TLV::TLVReader reader; @@ -213,17 +213,17 @@ CHIP_ERROR ReportData::Parser::GetEventDataList(EventList::Parser * const apEven return err; } -CHIP_ERROR ReportData::Parser::GetMoreChunkedMessages(bool * const apMoreChunkedMessages) const +CHIP_ERROR ReportDataMessage::Parser::GetMoreChunkedMessages(bool * const apMoreChunkedMessages) const { return GetSimpleValue(kCsTag_MoreChunkedMessages, chip::TLV::kTLVType_Boolean, apMoreChunkedMessages); } -CHIP_ERROR ReportData::Builder::Init(chip::TLV::TLVWriter * const apWriter) +CHIP_ERROR ReportDataMessage::Builder::Init(chip::TLV::TLVWriter * const apWriter) { return InitAnonymousStructure(apWriter); } -ReportData::Builder & ReportData::Builder::SuppressResponse(const bool aSuppressResponse) +ReportDataMessage::Builder & ReportDataMessage::Builder::SuppressResponse(const bool aSuppressResponse) { // skip if error has already been set SuccessOrExit(mError); @@ -233,7 +233,7 @@ ReportData::Builder & ReportData::Builder::SuppressResponse(const bool aSuppress return *this; } -ReportData::Builder & ReportData::Builder::SubscriptionId(const uint64_t aSubscriptionId) +ReportDataMessage::Builder & ReportDataMessage::Builder::SubscriptionId(const uint64_t aSubscriptionId) { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -243,7 +243,7 @@ ReportData::Builder & ReportData::Builder::SubscriptionId(const uint64_t aSubscr return *this; } -AttributeDataList::Builder & ReportData::Builder::CreateAttributeDataListBuilder() +AttributeDataList::Builder & ReportDataMessage::Builder::CreateAttributeDataListBuilder() { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -257,7 +257,7 @@ AttributeDataList::Builder & ReportData::Builder::CreateAttributeDataListBuilder return mAttributeDataListBuilder; } -EventList::Builder & ReportData::Builder::CreateEventDataListBuilder() +EventList::Builder & ReportDataMessage::Builder::CreateEventDataListBuilder() { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -271,7 +271,7 @@ EventList::Builder & ReportData::Builder::CreateEventDataListBuilder() return mEventDataListBuilder; } -ReportData::Builder & ReportData::Builder::MoreChunkedMessages(const bool aMoreChunkedMessages) +ReportDataMessage::Builder & ReportDataMessage::Builder::MoreChunkedMessages(const bool aMoreChunkedMessages) { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -281,7 +281,7 @@ ReportData::Builder & ReportData::Builder::MoreChunkedMessages(const bool aMoreC return *this; } -ReportData::Builder & ReportData::Builder::EndOfReportData() +ReportDataMessage::Builder & ReportDataMessage::Builder::EndOfReportDataMessage() { EndOfContainer(); return *this; diff --git a/src/app/MessageDef/ReportData.h b/src/app/MessageDef/ReportDataMessage.h similarity index 86% rename from src/app/MessageDef/ReportData.h rename to src/app/MessageDef/ReportDataMessage.h index 4e1d937077731b..078a7f128f2484 100644 --- a/src/app/MessageDef/ReportData.h +++ b/src/app/MessageDef/ReportDataMessage.h @@ -17,7 +17,7 @@ */ /** * @file - * This file defines ReportData parser and builder in CHIP interaction model + * This file defines ReportDataMessage parser and builder in CHIP interaction model * */ @@ -37,7 +37,7 @@ namespace chip { namespace app { -namespace ReportData { +namespace ReportDataMessage { enum { kCsTag_SuppressResponse = 0, @@ -53,7 +53,7 @@ class Parser : public chip::app::Parser /** * @brief Initialize the parser object with TLVReader * - * @param [in] aReader A pointer to a TLVReader, which should point to the beginning of this ReportData + * @param [in] aReader A pointer to a TLVReader, which should point to the beginning of this ReportDataMessage * * @return #CHIP_NO_ERROR on success */ @@ -77,7 +77,7 @@ class Parser : public chip::app::Parser #endif /** - * @brief Check whether a response (a StatusReponse specifically) is to be sent back to the request. + * @brief Check whether a response (a StatusResponseMessage specifically) is to be sent back to the request. * Next() must be called before accessing them. * * @param [in] apSuppressResponse A pointer to apSuppressResponse @@ -134,7 +134,7 @@ class Builder : public chip::app::Builder { public: /** - * @brief Initialize a ReportData::Builder for writing into a TLV stream + * @brief Initialize a ReportDataMessage::Builder for writing into a TLV stream * * @param [in] apWriter A pointer to TLVWriter * @@ -143,19 +143,19 @@ class Builder : public chip::app::Builder CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter); /** - * @brief Inject SuppressResponse into the TLV stream to indicate whether a response (a StatusResponse specifically) + * @brief Inject SuppressResponse into the TLV stream to indicate whether a response (a StatusResponseMessage specifically) * is to be sent back to the request. * * @param [in] aSuppressResponse The boolean variable to indicate if request response is needed. * * @return A reference to *this */ - ReportData::Builder & SuppressResponse(const bool aSuppressResponse); + ReportDataMessage::Builder & SuppressResponse(const bool aSuppressResponse); /** * @brief Inject subscription id into the TLV stream, This field contains the Subscription ID - * to which the data is being sent against. This is not present when the ReportDataRequest is - * sent in response to a ReadRequest, but is present when sent in response to a SubscribeRequest. + * to which the data is being sent against. This is not present when the ReportDataMessageRequest is + * sent in response to a ReadRequestMessage, but is present when sent in response to a SubscribeRequestMessage. * Attempts should be made to ensure the SubscriptionId does not collide with IDs from previous * subscriptions to ensure disambiguation. * @@ -163,7 +163,7 @@ class Builder : public chip::app::Builder * * @return A reference to *this */ - ReportData::Builder & SubscriptionId(const uint64_t aSubscriptionId); + ReportDataMessage::Builder & SubscriptionId(const uint64_t aSubscriptionId); /** * @brief Initialize a AttributeDataList::Builder for writing into the TLV stream @@ -184,20 +184,20 @@ class Builder : public chip::app::Builder * @param [in] aMoreChunkedMessages The boolean variable to indicate if there are more chunked messages in a transaction. * @return A reference to *this */ - ReportData::Builder & MoreChunkedMessages(const bool aMoreChunkedMessages); + ReportDataMessage::Builder & MoreChunkedMessages(const bool aMoreChunkedMessages); /** - * @brief Mark the end of this ReportData + * @brief Mark the end of this ReportDataMessage * * @return A reference to *this */ - ReportData::Builder & EndOfReportData(); + ReportDataMessage::Builder & EndOfReportDataMessage(); private: AttributeDataList::Builder mAttributeDataListBuilder; EventList::Builder mEventDataListBuilder; }; -}; // namespace ReportData +}; // namespace ReportDataMessage }; // namespace app }; // namespace chip diff --git a/src/app/MessageDef/StatusResponse.cpp b/src/app/MessageDef/StatusResponseMessage.cpp similarity index 83% rename from src/app/MessageDef/StatusResponse.cpp rename to src/app/MessageDef/StatusResponseMessage.cpp index bd115e9f6156ed..6462af1724cd3d 100644 --- a/src/app/MessageDef/StatusResponse.cpp +++ b/src/app/MessageDef/StatusResponseMessage.cpp @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "StatusResponse.h" +#include "StatusResponseMessage.h" #include "MessageDefHelper.h" namespace chip { namespace app { -CHIP_ERROR StatusResponse::Parser::Init(const TLV::TLVReader & aReader) +CHIP_ERROR StatusResponseMessage::Parser::Init(const TLV::TLVReader & aReader) { // make a copy of the reader here mReader.Init(aReader); @@ -29,12 +29,12 @@ CHIP_ERROR StatusResponse::Parser::Init(const TLV::TLVReader & aReader) } #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR StatusResponse::Parser::CheckSchemaValidity() const +CHIP_ERROR StatusResponseMessage::Parser::CheckSchemaValidity() const { CHIP_ERROR err = CHIP_NO_ERROR; bool statusTagPresence = false; TLV::TLVReader reader; - PRETTY_PRINT("StatusResponse ="); + PRETTY_PRINT("StatusResponseMessage ="); PRETTY_PRINT("{"); // make a copy of the reader @@ -73,7 +73,7 @@ CHIP_ERROR StatusResponse::Parser::CheckSchemaValidity() const } #endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR StatusResponse::Parser::GetStatus(Protocols::InteractionModel::Status & aStatus) const +CHIP_ERROR StatusResponseMessage::Parser::GetStatus(Protocols::InteractionModel::Status & aStatus) const { uint16_t status = 0; CHIP_ERROR err = GetUnsignedInteger(kCsTag_Status, &status); @@ -81,12 +81,12 @@ CHIP_ERROR StatusResponse::Parser::GetStatus(Protocols::InteractionModel::Status return err; } -CHIP_ERROR StatusResponse::Builder::Init(TLV::TLVWriter * const apWriter) +CHIP_ERROR StatusResponseMessage::Builder::Init(TLV::TLVWriter * const apWriter) { return InitAnonymousStructure(apWriter); } -StatusResponse::Builder & StatusResponse::Builder::Status(const Protocols::InteractionModel::Status aStatus) +StatusResponseMessage::Builder & StatusResponseMessage::Builder::Status(const Protocols::InteractionModel::Status aStatus) { // skip if error has already been set if (mError == CHIP_NO_ERROR) diff --git a/src/app/MessageDef/StatusResponse.h b/src/app/MessageDef/StatusResponseMessage.h similarity index 93% rename from src/app/MessageDef/StatusResponse.h rename to src/app/MessageDef/StatusResponseMessage.h index 0148b23ef86873..cfd217dcea0675 100644 --- a/src/app/MessageDef/StatusResponse.h +++ b/src/app/MessageDef/StatusResponseMessage.h @@ -28,7 +28,7 @@ namespace chip { namespace app { -namespace StatusResponse { +namespace StatusResponseMessage { enum { kCsTag_Status = 0, @@ -71,8 +71,8 @@ class Builder : public app::Builder { public: CHIP_ERROR Init(TLV::TLVWriter * const apWriter); - StatusResponse::Builder & Status(const Protocols::InteractionModel::Status aStatus); + StatusResponseMessage::Builder & Status(const Protocols::InteractionModel::Status aStatus); }; -} // namespace StatusResponse +} // namespace StatusResponseMessage } // namespace app } // namespace chip diff --git a/src/app/MessageDef/SubscribeRequest.cpp b/src/app/MessageDef/SubscribeRequestMessage.cpp similarity index 81% rename from src/app/MessageDef/SubscribeRequest.cpp rename to src/app/MessageDef/SubscribeRequestMessage.cpp index e6c12a6f7680bc..91d63c8812ce6d 100644 --- a/src/app/MessageDef/SubscribeRequest.cpp +++ b/src/app/MessageDef/SubscribeRequestMessage.cpp @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "SubscribeRequest.h" +#include "SubscribeRequestMessage.h" #include "MessageDefHelper.h" namespace chip { namespace app { -CHIP_ERROR SubscribeRequest::Parser::Init(const chip::TLV::TLVReader & aReader) +CHIP_ERROR SubscribeRequestMessage::Parser::Init(const chip::TLV::TLVReader & aReader) { // make a copy of the reader here mReader.Init(aReader); @@ -30,7 +30,7 @@ CHIP_ERROR SubscribeRequest::Parser::Init(const chip::TLV::TLVReader & aReader) } #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR SubscribeRequest::Parser::CheckSchemaValidity() const +CHIP_ERROR SubscribeRequestMessage::Parser::CheckSchemaValidity() const { CHIP_ERROR err = CHIP_NO_ERROR; uint16_t TagPresenceMask = 0; @@ -38,7 +38,7 @@ CHIP_ERROR SubscribeRequest::Parser::CheckSchemaValidity() const AttributePathList::Parser attributePathList; EventPaths::Parser eventPathList; AttributeDataVersionList::Parser attributeDataVersionList; - PRETTY_PRINT("SubscribeRequest ="); + PRETTY_PRINT("SubscribeRequestMessage ="); PRETTY_PRINT("{"); // make a copy of the reader @@ -165,7 +165,7 @@ CHIP_ERROR SubscribeRequest::Parser::CheckSchemaValidity() const } #endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR SubscribeRequest::Parser::GetAttributePathList(AttributePathList::Parser * const apAttributePathList) const +CHIP_ERROR SubscribeRequestMessage::Parser::GetAttributePathList(AttributePathList::Parser * const apAttributePathList) const { TLV::TLVReader reader; ReturnLogErrorOnFailure(mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_AttributePathList), reader)); @@ -173,7 +173,7 @@ CHIP_ERROR SubscribeRequest::Parser::GetAttributePathList(AttributePathList::Par return apAttributePathList->Init(reader); } -CHIP_ERROR SubscribeRequest::Parser::GetEventPaths(EventPaths::Parser * const apEventPaths) const +CHIP_ERROR SubscribeRequestMessage::Parser::GetEventPaths(EventPaths::Parser * const apEventPaths) const { TLV::TLVReader reader; ReturnLogErrorOnFailure(mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_EventPaths), reader)); @@ -182,7 +182,8 @@ CHIP_ERROR SubscribeRequest::Parser::GetEventPaths(EventPaths::Parser * const ap } CHIP_ERROR -SubscribeRequest::Parser::GetAttributeDataVersionList(AttributeDataVersionList::Parser * const apAttributeDataVersionList) const +SubscribeRequestMessage::Parser::GetAttributeDataVersionList( + AttributeDataVersionList::Parser * const apAttributeDataVersionList) const { TLV::TLVReader reader; ReturnLogErrorOnFailure(mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_AttributeDataVersionList), reader)); @@ -190,37 +191,37 @@ SubscribeRequest::Parser::GetAttributeDataVersionList(AttributeDataVersionList:: return apAttributeDataVersionList->Init(reader); } -CHIP_ERROR SubscribeRequest::Parser::GetEventNumber(uint64_t * const apEventNumber) const +CHIP_ERROR SubscribeRequestMessage::Parser::GetEventNumber(uint64_t * const apEventNumber) const { return GetUnsignedInteger(kCsTag_EventNumber, apEventNumber); } -CHIP_ERROR SubscribeRequest::Parser::GetMinIntervalSeconds(uint16_t * const apMinIntervalSeconds) const +CHIP_ERROR SubscribeRequestMessage::Parser::GetMinIntervalSeconds(uint16_t * const apMinIntervalSeconds) const { return GetUnsignedInteger(kCsTag_MinIntervalSeconds, apMinIntervalSeconds); } -CHIP_ERROR SubscribeRequest::Parser::GetMaxIntervalSeconds(uint16_t * const apMaxIntervalSeconds) const +CHIP_ERROR SubscribeRequestMessage::Parser::GetMaxIntervalSeconds(uint16_t * const apMaxIntervalSeconds) const { return GetUnsignedInteger(kCsTag_MaxIntervalSeconds, apMaxIntervalSeconds); } -CHIP_ERROR SubscribeRequest::Parser::GetKeepSubscriptions(bool * const apKeepExistingSubscription) const +CHIP_ERROR SubscribeRequestMessage::Parser::GetKeepSubscriptions(bool * const apKeepExistingSubscription) const { return GetSimpleValue(kCsTag_KeepSubscriptions, chip::TLV::kTLVType_Boolean, apKeepExistingSubscription); } -CHIP_ERROR SubscribeRequest::Parser::GetIsProxy(bool * const apIsProxy) const +CHIP_ERROR SubscribeRequestMessage::Parser::GetIsProxy(bool * const apIsProxy) const { return GetSimpleValue(kCsTag_IsProxy, chip::TLV::kTLVType_Boolean, apIsProxy); } -CHIP_ERROR SubscribeRequest::Builder::Init(chip::TLV::TLVWriter * const apWriter) +CHIP_ERROR SubscribeRequestMessage::Builder::Init(chip::TLV::TLVWriter * const apWriter) { return InitAnonymousStructure(apWriter); } -AttributePathList::Builder & SubscribeRequest::Builder::CreateAttributePathListBuilder() +AttributePathList::Builder & SubscribeRequestMessage::Builder::CreateAttributePathListBuilder() { if (mError == CHIP_NO_ERROR) { @@ -230,7 +231,7 @@ AttributePathList::Builder & SubscribeRequest::Builder::CreateAttributePathListB return mAttributePathListBuilder; } -EventPaths::Builder & SubscribeRequest::Builder::CreateEventPathsBuilder() +EventPaths::Builder & SubscribeRequestMessage::Builder::CreateEventPathsBuilder() { if (mError == CHIP_NO_ERROR) { @@ -240,7 +241,7 @@ EventPaths::Builder & SubscribeRequest::Builder::CreateEventPathsBuilder() return mEventPathsBuilder; } -AttributeDataVersionList::Builder & SubscribeRequest::Builder::CreateAttributeDataVersionListBuilder() +AttributeDataVersionList::Builder & SubscribeRequestMessage::Builder::CreateAttributeDataVersionListBuilder() { if (mError == CHIP_NO_ERROR) { @@ -250,7 +251,7 @@ AttributeDataVersionList::Builder & SubscribeRequest::Builder::CreateAttributeDa return mAttributeDataVersionListBuilder; } -SubscribeRequest::Builder & SubscribeRequest::Builder::EventNumber(const uint64_t aEventNumber) +SubscribeRequestMessage::Builder & SubscribeRequestMessage::Builder::EventNumber(const uint64_t aEventNumber) { if (mError == CHIP_NO_ERROR) { @@ -259,7 +260,7 @@ SubscribeRequest::Builder & SubscribeRequest::Builder::EventNumber(const uint64_ return *this; } -SubscribeRequest::Builder & SubscribeRequest::Builder::MinIntervalSeconds(const uint16_t aMinIntervalSeconds) +SubscribeRequestMessage::Builder & SubscribeRequestMessage::Builder::MinIntervalSeconds(const uint16_t aMinIntervalSeconds) { if (mError == CHIP_NO_ERROR) { @@ -268,7 +269,7 @@ SubscribeRequest::Builder & SubscribeRequest::Builder::MinIntervalSeconds(const return *this; } -SubscribeRequest::Builder & SubscribeRequest::Builder::MaxIntervalSeconds(const uint16_t aMaxIntervalSeconds) +SubscribeRequestMessage::Builder & SubscribeRequestMessage::Builder::MaxIntervalSeconds(const uint16_t aMaxIntervalSeconds) { if (mError == CHIP_NO_ERROR) { @@ -277,7 +278,7 @@ SubscribeRequest::Builder & SubscribeRequest::Builder::MaxIntervalSeconds(const return *this; } -SubscribeRequest::Builder & SubscribeRequest::Builder::KeepSubscriptions(const bool aKeepSubscriptions) +SubscribeRequestMessage::Builder & SubscribeRequestMessage::Builder::KeepSubscriptions(const bool aKeepSubscriptions) { if (mError == CHIP_NO_ERROR) { @@ -286,7 +287,7 @@ SubscribeRequest::Builder & SubscribeRequest::Builder::KeepSubscriptions(const b return *this; } -SubscribeRequest::Builder & SubscribeRequest::Builder::IsProxy(const bool aIsProxy) +SubscribeRequestMessage::Builder & SubscribeRequestMessage::Builder::IsProxy(const bool aIsProxy) { if (mError == CHIP_NO_ERROR) { @@ -295,7 +296,7 @@ SubscribeRequest::Builder & SubscribeRequest::Builder::IsProxy(const bool aIsPro return *this; } -SubscribeRequest::Builder & SubscribeRequest::Builder::EndOfSubscribeRequest() +SubscribeRequestMessage::Builder & SubscribeRequestMessage::Builder::EndOfSubscribeRequestMessage() { EndOfContainer(); return *this; diff --git a/src/app/MessageDef/SubscribeRequest.h b/src/app/MessageDef/SubscribeRequestMessage.h similarity index 90% rename from src/app/MessageDef/SubscribeRequest.h rename to src/app/MessageDef/SubscribeRequestMessage.h index 6b98e30045e35c..07a66db9b06c9d 100644 --- a/src/app/MessageDef/SubscribeRequest.h +++ b/src/app/MessageDef/SubscribeRequestMessage.h @@ -31,7 +31,7 @@ namespace chip { namespace app { -namespace SubscribeRequest { +namespace SubscribeRequestMessage { enum { kCsTag_AttributePathList = 0, @@ -149,35 +149,35 @@ class Builder : public chip::app::Builder * @brief An initiator can optionally specify an EventNumber it has already to limit the * set of retrieved events on the server for optimization purposes. */ - SubscribeRequest::Builder & EventNumber(const uint64_t aEventNumber); + SubscribeRequestMessage::Builder & EventNumber(const uint64_t aEventNumber); - SubscribeRequest::Builder & MinIntervalSeconds(const uint16_t aMinIntervalSeconds); + SubscribeRequestMessage::Builder & MinIntervalSeconds(const uint16_t aMinIntervalSeconds); - SubscribeRequest::Builder & MaxIntervalSeconds(const uint16_t aMinIntervalSeconds); + SubscribeRequestMessage::Builder & MaxIntervalSeconds(const uint16_t aMinIntervalSeconds); /** * @brief This is set to 'true' by the subscriber to indicate preservation of previous subscriptions. If omitted, it implies * 'false' as a value. */ - SubscribeRequest::Builder & KeepSubscriptions(const bool aKeepSubscriptions); + SubscribeRequestMessage::Builder & KeepSubscriptions(const bool aKeepSubscriptions); /** * @brief This is set to true by the subscriber if it is a proxy-type device proxying for another client. This * confers it special privileges on the publisher that might result in evictions of other non-proxy subscriptions * to make way for the proxy. */ - SubscribeRequest::Builder & IsProxy(const bool aIsProxy); + SubscribeRequestMessage::Builder & IsProxy(const bool aIsProxy); /** - * @brief Mark the end of this SubscribeRequest + * @brief Mark the end of this SubscribeRequestMessage */ - SubscribeRequest::Builder & EndOfSubscribeRequest(); + SubscribeRequestMessage::Builder & EndOfSubscribeRequestMessage(); private: AttributePathList::Builder mAttributePathListBuilder; EventPaths::Builder mEventPathsBuilder; AttributeDataVersionList::Builder mAttributeDataVersionListBuilder; }; -} // namespace SubscribeRequest +} // namespace SubscribeRequestMessage } // namespace app } // namespace chip diff --git a/src/app/MessageDef/SubscribeResponse.cpp b/src/app/MessageDef/SubscribeResponseMessage.cpp similarity index 80% rename from src/app/MessageDef/SubscribeResponse.cpp rename to src/app/MessageDef/SubscribeResponseMessage.cpp index 6add842ded8c92..8248058212b507 100644 --- a/src/app/MessageDef/SubscribeResponse.cpp +++ b/src/app/MessageDef/SubscribeResponseMessage.cpp @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "SubscribeResponse.h" +#include "SubscribeResponseMessage.h" #include "MessageDefHelper.h" namespace chip { namespace app { -CHIP_ERROR SubscribeResponse::Parser::Init(const chip::TLV::TLVReader & aReader) +CHIP_ERROR SubscribeResponseMessage::Parser::Init(const chip::TLV::TLVReader & aReader) { // make a copy of the reader here mReader.Init(aReader); @@ -31,12 +31,12 @@ CHIP_ERROR SubscribeResponse::Parser::Init(const chip::TLV::TLVReader & aReader) } #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR SubscribeResponse::Parser::CheckSchemaValidity() const +CHIP_ERROR SubscribeResponseMessage::Parser::CheckSchemaValidity() const { CHIP_ERROR err = CHIP_NO_ERROR; uint16_t TagPresenceMask = 0; chip::TLV::TLVReader reader; - PRETTY_PRINT("SubscribeResponse ="); + PRETTY_PRINT("SubscribeResponseMessage ="); PRETTY_PRINT("{"); // make a copy of the reader @@ -105,27 +105,27 @@ CHIP_ERROR SubscribeResponse::Parser::CheckSchemaValidity() const } #endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR SubscribeResponse::Parser::GetSubscriptionId(uint64_t * const apSubscribeId) const +CHIP_ERROR SubscribeResponseMessage::Parser::GetSubscriptionId(uint64_t * const apSubscribeId) const { return GetUnsignedInteger(kCsTag_SubscriptionId, apSubscribeId); } -CHIP_ERROR SubscribeResponse::Parser::GetMinIntervalFloorSeconds(uint16_t * const apMinIntervalFloorSeconds) const +CHIP_ERROR SubscribeResponseMessage::Parser::GetMinIntervalFloorSeconds(uint16_t * const apMinIntervalFloorSeconds) const { return GetUnsignedInteger(kCsTag_MinIntervalFloorSeconds, apMinIntervalFloorSeconds); } -CHIP_ERROR SubscribeResponse::Parser::GetMaxIntervalCeilingSeconds(uint16_t * const apMaxIntervalCeilingSeconds) const +CHIP_ERROR SubscribeResponseMessage::Parser::GetMaxIntervalCeilingSeconds(uint16_t * const apMaxIntervalCeilingSeconds) const { return GetUnsignedInteger(kCsTag_MaxIntervalCeilingSeconds, apMaxIntervalCeilingSeconds); } -CHIP_ERROR SubscribeResponse::Builder::Init(chip::TLV::TLVWriter * const apWriter) +CHIP_ERROR SubscribeResponseMessage::Builder::Init(chip::TLV::TLVWriter * const apWriter) { return InitAnonymousStructure(apWriter); } -SubscribeResponse::Builder & SubscribeResponse::Builder::SubscriptionId(const uint64_t aSubscribeId) +SubscribeResponseMessage::Builder & SubscribeResponseMessage::Builder::SubscriptionId(const uint64_t aSubscribeId) { if (mError == CHIP_NO_ERROR) { @@ -134,7 +134,8 @@ SubscribeResponse::Builder & SubscribeResponse::Builder::SubscriptionId(const ui return *this; } -SubscribeResponse::Builder & SubscribeResponse::Builder::MinIntervalFloorSeconds(const uint16_t aMinIntervalFloorSeconds) +SubscribeResponseMessage::Builder & +SubscribeResponseMessage::Builder::MinIntervalFloorSeconds(const uint16_t aMinIntervalFloorSeconds) { if (mError == CHIP_NO_ERROR) { @@ -143,7 +144,8 @@ SubscribeResponse::Builder & SubscribeResponse::Builder::MinIntervalFloorSeconds return *this; } -SubscribeResponse::Builder & SubscribeResponse::Builder::MaxIntervalCeilingSeconds(const uint16_t aMaxIntervalCeilingSeconds) +SubscribeResponseMessage::Builder & +SubscribeResponseMessage::Builder::MaxIntervalCeilingSeconds(const uint16_t aMaxIntervalCeilingSeconds) { if (mError == CHIP_NO_ERROR) { @@ -152,7 +154,7 @@ SubscribeResponse::Builder & SubscribeResponse::Builder::MaxIntervalCeilingSecon return *this; } -SubscribeResponse::Builder & SubscribeResponse::Builder::EndOfSubscribeResponse() +SubscribeResponseMessage::Builder & SubscribeResponseMessage::Builder::EndOfSubscribeResponseMessage() { EndOfContainer(); return *this; diff --git a/src/app/MessageDef/SubscribeResponse.h b/src/app/MessageDef/SubscribeResponseMessage.h similarity index 86% rename from src/app/MessageDef/SubscribeResponse.h rename to src/app/MessageDef/SubscribeResponseMessage.h index 2845ef144b7258..e87f24a60ce468 100644 --- a/src/app/MessageDef/SubscribeResponse.h +++ b/src/app/MessageDef/SubscribeResponseMessage.h @@ -28,7 +28,7 @@ namespace chip { namespace app { -namespace SubscribeResponse { +namespace SubscribeResponseMessage { enum { kCsTag_SubscriptionId = 0, @@ -91,23 +91,23 @@ class Builder : public chip::app::Builder /** * @brief final subscription Id for the subscription back to the client.s. */ - SubscribeResponse::Builder & SubscriptionId(const uint64_t SubscriptionId); + SubscribeResponseMessage::Builder & SubscriptionId(const uint64_t SubscriptionId); /** * @brief Final Min Interval for the subscription back to the clients. */ - SubscribeResponse::Builder & MinIntervalFloorSeconds(const uint16_t aMinIntervalFloorSeconds); + SubscribeResponseMessage::Builder & MinIntervalFloorSeconds(const uint16_t aMinIntervalFloorSeconds); /** * @brief Final Max Interval for the subscription back to the clients. */ - SubscribeResponse::Builder & MaxIntervalCeilingSeconds(const uint16_t aMaxIntervalCeilingSeconds); + SubscribeResponseMessage::Builder & MaxIntervalCeilingSeconds(const uint16_t aMaxIntervalCeilingSeconds); /** - * @brief Mark the end of this SubscribeResponse + * @brief Mark the end of this SubscribeResponseMessage */ - SubscribeResponse::Builder & EndOfSubscribeResponse(); + SubscribeResponseMessage::Builder & EndOfSubscribeResponseMessage(); }; -} // namespace SubscribeResponse +} // namespace SubscribeResponseMessage } // namespace app } // namespace chip diff --git a/src/app/MessageDef/WriteRequest.cpp b/src/app/MessageDef/WriteRequestMessage.cpp similarity index 82% rename from src/app/MessageDef/WriteRequest.cpp rename to src/app/MessageDef/WriteRequestMessage.cpp index 9c57bb7e8aeed5..487ead32ec471f 100644 --- a/src/app/MessageDef/WriteRequest.cpp +++ b/src/app/MessageDef/WriteRequestMessage.cpp @@ -15,11 +15,11 @@ */ /** * @file - * This file defines WriteRequest parser and builder in CHIP interaction model + * This file defines WriteRequestMessage parser and builder in CHIP interaction model * */ -#include "WriteRequest.h" +#include "WriteRequestMessage.h" #include "MessageDefHelper.h" #include @@ -33,7 +33,7 @@ using namespace chip::TLV; namespace chip { namespace app { -CHIP_ERROR WriteRequest::Parser::Init(const chip::TLV::TLVReader & aReader) +CHIP_ERROR WriteRequestMessage::Parser::Init(const chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -49,14 +49,14 @@ CHIP_ERROR WriteRequest::Parser::Init(const chip::TLV::TLVReader & aReader) } #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR WriteRequest::Parser::CheckSchemaValidity() const +CHIP_ERROR WriteRequestMessage::Parser::CheckSchemaValidity() const { CHIP_ERROR err = CHIP_NO_ERROR; uint16_t TagPresenceMask = 0; chip::TLV::TLVReader reader; AttributeDataList::Parser attributeDataList; AttributeDataVersionList::Parser attributeDataVersionList; - PRETTY_PRINT("WriteRequest ="); + PRETTY_PRINT("WriteRequestMessage ="); PRETTY_PRINT("{"); // make a copy of the reader @@ -141,12 +141,12 @@ CHIP_ERROR WriteRequest::Parser::CheckSchemaValidity() const } #endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR WriteRequest::Parser::GetSuppressResponse(bool * const apSuppressResponse) const +CHIP_ERROR WriteRequestMessage::Parser::GetSuppressResponse(bool * const apSuppressResponse) const { return GetSimpleValue(kCsTag_SuppressResponse, chip::TLV::kTLVType_Boolean, apSuppressResponse); } -CHIP_ERROR WriteRequest::Parser::GetAttributeDataList(AttributeDataList::Parser * const apAttributeDataList) const +CHIP_ERROR WriteRequestMessage::Parser::GetAttributeDataList(AttributeDataList::Parser * const apAttributeDataList) const { CHIP_ERROR err = CHIP_NO_ERROR; chip::TLV::TLVReader reader; @@ -166,7 +166,7 @@ CHIP_ERROR WriteRequest::Parser::GetAttributeDataList(AttributeDataList::Parser } CHIP_ERROR -WriteRequest::Parser::GetAttributeDataVersionList(AttributeDataVersionList::Parser * const apAttributeDataVersionList) const +WriteRequestMessage::Parser::GetAttributeDataVersionList(AttributeDataVersionList::Parser * const apAttributeDataVersionList) const { CHIP_ERROR err = CHIP_NO_ERROR; chip::TLV::TLVReader reader; @@ -185,17 +185,17 @@ WriteRequest::Parser::GetAttributeDataVersionList(AttributeDataVersionList::Pars return err; } -CHIP_ERROR WriteRequest::Parser::GetMoreChunkedMessages(bool * const apMoreChunkedMessages) const +CHIP_ERROR WriteRequestMessage::Parser::GetMoreChunkedMessages(bool * const apMoreChunkedMessages) const { return GetSimpleValue(kCsTag_MoreChunkedMessages, chip::TLV::kTLVType_Boolean, apMoreChunkedMessages); } -CHIP_ERROR WriteRequest::Builder::Init(chip::TLV::TLVWriter * const apWriter) +CHIP_ERROR WriteRequestMessage::Builder::Init(chip::TLV::TLVWriter * const apWriter) { return InitAnonymousStructure(apWriter); } -WriteRequest::Builder & WriteRequest::Builder::SuppressResponse(const bool aSuppressResponse) +WriteRequestMessage::Builder & WriteRequestMessage::Builder::SuppressResponse(const bool aSuppressResponse) { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -205,7 +205,7 @@ WriteRequest::Builder & WriteRequest::Builder::SuppressResponse(const bool aSupp return *this; } -AttributeDataList::Builder & WriteRequest::Builder::CreateAttributeDataListBuilder() +AttributeDataList::Builder & WriteRequestMessage::Builder::CreateAttributeDataListBuilder() { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -220,7 +220,7 @@ AttributeDataList::Builder & WriteRequest::Builder::CreateAttributeDataListBuild return mAttributeDataListBuilder; } -AttributeDataVersionList::Builder & WriteRequest::Builder::CreateAttributeDataVersionListBuilder() +AttributeDataVersionList::Builder & WriteRequestMessage::Builder::CreateAttributeDataVersionListBuilder() { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -234,7 +234,7 @@ AttributeDataVersionList::Builder & WriteRequest::Builder::CreateAttributeDataVe return mAttributeDataVersionListBuilder; } -WriteRequest::Builder & WriteRequest::Builder::MoreChunkedMessages(const bool aMoreChunkedMessages) +WriteRequestMessage::Builder & WriteRequestMessage::Builder::MoreChunkedMessages(const bool aMoreChunkedMessages) { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -244,12 +244,12 @@ WriteRequest::Builder & WriteRequest::Builder::MoreChunkedMessages(const bool aM return *this; } -AttributeDataList::Builder & WriteRequest::Builder::GetAttributeDataListBuilder() +AttributeDataList::Builder & WriteRequestMessage::Builder::GetAttributeDataListBuilder() { return mAttributeDataListBuilder; } -WriteRequest::Builder & WriteRequest::Builder::EndOfWriteRequest() +WriteRequestMessage::Builder & WriteRequestMessage::Builder::EndOfWriteRequestMessage() { EndOfContainer(); return *this; diff --git a/src/app/MessageDef/WriteRequest.h b/src/app/MessageDef/WriteRequestMessage.h similarity index 90% rename from src/app/MessageDef/WriteRequest.h rename to src/app/MessageDef/WriteRequestMessage.h index 44ce0adc99815d..273d932ae461bf 100644 --- a/src/app/MessageDef/WriteRequest.h +++ b/src/app/MessageDef/WriteRequestMessage.h @@ -16,7 +16,7 @@ */ /** * @file - * This file defines WriteRequest parser and builder in CHIP interaction model + * This file defines WriteRequestMessage parser and builder in CHIP interaction model * */ @@ -34,7 +34,7 @@ namespace chip { namespace app { -namespace WriteRequest { +namespace WriteRequestMessage { enum { kCsTag_SuppressResponse = 0, @@ -113,7 +113,7 @@ class Builder : public chip::app::Builder { public: /** - * @brief Initialize a WriteRequest::Builder for writing into a TLV stream + * @brief Initialize a WriteRequestMessage::Builder for writing into a TLV stream * * @param [in] apWriter A pointer to TLVWriter * @@ -126,7 +126,7 @@ class Builder : public chip::app::Builder * @param [in] aSuppressResponse true if client need to signal suppress response * @return A reference to *this */ - WriteRequest::Builder & SuppressResponse(const bool aSuppressResponse); + WriteRequestMessage::Builder & SuppressResponse(const bool aSuppressResponse); /** * @brief Initialize a AttributeDataList::Builder for writing into the TLV stream @@ -147,21 +147,21 @@ class Builder : public chip::app::Builder * @param [in] aMoreChunkedMessages true if more chunked messaged is needed * @return A reference to *this */ - WriteRequest::Builder & MoreChunkedMessages(const bool aMoreChunkedMessages); + WriteRequestMessage::Builder & MoreChunkedMessages(const bool aMoreChunkedMessages); AttributeDataList::Builder & GetAttributeDataListBuilder(); /** - * @brief Mark the end of this WriteRequest + * @brief Mark the end of this WriteRequestMessage * * @return A reference to *this */ - WriteRequest::Builder & EndOfWriteRequest(); + WriteRequestMessage::Builder & EndOfWriteRequestMessage(); private: AttributeDataList::Builder mAttributeDataListBuilder; AttributeDataVersionList::Builder mAttributeDataVersionListBuilder; }; -}; // namespace WriteRequest +}; // namespace WriteRequestMessage }; // namespace app }; // namespace chip diff --git a/src/app/MessageDef/WriteResponse.cpp b/src/app/MessageDef/WriteResponseMessage.cpp similarity index 81% rename from src/app/MessageDef/WriteResponse.cpp rename to src/app/MessageDef/WriteResponseMessage.cpp index 6044361a531419..12cc547e23b43f 100644 --- a/src/app/MessageDef/WriteResponse.cpp +++ b/src/app/MessageDef/WriteResponseMessage.cpp @@ -15,11 +15,11 @@ */ /** * @file - * This file defines WriteResponse parser and builder in CHIP interaction model + * This file defines WriteResponseMessage parser and builder in CHIP interaction model * */ -#include "WriteResponse.h" +#include "WriteResponseMessage.h" #include "MessageDefHelper.h" #include @@ -33,7 +33,7 @@ using namespace chip::TLV; namespace chip { namespace app { -CHIP_ERROR WriteResponse::Parser::Init(const chip::TLV::TLVReader & aReader) +CHIP_ERROR WriteResponseMessage::Parser::Init(const chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -50,13 +50,13 @@ CHIP_ERROR WriteResponse::Parser::Init(const chip::TLV::TLVReader & aReader) } #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR WriteResponse::Parser::CheckSchemaValidity() const +CHIP_ERROR WriteResponseMessage::Parser::CheckSchemaValidity() const { CHIP_ERROR err = CHIP_NO_ERROR; uint16_t TagPresenceMask = 0; chip::TLV::TLVReader reader; AttributeStatusList::Parser attributeStatusList; - PRETTY_PRINT("WriteResponse ="); + PRETTY_PRINT("WriteResponseMessage ="); PRETTY_PRINT("{"); // make a copy of the reader @@ -103,7 +103,7 @@ CHIP_ERROR WriteResponse::Parser::CheckSchemaValidity() const } #endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK -CHIP_ERROR WriteResponse::Parser::GetAttributeStatusList(AttributeStatusList::Parser * const apAttributeStatusList) const +CHIP_ERROR WriteResponseMessage::Parser::GetAttributeStatusList(AttributeStatusList::Parser * const apAttributeStatusList) const { CHIP_ERROR err = CHIP_NO_ERROR; chip::TLV::TLVReader reader; @@ -122,12 +122,12 @@ CHIP_ERROR WriteResponse::Parser::GetAttributeStatusList(AttributeStatusList::Pa return err; } -CHIP_ERROR WriteResponse::Builder::Init(chip::TLV::TLVWriter * const apWriter) +CHIP_ERROR WriteResponseMessage::Builder::Init(chip::TLV::TLVWriter * const apWriter) { return InitAnonymousStructure(apWriter); } -AttributeStatusList::Builder & WriteResponse::Builder::CreateAttributeStatusListBuilder() +AttributeStatusList::Builder & WriteResponseMessage::Builder::CreateAttributeStatusListBuilder() { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -142,12 +142,12 @@ AttributeStatusList::Builder & WriteResponse::Builder::CreateAttributeStatusList return mAttributeStatusListBuilder; } -AttributeStatusList::Builder & WriteResponse::Builder::GetAttributeStatusListBuilder() +AttributeStatusList::Builder & WriteResponseMessage::Builder::GetAttributeStatusListBuilder() { return mAttributeStatusListBuilder; } -WriteResponse::Builder & WriteResponse::Builder::EndOfWriteResponse() +WriteResponseMessage::Builder & WriteResponseMessage::Builder::EndOfWriteResponseMessage() { EndOfContainer(); return *this; diff --git a/src/app/MessageDef/WriteResponse.h b/src/app/MessageDef/WriteResponseMessage.h similarity index 89% rename from src/app/MessageDef/WriteResponse.h rename to src/app/MessageDef/WriteResponseMessage.h index 051c3529b500d7..fe41902ff356b3 100644 --- a/src/app/MessageDef/WriteResponse.h +++ b/src/app/MessageDef/WriteResponseMessage.h @@ -16,7 +16,7 @@ */ /** * @file - * This file defines WriteResponse parser and builder in CHIP interaction model + * This file defines WriteResponseMessage parser and builder in CHIP interaction model * */ @@ -34,7 +34,7 @@ namespace chip { namespace app { -namespace WriteResponse { +namespace WriteResponseMessage { enum { kCsTag_AttributeStatusList = 0, @@ -80,7 +80,7 @@ class Builder : public chip::app::Builder { public: /** - * @brief Initialize a WriteResponse::Builder for writing into a TLV stream + * @brief Initialize a WriteResponseMessage::Builder for writing into a TLV stream * * @param [in] apWriter A pointer to TLVWriter * @@ -103,15 +103,15 @@ class Builder : public chip::app::Builder AttributeStatusList::Builder & GetAttributeStatusListBuilder(); /** - * @brief Mark the end of this WriteResponse + * @brief Mark the end of this WriteResponseMessage * * @return A reference to *this */ - WriteResponse::Builder & EndOfWriteResponse(); + WriteResponseMessage::Builder & EndOfWriteResponseMessage(); private: AttributeStatusList::Builder mAttributeStatusListBuilder; }; -}; // namespace WriteResponse +}; // namespace WriteResponseMessage }; // namespace app }; // namespace chip diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index 7182a98d431a9f..67fb6b783c87c9 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -125,7 +125,7 @@ CHIP_ERROR ReadClient::SendReadRequest(ReadPrepareParams & aReadPrepareParams) { System::PacketBufferTLVWriter writer; - ReadRequest::Builder request; + ReadRequestMessage::Builder request; msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); VerifyOrExit(!msgBuf.IsNull(), err = CHIP_ERROR_NO_MEMORY); @@ -158,7 +158,7 @@ CHIP_ERROR ReadClient::SendReadRequest(ReadPrepareParams & aReadPrepareParams) SuccessOrExit(err); } - request.EndOfReadRequest(); + request.EndOfReadRequestMessage(); SuccessOrExit(err = request.GetError()); err = writer.Finalize(&msgBuf); @@ -197,7 +197,7 @@ CHIP_ERROR ReadClient::SendStatusResponse(CHIP_ERROR aError) System::PacketBufferTLVWriter writer; writer.Init(std::move(msgBuf)); - StatusResponse::Builder response; + StatusResponseMessage::Builder response; ReturnLogErrorOnFailure(response.Init(&writer)); Status statusCode = Status::Success; if (aError != CHIP_NO_ERROR) @@ -337,7 +337,7 @@ CHIP_ERROR ReadClient::OnUnsolicitedReportData(Messaging::ExchangeContext * apEx CHIP_ERROR ReadClient::ProcessReportData(System::PacketBufferHandle && aPayload) { CHIP_ERROR err = CHIP_NO_ERROR; - ReportData::Parser report; + ReportDataMessage::Parser report; bool isEventListPresent = false; bool isAttributeDataListPresent = false; @@ -571,7 +571,7 @@ CHIP_ERROR ReadClient::ProcessSubscribeResponse(System::PacketBufferHandle && aP reader.Init(std::move(aPayload)); ReturnLogErrorOnFailure(reader.Next()); - SubscribeResponse::Parser subscribeResponse; + SubscribeResponseMessage::Parser subscribeResponse; ReturnLogErrorOnFailure(subscribeResponse.Init(reader)); #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK @@ -599,7 +599,7 @@ CHIP_ERROR ReadClient::SendSubscribeRequest(ReadPrepareParams & aReadPreparePara CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferHandle msgBuf; System::PacketBufferTLVWriter writer; - SubscribeRequest::Builder request; + SubscribeRequestMessage::Builder request; VerifyOrExit(ClientState::Initialized == mState, err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mpExchangeCtx == nullptr, err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mpCallback != nullptr, err = CHIP_ERROR_INCORRECT_STATE); @@ -638,7 +638,7 @@ CHIP_ERROR ReadClient::SendSubscribeRequest(ReadPrepareParams & aReadPreparePara request.MinIntervalSeconds(aReadPrepareParams.mMinIntervalFloorSeconds) .MaxIntervalSeconds(aReadPrepareParams.mMaxIntervalCeilingSeconds) .KeepSubscriptions(aReadPrepareParams.mKeepSubscriptions) - .EndOfSubscribeRequest(); + .EndOfSubscribeRequestMessage(); SuccessOrExit(err = request.GetError()); err = writer.Finalize(&msgBuf); diff --git a/src/app/ReadClient.h b/src/app/ReadClient.h index 31d0583f2b578e..f019fcf762497b 100644 --- a/src/app/ReadClient.h +++ b/src/app/ReadClient.h @@ -27,10 +27,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/src/app/ReadHandler.cpp b/src/app/ReadHandler.cpp index 9a2ff896c84ef7..a1589a6fa1450e 100644 --- a/src/app/ReadHandler.cpp +++ b/src/app/ReadHandler.cpp @@ -25,9 +25,10 @@ #include #include #include -#include -#include -#include +#include +#include +#include + #include #include @@ -134,7 +135,7 @@ CHIP_ERROR ReadHandler::OnStatusResponse(Messaging::ExchangeContext * apExchange { CHIP_ERROR err = CHIP_NO_ERROR; Protocols::InteractionModel::Status statusCode; - StatusResponse::Parser response; + StatusResponseMessage::Parser response; System::PacketBufferTLVReader reader; reader.Init(std::move(aPayload)); reader.Next(); @@ -255,8 +256,9 @@ CHIP_ERROR ReadHandler::ProcessReadRequest(System::PacketBufferHandle && aPayloa CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferTLVReader reader; - ReadRequest::Parser readRequestParser; + ReadRequestMessage::Parser readRequestParser; EventPaths::Parser eventPathListParser; + AttributePathList::Parser attributePathListParser; reader.Init(std::move(aPayload)); @@ -497,12 +499,12 @@ CHIP_ERROR ReadHandler::SendSubscribeResponse() System::PacketBufferTLVWriter writer; writer.Init(std::move(packet)); - SubscribeResponse::Builder response; + SubscribeResponseMessage::Builder response; ReturnLogErrorOnFailure(response.Init(&writer)); response.SubscriptionId(mSubscriptionId) .MinIntervalFloorSeconds(mMinIntervalFloorSeconds) .MaxIntervalCeilingSeconds(mMaxIntervalCeilingSeconds) - .EndOfSubscribeResponse(); + .EndOfSubscribeResponseMessage(); ReturnLogErrorOnFailure(response.GetError()); ReturnLogErrorOnFailure(writer.Finalize(&packet)); @@ -524,7 +526,7 @@ CHIP_ERROR ReadHandler::ProcessSubscribeRequest(System::PacketBufferHandle && aP reader.Init(std::move(aPayload)); ReturnLogErrorOnFailure(reader.Next()); - SubscribeRequest::Parser subscribeRequestParser; + SubscribeRequestMessage::Parser subscribeRequestParser; ReturnLogErrorOnFailure(subscribeRequestParser.Init(reader)); #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK ReturnLogErrorOnFailure(subscribeRequestParser.CheckSchemaValidity()); diff --git a/src/app/WriteClient.cpp b/src/app/WriteClient.cpp index 2735bd1be5d174..ad18fa9399baa9 100644 --- a/src/app/WriteClient.cpp +++ b/src/app/WriteClient.cpp @@ -91,7 +91,7 @@ CHIP_ERROR WriteClient::ProcessWriteResponseMessage(System::PacketBufferHandle & CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferTLVReader reader; TLV::TLVReader attributeStatusListReader; - WriteResponse::Parser writeResponse; + WriteResponseMessage::Parser writeResponse; AttributeStatusList::Parser attributeStatusListParser; reader.Init(std::move(payload)); @@ -199,7 +199,7 @@ CHIP_ERROR WriteClient::FinalizeMessage(System::PacketBufferHandle & aPacket) err = attributeDataListBuilder.GetError(); SuccessOrExit(err); - mWriteRequestBuilder.EndOfWriteRequest(); + mWriteRequestBuilder.EndOfWriteRequestMessage(); err = mWriteRequestBuilder.GetError(); SuccessOrExit(err); diff --git a/src/app/WriteClient.h b/src/app/WriteClient.h index 13435aa538d0bc..ecdba66a764630 100644 --- a/src/app/WriteClient.h +++ b/src/app/WriteClient.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -190,7 +190,7 @@ class WriteClient : public Messaging::ExchangeDelegate Callback * mpCallback = nullptr; State mState = State::Uninitialized; System::PacketBufferTLVWriter mMessageWriter; - WriteRequest::Builder mWriteRequestBuilder; + WriteRequestMessage::Builder mWriteRequestBuilder; uint8_t mAttributeStatusIndex = 0; }; diff --git a/src/app/WriteHandler.cpp b/src/app/WriteHandler.cpp index d700336e85853b..34ae2281de3997 100644 --- a/src/app/WriteHandler.cpp +++ b/src/app/WriteHandler.cpp @@ -75,7 +75,7 @@ CHIP_ERROR WriteHandler::FinalizeMessage(System::PacketBufferHandle & packet) err = attributeStatusList.GetError(); SuccessOrExit(err); - mWriteResponseBuilder.EndOfWriteResponse(); + mWriteResponseBuilder.EndOfWriteResponseMessage(); err = mWriteResponseBuilder.GetError(); SuccessOrExit(err); @@ -169,7 +169,7 @@ CHIP_ERROR WriteHandler::ProcessWriteRequest(System::PacketBufferHandle && aPayl CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferTLVReader reader; - WriteRequest::Parser writeRequestParser; + WriteRequestMessage::Parser writeRequestParser; AttributeDataList::Parser attributeDataListParser; TLV::TLVReader attributeDataListReader; bool needSuppressResponse = false; diff --git a/src/app/WriteHandler.h b/src/app/WriteHandler.h index 628333d80880a2..1fd75b6171b94b 100644 --- a/src/app/WriteHandler.h +++ b/src/app/WriteHandler.h @@ -19,7 +19,7 @@ #pragma once #include #include -#include +#include #include #include #include @@ -107,7 +107,7 @@ class WriteHandler void Shutdown(); Messaging::ExchangeContext * mpExchangeCtx = nullptr; - WriteResponse::Builder mWriteResponseBuilder; + WriteResponseMessage::Builder mWriteResponseBuilder; System::PacketBufferTLVWriter mMessageWriter; State mState = State::Uninitialized; }; diff --git a/src/app/reporting/Engine.cpp b/src/app/reporting/Engine.cpp index 996ceadbdd57e0..638b980dd52cbb 100644 --- a/src/app/reporting/Engine.cpp +++ b/src/app/reporting/Engine.cpp @@ -96,7 +96,8 @@ Engine::RetrieveClusterData(FabricIndex aAccessingFabricIndex, AttributeDataList return err; } -CHIP_ERROR Engine::BuildSingleReportDataAttributeDataList(ReportData::Builder & aReportDataBuilder, ReadHandler * apReadHandler) +CHIP_ERROR Engine::BuildSingleReportDataAttributeDataList(ReportDataMessage::Builder & aReportDataBuilder, + ReadHandler * apReadHandler) { CHIP_ERROR err = CHIP_NO_ERROR; bool attributeClean = true; @@ -150,7 +151,7 @@ CHIP_ERROR Engine::BuildSingleReportDataAttributeDataList(ReportData::Builder & return err; } -CHIP_ERROR Engine::BuildSingleReportDataEventList(ReportData::Builder & aReportDataBuilder, ReadHandler * apReadHandler) +CHIP_ERROR Engine::BuildSingleReportDataEventList(ReportDataMessage::Builder & aReportDataBuilder, ReadHandler * apReadHandler) { CHIP_ERROR err = CHIP_NO_ERROR; size_t eventCount = 0; @@ -257,7 +258,7 @@ CHIP_ERROR Engine::BuildAndSendSingleReportData(ReadHandler * apReadHandler) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter reportDataWriter; - ReportData::Builder reportDataBuilder; + ReportDataMessage::Builder reportDataBuilder; chip::System::PacketBufferHandle bufHandle = System::PacketBufferHandle::New(chip::app::kMaxSecureSduLengthBytes); VerifyOrExit(!bufHandle.IsNull(), err = CHIP_ERROR_NO_MEMORY); @@ -288,7 +289,7 @@ CHIP_ERROR Engine::BuildAndSendSingleReportData(ReadHandler * apReadHandler) reportDataBuilder.MoreChunkedMessages(mMoreChunkedMessages); } - reportDataBuilder.EndOfReportData(); + reportDataBuilder.EndOfReportDataMessage(); SuccessOrExit(err = reportDataBuilder.GetError()); err = reportDataWriter.Finalize(&bufHandle); @@ -298,7 +299,7 @@ CHIP_ERROR Engine::BuildAndSendSingleReportData(ReadHandler * apReadHandler) { ChipLogDetail(DataManagement, " Dumping report data..."); chip::System::PacketBufferTLVReader reader; - ReportData::Parser report; + ReportDataMessage::Parser report; reader.Init(bufHandle.Retain()); reader.Next(); diff --git a/src/app/reporting/Engine.h b/src/app/reporting/Engine.h index 4161707a4efdaf..69ec6d7e04249d 100644 --- a/src/app/reporting/Engine.h +++ b/src/app/reporting/Engine.h @@ -24,7 +24,7 @@ #pragma once -#include +#include #include #include #include @@ -92,8 +92,8 @@ class Engine */ CHIP_ERROR BuildAndSendSingleReportData(ReadHandler * apReadHandler); - CHIP_ERROR BuildSingleReportDataAttributeDataList(ReportData::Builder & reportDataBuilder, ReadHandler * apReadHandler); - CHIP_ERROR BuildSingleReportDataEventList(ReportData::Builder & reportDataBuilder, ReadHandler * apReadHandler); + CHIP_ERROR BuildSingleReportDataAttributeDataList(ReportDataMessage::Builder & reportDataBuilder, ReadHandler * apReadHandler); + CHIP_ERROR BuildSingleReportDataEventList(ReportDataMessage::Builder & reportDataBuilder, ReadHandler * apReadHandler); CHIP_ERROR RetrieveClusterData(FabricIndex aAccessingFabricIndex, AttributeDataList::Builder & aAttributeDataList, ClusterInfo & aClusterInfo); EventNumber CountEvents(ReadHandler * apReadHandler, EventNumber * apInitialEvents); diff --git a/src/app/tests/BUILD.gn b/src/app/tests/BUILD.gn index 6367de8c153fd2..4d88360a527865 100644 --- a/src/app/tests/BUILD.gn +++ b/src/app/tests/BUILD.gn @@ -51,7 +51,7 @@ chip_test_suite("tests") { "TestEventPathParams.cpp", "TestInteractionModelEngine.cpp", "TestMessageDef.cpp", - "TestStatusResponse.cpp", + "TestStatusResponseMessage.cpp", ] if (chip_device_platform != "efr32") { diff --git a/src/app/tests/TestMessageDef.cpp b/src/app/tests/TestMessageDef.cpp index 20d779c37ac81d..bd160f8f0db238 100644 --- a/src/app/tests/TestMessageDef.cpp +++ b/src/app/tests/TestMessageDef.cpp @@ -27,13 +27,13 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include -#include +#include +#include #include #include #include @@ -697,10 +697,10 @@ void ParseCommandList(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) #endif } -void BuildReportData(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildReportDataMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; - ReportData::Builder reportDataBuilder; + ReportDataMessage::Builder reportDataBuilder; err = reportDataBuilder.Init(&aWriter); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -719,14 +719,14 @@ void BuildReportData(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) reportDataBuilder.MoreChunkedMessages(true); NL_TEST_ASSERT(apSuite, reportDataBuilder.GetError() == CHIP_NO_ERROR); - reportDataBuilder.EndOfReportData(); + reportDataBuilder.EndOfReportDataMessage(); NL_TEST_ASSERT(apSuite, reportDataBuilder.GetError() == CHIP_NO_ERROR); } -void ParseReportData(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseReportDataMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; - ReportData::Parser reportDataParser; + ReportDataMessage::Parser reportDataParser; bool suppressResponse = false; uint64_t subscriptionId = 0; @@ -789,10 +789,10 @@ void ParseInvokeCommand(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); } -void BuildReadRequest(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildReadRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; - ReadRequest::Builder readRequestBuilder; + ReadRequestMessage::Builder readRequestBuilder; err = readRequestBuilder.Init(&aWriter); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -812,15 +812,15 @@ void BuildReadRequest(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) readRequestBuilder.EventNumber(1); NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); - readRequestBuilder.EndOfReadRequest(); + readRequestBuilder.EndOfReadRequestMessage(); NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); } -void ParseReadRequest(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseReadRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; - ReadRequest::Parser readRequestParser; + ReadRequestMessage::Parser readRequestParser; AttributePathList::Parser attributePathListParser; EventPaths::Parser eventPathListParser; AttributeDataVersionList::Parser attributeDataVersionListParser; @@ -845,10 +845,10 @@ void ParseReadRequest(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) NL_TEST_ASSERT(apSuite, eventNumber == 1 && err == CHIP_NO_ERROR); } -void BuildWriteRequest(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildWriteRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; - WriteRequest::Builder writeRequestBuilder; + WriteRequestMessage::Builder writeRequestBuilder; err = writeRequestBuilder.Init(&aWriter); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -867,15 +867,15 @@ void BuildWriteRequest(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) writeRequestBuilder.MoreChunkedMessages(true); NL_TEST_ASSERT(apSuite, writeRequestBuilder.GetError() == CHIP_NO_ERROR); - writeRequestBuilder.EndOfWriteRequest(); + writeRequestBuilder.EndOfWriteRequestMessage(); NL_TEST_ASSERT(apSuite, writeRequestBuilder.GetError() == CHIP_NO_ERROR); } -void ParseWriteRequest(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseWriteRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; - WriteRequest::Parser writeRequestParser; + WriteRequestMessage::Parser writeRequestParser; bool suppressResponse = false; AttributeDataList::Parser attributeDataList; AttributeDataVersionList::Parser attributeDataVersionList; @@ -900,10 +900,10 @@ void ParseWriteRequest(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && moreChunkedMessages); } -void BuildWriteResponse(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildWriteResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; - WriteResponse::Builder writeResponseBuilder; + WriteResponseMessage::Builder writeResponseBuilder; err = writeResponseBuilder.Init(&aWriter); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -912,15 +912,15 @@ void BuildWriteResponse(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) NL_TEST_ASSERT(apSuite, writeResponseBuilder.GetError() == CHIP_NO_ERROR); BuildAttributeStatusList(apSuite, attributeStatusList); - writeResponseBuilder.EndOfWriteResponse(); + writeResponseBuilder.EndOfWriteResponseMessage(); NL_TEST_ASSERT(apSuite, writeResponseBuilder.GetError() == CHIP_NO_ERROR); } -void ParseWriteResponse(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseWriteResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; - WriteResponse::Parser writeResponseParser; + WriteResponseMessage::Parser writeResponseParser; AttributeStatusList::Parser attributeStatusListParser; err = writeResponseParser.Init(aReader); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -932,10 +932,10 @@ void ParseWriteResponse(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); } -void BuildSubscribeRequest(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildSubscribeRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; - SubscribeRequest::Builder subscribeRequestBuilder; + SubscribeRequestMessage::Builder subscribeRequestBuilder; err = subscribeRequestBuilder.Init(&aWriter); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -967,15 +967,15 @@ void BuildSubscribeRequest(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter subscribeRequestBuilder.IsProxy(true); NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); - subscribeRequestBuilder.EndOfSubscribeRequest(); + subscribeRequestBuilder.EndOfSubscribeRequestMessage(); NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); } -void ParseSubscribeRequest(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseSubscribeRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; - SubscribeRequest::Parser subscribeRequestParser; + SubscribeRequestMessage::Parser subscribeRequestParser; AttributePathList::Parser attributePathListParser; EventPaths::Parser eventPathListParser; AttributeDataVersionList::Parser attributeDataVersionListParser; @@ -1016,10 +1016,10 @@ void ParseSubscribeRequest(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader NL_TEST_ASSERT(apSuite, isProxy && err == CHIP_NO_ERROR); } -void BuildSubscribeResponse(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildSubscribeResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; - SubscribeResponse::Builder subscribeResponseBuilder; + SubscribeResponseMessage::Builder subscribeResponseBuilder; err = subscribeResponseBuilder.Init(&aWriter); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -1033,15 +1033,15 @@ void BuildSubscribeResponse(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWrite subscribeResponseBuilder.MaxIntervalCeilingSeconds(2); NL_TEST_ASSERT(apSuite, subscribeResponseBuilder.GetError() == CHIP_NO_ERROR); - subscribeResponseBuilder.EndOfSubscribeResponse(); + subscribeResponseBuilder.EndOfSubscribeResponseMessage(); NL_TEST_ASSERT(apSuite, subscribeResponseBuilder.GetError() == CHIP_NO_ERROR); } -void ParseSubscribeResponse(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseSubscribeResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; - SubscribeResponse::Parser subscribeResponseParser; + SubscribeResponseMessage::Parser subscribeResponseParser; uint64_t subscriptionId = 0; uint16_t minIntervalFloorSeconds = 0; uint16_t maxIntervalCeilingSeconds = 0; @@ -1508,13 +1508,13 @@ void CommandListTest(nlTestSuite * apSuite, void * apContext) ParseCommandList(apSuite, reader); } -void ReportDataTest(nlTestSuite * apSuite, void * apContext) +void ReportDataMessageTest(nlTestSuite * apSuite, void * apContext) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildReportData(apSuite, writer); + BuildReportDataMessage(apSuite, writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -1524,7 +1524,7 @@ void ReportDataTest(nlTestSuite * apSuite, void * apContext) reader.Init(std::move(buf)); err = reader.Next(); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseReportData(apSuite, reader); + ParseReportDataMessage(apSuite, reader); } void InvokeCommandTest(nlTestSuite * apSuite, void * apContext) @@ -1546,13 +1546,13 @@ void InvokeCommandTest(nlTestSuite * apSuite, void * apContext) ParseInvokeCommand(apSuite, reader); } -void ReadRequestTest(nlTestSuite * apSuite, void * apContext) +void ReadRequestMessageTest(nlTestSuite * apSuite, void * apContext) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildReadRequest(apSuite, writer); + BuildReadRequestMessage(apSuite, writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -1562,16 +1562,16 @@ void ReadRequestTest(nlTestSuite * apSuite, void * apContext) reader.Init(std::move(buf)); err = reader.Next(); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseReadRequest(apSuite, reader); + ParseReadRequestMessage(apSuite, reader); } -void WriteRequestTest(nlTestSuite * apSuite, void * apContext) +void WriteRequestMessageTest(nlTestSuite * apSuite, void * apContext) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildWriteRequest(apSuite, writer); + BuildWriteRequestMessage(apSuite, writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -1581,16 +1581,16 @@ void WriteRequestTest(nlTestSuite * apSuite, void * apContext) reader.Init(std::move(buf)); err = reader.Next(); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseWriteRequest(apSuite, reader); + ParseWriteRequestMessage(apSuite, reader); } -void WriteResponseTest(nlTestSuite * apSuite, void * apContext) +void WriteResponseMessageTest(nlTestSuite * apSuite, void * apContext) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildWriteResponse(apSuite, writer); + BuildWriteResponseMessage(apSuite, writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -1600,16 +1600,16 @@ void WriteResponseTest(nlTestSuite * apSuite, void * apContext) reader.Init(std::move(buf)); err = reader.Next(); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseWriteResponse(apSuite, reader); + ParseWriteResponseMessage(apSuite, reader); } -void SubscribeRequestTest(nlTestSuite * apSuite, void * apContext) +void SubscribeRequestMessageTest(nlTestSuite * apSuite, void * apContext) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildSubscribeRequest(apSuite, writer); + BuildSubscribeRequestMessage(apSuite, writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -1619,16 +1619,16 @@ void SubscribeRequestTest(nlTestSuite * apSuite, void * apContext) reader.Init(std::move(buf)); err = reader.Next(); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseSubscribeRequest(apSuite, reader); + ParseSubscribeRequestMessage(apSuite, reader); } -void SubscribeResponseTest(nlTestSuite * apSuite, void * apContext) +void SubscribeResponseMessageTest(nlTestSuite * apSuite, void * apContext) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildSubscribeResponse(apSuite, writer); + BuildSubscribeResponseMessage(apSuite, writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -1638,7 +1638,7 @@ void SubscribeResponseTest(nlTestSuite * apSuite, void * apContext) reader.Init(std::move(buf)); err = reader.Next(); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseSubscribeResponse(apSuite, reader); + ParseSubscribeResponseMessage(apSuite, reader); } void TimedRequestMessageTest(nlTestSuite * apSuite, void * apContext) @@ -1738,13 +1738,13 @@ const nlTest sTests[] = NL_TEST_DEF("CommandDataIBTest", CommandDataIBTest), NL_TEST_DEF("CommandDataIBWithStatusCodeTest", CommandDataIBWithStatusCodeTest), NL_TEST_DEF("CommandListTest", CommandListTest), - NL_TEST_DEF("ReportDataTest", ReportDataTest), + NL_TEST_DEF("ReportDataMessageTest", ReportDataMessageTest), NL_TEST_DEF("InvokeCommandTest", InvokeCommandTest), - NL_TEST_DEF("ReadRequestTest", ReadRequestTest), - NL_TEST_DEF("WriteRequestTest", WriteRequestTest), - NL_TEST_DEF("WriteResponseTest", WriteResponseTest), - NL_TEST_DEF("SubscribeRequestTest", SubscribeRequestTest), - NL_TEST_DEF("SubscribeResponseTest", SubscribeResponseTest), + NL_TEST_DEF("ReadRequestMessageTest", ReadRequestMessageTest), + NL_TEST_DEF("WriteRequestMessageTest", WriteRequestMessageTest), + NL_TEST_DEF("WriteResponseMessageTest", WriteResponseMessageTest), + NL_TEST_DEF("SubscribeRequestMessageTest", SubscribeRequestMessageTest), + NL_TEST_DEF("SubscribeResponseMessageTest", SubscribeResponseMessageTest), NL_TEST_DEF("TimedRequestMessageTest", TimedRequestMessageTest), NL_TEST_DEF("CheckPointRollbackTest", CheckPointRollbackTest), NL_TEST_SENTINEL() diff --git a/src/app/tests/TestReadInteraction.cpp b/src/app/tests/TestReadInteraction.cpp index 0dada8dfda048b..f53a58eae0cb21 100644 --- a/src/app/tests/TestReadInteraction.cpp +++ b/src/app/tests/TestReadInteraction.cpp @@ -132,7 +132,7 @@ void GenerateSubscribeResponse(nlTestSuite * apSuite, void * apContext, chip::Sy chip::System::PacketBufferTLVWriter writer; writer.Init(std::move(aPayload)); - chip::app::SubscribeResponse::Builder subscribeResponseBuilder; + chip::app::SubscribeResponseMessage::Builder subscribeResponseBuilder; err = subscribeResponseBuilder.Init(&writer); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -146,7 +146,7 @@ void GenerateSubscribeResponse(nlTestSuite * apSuite, void * apContext, chip::Sy subscribeResponseBuilder.MaxIntervalCeilingSeconds(2); NL_TEST_ASSERT(apSuite, subscribeResponseBuilder.GetError() == CHIP_NO_ERROR); - subscribeResponseBuilder.EndOfSubscribeResponse(); + subscribeResponseBuilder.EndOfSubscribeResponseMessage(); NL_TEST_ASSERT(apSuite, subscribeResponseBuilder.GetError() == CHIP_NO_ERROR); err = writer.Finalize(&aPayload); @@ -281,7 +281,7 @@ void TestReadInteraction::GenerateReportData(nlTestSuite * apSuite, void * apCon System::PacketBufferTLVWriter writer; writer.Init(std::move(aPayload)); - ReportData::Builder reportDataBuilder; + ReportDataMessage::Builder reportDataBuilder; err = reportDataBuilder.Init(&writer); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -342,7 +342,7 @@ void TestReadInteraction::GenerateReportData(nlTestSuite * apSuite, void * apCon reportDataBuilder.MoreChunkedMessages(false); NL_TEST_ASSERT(apSuite, reportDataBuilder.GetError() == CHIP_NO_ERROR); - reportDataBuilder.EndOfReportData(); + reportDataBuilder.EndOfReportDataMessage(); NL_TEST_ASSERT(apSuite, reportDataBuilder.GetError() == CHIP_NO_ERROR); err = writer.Finalize(&aPayload); @@ -378,7 +378,7 @@ void TestReadInteraction::TestReadHandler(nlTestSuite * apSuite, void * apContex System::PacketBufferTLVWriter writer; System::PacketBufferHandle reportDatabuf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); System::PacketBufferHandle readRequestbuf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); - ReadRequest::Builder readRequestBuilder; + ReadRequestMessage::Builder readRequestBuilder; MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); err = engine->Init(&ctx.GetExchangeManager(), &delegate); @@ -410,7 +410,7 @@ void TestReadInteraction::TestReadHandler(nlTestSuite * apSuite, void * apContex NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); - readRequestBuilder.EndOfReadRequest(); + readRequestBuilder.EndOfReadRequestMessage(); NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); err = writer.Finalize(&readRequestbuf); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -430,7 +430,7 @@ void TestReadInteraction::TestReadClientGenerateAttributePathList(nlTestSuite * MockInteractionModelApp delegate; System::PacketBufferHandle msgBuf; System::PacketBufferTLVWriter writer; - ReadRequest::Builder request; + ReadRequestMessage::Builder request; msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); NL_TEST_ASSERT(apSuite, !msgBuf.IsNull()); writer.Init(std::move(msgBuf)); @@ -457,7 +457,7 @@ void TestReadInteraction::TestReadClientGenerateInvalidAttributePathList(nlTestS MockInteractionModelApp delegate; System::PacketBufferHandle msgBuf; System::PacketBufferTLVWriter writer; - ReadRequest::Builder request; + ReadRequestMessage::Builder request; msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); NL_TEST_ASSERT(apSuite, !msgBuf.IsNull()); writer.Init(std::move(msgBuf)); @@ -506,7 +506,7 @@ void TestReadInteraction::TestReadHandlerInvalidAttributePath(nlTestSuite * apSu System::PacketBufferTLVWriter writer; System::PacketBufferHandle reportDatabuf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); System::PacketBufferHandle readRequestbuf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); - ReadRequest::Builder readRequestBuilder; + ReadRequestMessage::Builder readRequestBuilder; MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); @@ -535,7 +535,7 @@ void TestReadInteraction::TestReadHandlerInvalidAttributePath(nlTestSuite * apSu NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); - readRequestBuilder.EndOfReadRequest(); + readRequestBuilder.EndOfReadRequestMessage(); NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); err = writer.Finalize(&readRequestbuf); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -555,7 +555,7 @@ void TestReadInteraction::TestReadClientGenerateOneEventPaths(nlTestSuite * apSu MockInteractionModelApp delegate; System::PacketBufferHandle msgBuf; System::PacketBufferTLVWriter writer; - ReadRequest::Builder request; + ReadRequestMessage::Builder request; msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); NL_TEST_ASSERT(apSuite, !msgBuf.IsNull()); writer.Init(std::move(msgBuf)); @@ -575,14 +575,14 @@ void TestReadInteraction::TestReadClientGenerateOneEventPaths(nlTestSuite * apSu err = readClient.GenerateEventPaths(eventPathListBuilder, eventPathParams, 1 /*aEventPathParamsListSize*/); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - request.EndOfReadRequest(); + request.EndOfReadRequestMessage(); NL_TEST_ASSERT(apSuite, CHIP_NO_ERROR == request.GetError()); err = writer.Finalize(&msgBuf); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); chip::System::PacketBufferTLVReader reader; - ReadRequest::Parser readRequestParser; + ReadRequestMessage::Parser readRequestParser; reader.Init(msgBuf.Retain()); reader.Next(); @@ -604,7 +604,7 @@ void TestReadInteraction::TestReadClientGenerateTwoEventPaths(nlTestSuite * apSu MockInteractionModelApp delegate; System::PacketBufferHandle msgBuf; System::PacketBufferTLVWriter writer; - ReadRequest::Builder request; + ReadRequestMessage::Builder request; msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); NL_TEST_ASSERT(apSuite, !msgBuf.IsNull()); writer.Init(std::move(msgBuf)); @@ -629,14 +629,14 @@ void TestReadInteraction::TestReadClientGenerateTwoEventPaths(nlTestSuite * apSu err = readClient.GenerateEventPaths(eventPathListBuilder, eventPathParams, 2 /*aEventPathParamsListSize*/); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - request.EndOfReadRequest(); + request.EndOfReadRequestMessage(); NL_TEST_ASSERT(apSuite, CHIP_NO_ERROR == request.GetError()); err = writer.Finalize(&msgBuf); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); chip::System::PacketBufferTLVReader reader; - ReadRequest::Parser readRequestParser; + ReadRequestMessage::Parser readRequestParser; reader.Init(msgBuf.Retain()); reader.Next(); @@ -781,7 +781,7 @@ void TestReadInteraction::TestProcessSubscribeRequest(nlTestSuite * apSuite, voi app::ReadHandler readHandler; System::PacketBufferTLVWriter writer; System::PacketBufferHandle subscribeRequestbuf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); - SubscribeRequest::Builder subscribeRequestBuilder; + SubscribeRequestMessage::Builder subscribeRequestBuilder; MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); err = engine->Init(&ctx.GetExchangeManager(), &delegate); @@ -820,7 +820,7 @@ void TestReadInteraction::TestProcessSubscribeRequest(nlTestSuite * apSuite, voi subscribeRequestBuilder.IsProxy(true); NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); - subscribeRequestBuilder.EndOfSubscribeRequest(); + subscribeRequestBuilder.EndOfSubscribeRequestMessage(); NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); diff --git a/src/app/tests/TestReportingEngine.cpp b/src/app/tests/TestReportingEngine.cpp index 440dc20680a7b8..3498fb4095552a 100644 --- a/src/app/tests/TestReportingEngine.cpp +++ b/src/app/tests/TestReportingEngine.cpp @@ -72,7 +72,7 @@ void TestReportingEngine::TestBuildAndSendSingleReportData(nlTestSuite * apSuite app::ReadHandler readHandler; System::PacketBufferTLVWriter writer; System::PacketBufferHandle readRequestbuf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); - ReadRequest::Builder readRequestBuilder; + ReadRequestMessage::Builder readRequestBuilder; AttributePathList::Builder attributePathListBuilder; AttributePath::Builder attributePathBuilder; @@ -107,7 +107,7 @@ void TestReportingEngine::TestBuildAndSendSingleReportData(nlTestSuite * apSuite attributePathListBuilder.EndOfAttributePathList(); NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); - readRequestBuilder.EndOfReadRequest(); + readRequestBuilder.EndOfReadRequestMessage(); NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); err = writer.Finalize(&readRequestbuf); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); diff --git a/src/app/tests/TestStatusResponse.cpp b/src/app/tests/TestStatusResponseMessage.cpp similarity index 77% rename from src/app/tests/TestStatusResponse.cpp rename to src/app/tests/TestStatusResponseMessage.cpp index 51facdc1243e32..00fd5e43d3713a 100644 --- a/src/app/tests/TestStatusResponse.cpp +++ b/src/app/tests/TestStatusResponseMessage.cpp @@ -23,7 +23,7 @@ */ #include -#include +#include #include #include #include @@ -37,10 +37,10 @@ using namespace chip::app; constexpr chip::Protocols::InteractionModel::Status statusValue = chip::Protocols::InteractionModel::Status::Success; constexpr chip::Protocols::InteractionModel::Status invalidStatusValue = chip::Protocols::InteractionModel::Status::Failure; -void BuildStatusResponse(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildStatusResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; - StatusResponse::Builder statusResponse; + StatusResponseMessage::Builder statusResponse; err = statusResponse.Init(&aWriter); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); @@ -49,11 +49,11 @@ void BuildStatusResponse(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) NL_TEST_ASSERT(apSuite, statusResponse.GetError() == CHIP_NO_ERROR); } -void ParseStatusResponse(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader, bool aTestPositiveCase) +void ParseStatusResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader, bool aTestPositiveCase) { CHIP_ERROR err = CHIP_NO_ERROR; - StatusResponse::Parser statusResponse; + StatusResponseMessage::Parser statusResponse; chip::Protocols::InteractionModel::Status status; err = statusResponse.Init(aReader); @@ -74,43 +74,43 @@ void ParseStatusResponse(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader, } } -void StatusResponsePositiveTest(nlTestSuite * apSuite, void * apContext) +void StatusResponseMessagePositiveTest(nlTestSuite * apSuite, void * apContext) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildStatusResponse(apSuite, writer); + BuildStatusResponseMessage(apSuite, writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); reader.Init(std::move(buf)); err = reader.Next(); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseStatusResponse(apSuite, reader, true /*aTestPositiveCase*/); + ParseStatusResponseMessage(apSuite, reader, true /*aTestPositiveCase*/); } -void StatusResponseNegativeTest(nlTestSuite * apSuite, void * apContext) +void StatusResponseMessageNegativeTest(nlTestSuite * apSuite, void * apContext) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildStatusResponse(apSuite, writer); + BuildStatusResponseMessage(apSuite, writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); reader.Init(std::move(buf)); err = reader.Next(); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseStatusResponse(apSuite, reader, false /*aTestPositiveCase*/); + ParseStatusResponseMessage(apSuite, reader, false /*aTestPositiveCase*/); } // clang-format off const nlTest sTests[] = { - NL_TEST_DEF("StatusResponsePositiveTest", StatusResponsePositiveTest), - NL_TEST_DEF("StatusResponseNegativeTest", StatusResponseNegativeTest), + NL_TEST_DEF("StatusResponseMessagePositiveTest", StatusResponseMessagePositiveTest), + NL_TEST_DEF("StatusResponseMessageNegativeTest", StatusResponseMessageNegativeTest), NL_TEST_SENTINEL() }; // clang-format on @@ -136,12 +136,12 @@ static int TestTeardown(void * inContext) return SUCCESS; } -int TestStatusResponse() +int TestStatusResponseMessage() { // clang-format off nlTestSuite theSuite = { - "StatusResponse", + "StatusResponseMessage", &sTests[0], TestSetup, TestTeardown, @@ -153,4 +153,4 @@ int TestStatusResponse() return (nlTestRunnerStats(&theSuite)); } -CHIP_REGISTER_TEST_SUITE(TestStatusResponse) +CHIP_REGISTER_TEST_SUITE(TestStatusResponseMessage) diff --git a/src/app/tests/TestWriteInteraction.cpp b/src/app/tests/TestWriteInteraction.cpp index 46df2f2a0b09d9..b5c028f5a6b369 100644 --- a/src/app/tests/TestWriteInteraction.cpp +++ b/src/app/tests/TestWriteInteraction.cpp @@ -126,7 +126,7 @@ void TestWriteInteraction::GenerateWriteRequest(nlTestSuite * apSuite, void * ap System::PacketBufferTLVWriter writer; writer.Init(std::move(aPayload)); - WriteRequest::Builder writeRequestBuilder; + WriteRequestMessage::Builder writeRequestBuilder; err = writeRequestBuilder.Init(&writer); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); AttributeDataList::Builder attributeDataListBuilder = writeRequestBuilder.CreateAttributeDataListBuilder(); @@ -161,7 +161,7 @@ void TestWriteInteraction::GenerateWriteRequest(nlTestSuite * apSuite, void * ap attributeDataListBuilder.EndOfAttributeDataList(); NL_TEST_ASSERT(apSuite, attributeDataListBuilder.GetError() == CHIP_NO_ERROR); - writeRequestBuilder.EndOfWriteRequest(); + writeRequestBuilder.EndOfWriteRequestMessage(); NL_TEST_ASSERT(apSuite, writeRequestBuilder.GetError() == CHIP_NO_ERROR); err = writer.Finalize(&aPayload); @@ -174,7 +174,7 @@ void TestWriteInteraction::GenerateWriteResponse(nlTestSuite * apSuite, void * a System::PacketBufferTLVWriter writer; writer.Init(std::move(aPayload)); - WriteResponse::Builder writeResponseBuilder; + WriteResponseMessage::Builder writeResponseBuilder; err = writeResponseBuilder.Init(&writer); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); AttributeStatusList::Builder attributeStatusListBuilder = writeResponseBuilder.CreateAttributeStatusListBuilder(); @@ -201,7 +201,7 @@ void TestWriteInteraction::GenerateWriteResponse(nlTestSuite * apSuite, void * a attributeStatusListBuilder.EndOfAttributeStatusList(); NL_TEST_ASSERT(apSuite, attributeStatusListBuilder.GetError() == CHIP_NO_ERROR); - writeResponseBuilder.EndOfWriteResponse(); + writeResponseBuilder.EndOfWriteResponseMessage(); NL_TEST_ASSERT(apSuite, writeResponseBuilder.GetError() == CHIP_NO_ERROR); err = writer.Finalize(&aPayload); diff --git a/src/app/tests/integration/chip_im_initiator.cpp b/src/app/tests/integration/chip_im_initiator.cpp index ce03af677a29e4..8217cd08874ccd 100644 --- a/src/app/tests/integration/chip_im_initiator.cpp +++ b/src/app/tests/integration/chip_im_initiator.cpp @@ -55,9 +55,9 @@ constexpr chip::FabricIndex gFabricIndex = 0; constexpr size_t kMaxSubMessageCount = 1; constexpr uint64_t gSubMaxReport = 5; -constexpr chip::System::Clock::Timeout gSubscribeRequestTimeout = chip::System::Clock::Seconds16(1); -constexpr chip::System::Clock::Timeout gMessageInterval = chip::System::Clock::Milliseconds32(1200); -constexpr chip::System::Clock::Timeout gMessageTimeout = chip::System::Clock::Milliseconds32(1000); +constexpr chip::System::Clock::Timeout gSubscribeRequestMessageTimeout = chip::System::Clock::Seconds16(1); +constexpr chip::System::Clock::Timeout gMessageInterval = chip::System::Clock::Milliseconds32(1200); +constexpr chip::System::Clock::Timeout gMessageTimeout = chip::System::Clock::Milliseconds32(1000); chip::TransportMgr gTransportManager; chip::Inet::IPAddress gDestAddr; @@ -71,22 +71,22 @@ uint64_t gCommandCount = 0; // Count of the number of CommandResponses received. uint64_t gCommandRespCount = 0; -// Count of the number of ReadRequests sent. +// Count of the number of ReadRequestMessages sent. uint64_t gReadCount = 0; // Count of the number of ReadResponses received. uint64_t gReadRespCount = 0; -// Count of the number of WriteRequests sent. +// Count of the number of WriteRequestMessages sent. uint64_t gWriteCount = 0; -// Count of the number of WriteResponses received. +// Count of the number of WriteResponseMessages received. uint64_t gWriteRespCount = 0; -// Count of the number of SubscribeRequests sent. +// Count of the number of SubscribeRequestMessages sent. uint64_t gSubCount = 0; -// Count of the number of SubscribeResponses received. +// Count of the number of SubscribeResponseMessages received. uint64_t gSubRespCount = 0; // Count of the number of reports for subscription. @@ -556,7 +556,7 @@ void WriteRequestTimerHandler(chip::System::Layer * systemLayer, void * appState } else { - err = chip::DeviceLayer::SystemLayer().StartTimer(gSubscribeRequestTimeout, SubscribeRequestTimerHandler, NULL); + err = chip::DeviceLayer::SystemLayer().StartTimer(gSubscribeRequestMessageTimeout, SubscribeRequestTimerHandler, NULL); VerifyOrExit(err == CHIP_NO_ERROR, printf("Failed to schedule timer with error: %s\n", chip::ErrorStr(err))); }