Skip to content

Commit

Permalink
Rename some IM MessageDef name in code (project-chip#5007)
Browse files Browse the repository at this point in the history
Problems:
Need to align with IM encoding spec regarding naming

Summary of Changes
-- Rename related words following  ClusterId, DeltaUTCTimestamp, PriorityLevel, MoreChunkedMessages,SuppressResponse in spec
  • Loading branch information
yunhanw-google authored and jmartinez-silabs committed Feb 25, 2021
1 parent f50943e commit f5aa958
Show file tree
Hide file tree
Showing 17 changed files with 213 additions and 210 deletions.
4 changes: 2 additions & 2 deletions src/app/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ CHIP_ERROR Command::AddCommand(CommandParams & aCommandParams)
commandPath.GroupId(aCommandParams.GroupId);
}

commandPath.NamespacedClusterId(aCommandParams.ClusterId).CommandId(aCommandParams.CommandId).EndOfCommandPath();
commandPath.ClusterId(aCommandParams.ClusterId).CommandId(aCommandParams.CommandId).EndOfCommandPath();

err = commandPath.GetError();
SuccessOrExit(err);
Expand Down Expand Up @@ -233,7 +233,7 @@ CHIP_ERROR Command::AddCommand(CommandParams & aCommandParams)
}

CHIP_ERROR Command::AddStatusCode(const uint16_t aGeneralCode, const uint32_t aProtocolId, const uint16_t aProtocolCode,
const chip::ClusterId aNamespacedClusterId)
const chip::ClusterId aClusterId)
{
CHIP_ERROR err = CHIP_NO_ERROR;
StatusElement::Builder statusElementBuilder;
Expand Down
2 changes: 1 addition & 1 deletion src/app/Command.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class Command
chip::CommandId aCommandId, uint8_t Flags);
CHIP_ERROR AddCommand(CommandParams & aCommandParams);
CHIP_ERROR AddStatusCode(const uint16_t aGeneralCode, const uint32_t aProtocolId, const uint16_t aProtocolCode,
const chip::ClusterId aNamespacedClusterId);
const chip::ClusterId aClusterId);
CHIP_ERROR ClearExistingExchangeContext();

CHIP_ERROR Reset();
Expand Down
2 changes: 1 addition & 1 deletion src/app/CommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ CHIP_ERROR CommandHandler::ProcessCommandDataElement(CommandDataElement::Parser
chip::EndpointId endpointId;

ReturnErrorOnFailure(aCommandElement.GetCommandPath(&commandPath));
ReturnErrorOnFailure(commandPath.GetNamespacedClusterId(&clusterId));
ReturnErrorOnFailure(commandPath.GetClusterId(&clusterId));
ReturnErrorOnFailure(commandPath.GetCommandId(&commandId));
ReturnErrorOnFailure(commandPath.GetEndpointId(&endpointId));

Expand Down
2 changes: 1 addition & 1 deletion src/app/CommandSender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ CHIP_ERROR CommandSender::ProcessCommandDataElement(CommandDataElement::Parser &
err = aCommandElement.GetCommandPath(&commandPath);
SuccessOrExit(err);

err = commandPath.GetNamespacedClusterId(&clusterId);
err = commandPath.GetClusterId(&clusterId);
SuccessOrExit(err);

err = commandPath.GetCommandId(&commandId);
Expand Down
22 changes: 11 additions & 11 deletions src/app/MessageDef/AttributePath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,18 @@ CHIP_ERROR AttributePath::Parser::CheckSchemaValidity() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kCsTag_NamespacedClusterId:
case kCsTag_ClusterId:
// check if this tag has appeared before
VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_NamespacedClusterId)), err = CHIP_ERROR_INVALID_TLV_TAG);
TagPresenceMask |= (1 << kCsTag_NamespacedClusterId);
VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_ClusterId)), err = CHIP_ERROR_INVALID_TLV_TAG);
TagPresenceMask |= (1 << kCsTag_ClusterId);
VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);

#if CHIP_DETAIL_LOGGING
if (chip::TLV::kTLVType_UnsignedInteger == reader.GetType())
{
chip::ClusterId namespacedClusterId;
reader.Get(namespacedClusterId);
PRETTY_PRINT("\tNamespacedClusterId = 0x%" PRIx32 ",", namespacedClusterId);
chip::ClusterId clusterId;
reader.Get(clusterId);
PRETTY_PRINT("\tClusterId = 0x%" PRIx32 ",", clusterId);
}
#endif // CHIP_DETAIL_LOGGING
break;
Expand Down Expand Up @@ -152,7 +152,7 @@ CHIP_ERROR AttributePath::Parser::CheckSchemaValidity() const
if (CHIP_END_OF_TLV == err)
{
// check for required fields:
const uint16_t RequiredFields = (1 << kCsTag_EndpointId) | (1 << kCsTag_NamespacedClusterId);
const uint16_t RequiredFields = (1 << kCsTag_EndpointId) | (1 << kCsTag_ClusterId);

if ((TagPresenceMask & RequiredFields) == RequiredFields)
{
Expand Down Expand Up @@ -182,9 +182,9 @@ CHIP_ERROR AttributePath::Parser::GetEndpointId(chip::EndpointId * const apEndpo
return GetUnsignedInteger(kCsTag_EndpointId, apEndpointId);
}

CHIP_ERROR AttributePath::Parser::GetNamespacedClusterId(chip::ClusterId * const apClusterId) const
CHIP_ERROR AttributePath::Parser::GetClusterId(chip::ClusterId * const apClusterId) const
{
return GetUnsignedInteger(kCsTag_NamespacedClusterId, apClusterId);
return GetUnsignedInteger(kCsTag_ClusterId, apClusterId);
}

CHIP_ERROR AttributePath::Parser::GetFieldId(uint8_t * const apFieldId) const
Expand Down Expand Up @@ -243,12 +243,12 @@ AttributePath::Builder & AttributePath::Builder::EndpointId(const chip::Endpoint
return *this;
}

AttributePath::Builder & AttributePath::Builder::NamespacedClusterId(const chip::ClusterId aClusterId)
AttributePath::Builder & AttributePath::Builder::ClusterId(const chip::ClusterId aClusterId)
{
// skip if error has already been set
SuccessOrExit(mError);

mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_NamespacedClusterId), aClusterId);
mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_ClusterId), aClusterId);
ChipLogFunctError(mError);

exit:
Expand Down
18 changes: 9 additions & 9 deletions src/app/MessageDef/AttributePath.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ namespace app {
namespace AttributePath {
enum
{
kCsTag_NodeId = 0,
kCsTag_EndpointId = 1,
kCsTag_NamespacedClusterId = 2,
kCsTag_FieldId = 3,
kCsTag_ListIndex = 4,
kCsTag_NodeId = 0,
kCsTag_EndpointId = 1,
kCsTag_ClusterId = 2,
kCsTag_FieldId = 3,
kCsTag_ListIndex = 4,
};

class Parser : public chip::app::Parser
Expand Down Expand Up @@ -104,7 +104,7 @@ class Parser : public chip::app::Parser
* #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
* #CHIP_END_OF_TLV if there is no such element
*/
CHIP_ERROR GetNamespacedClusterId(chip::ClusterId * const apClusterId) const;
CHIP_ERROR GetClusterId(chip::ClusterId * const apClusterId) const;

/**
* @brief Get a TLVReader for the FieldId. Next() must be called before accessing them.
Expand Down Expand Up @@ -171,13 +171,13 @@ class Builder : public chip::app::Builder
AttributePath::Builder & EndpointId(const chip::EndpointId aEndpointId);

/**
* @brief Inject NamespacedClusterId into the TLV stream.
* @brief Inject ClusterId into the TLV stream.
*
* @param [in] aNamespacedClusterId NamespacedClusterId for this attribute path
* @param [in] aClusterId ClusterId for this attribute path
*
* @return A reference to *this
*/
AttributePath::Builder & NamespacedClusterId(const chip::ClusterId aNamespacedClusterId);
AttributePath::Builder & ClusterId(const chip::ClusterId aClusterId);

/**
* @brief Inject FieldId into the TLV stream.
Expand Down
22 changes: 11 additions & 11 deletions src/app/MessageDef/CommandPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,16 @@ CHIP_ERROR CommandPath::Parser::CheckSchemaValidity() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kCsTag_NamespacedClusterId:
case kCsTag_ClusterId:
// check if this tag has appeared before
VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_NamespacedClusterId)), err = CHIP_ERROR_INVALID_TLV_TAG);
TagPresenceMask |= (1 << kCsTag_NamespacedClusterId);
VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_ClusterId)), err = CHIP_ERROR_INVALID_TLV_TAG);
TagPresenceMask |= (1 << kCsTag_ClusterId);
VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
#if CHIP_DETAIL_LOGGING
{
chip::ClusterId namespacedClusterId;
reader.Get(namespacedClusterId);
PRETTY_PRINT("\tNamespacedClusterId = 0x%" PRIx32 ",", namespacedClusterId);
chip::ClusterId clusterId;
reader.Get(clusterId);
PRETTY_PRINT("\tClusterId = 0x%" PRIx32 ",", clusterId);
}
#endif // CHIP_DETAIL_LOGGING
break;
Expand All @@ -135,7 +135,7 @@ CHIP_ERROR CommandPath::Parser::CheckSchemaValidity() const
if (CHIP_END_OF_TLV == err)
{
// check for required fields:
const uint16_t RequiredFields = (1 << kCsTag_CommandId) | (1 << kCsTag_NamespacedClusterId);
const uint16_t RequiredFields = (1 << kCsTag_CommandId) | (1 << kCsTag_ClusterId);

if ((TagPresenceMask & RequiredFields) == RequiredFields)
{
Expand Down Expand Up @@ -164,9 +164,9 @@ CHIP_ERROR CommandPath::Parser::GetGroupId(chip::GroupId * const apGroupId) cons
return GetUnsignedInteger(kCsTag_GroupId, apGroupId);
}

CHIP_ERROR CommandPath::Parser::GetNamespacedClusterId(chip::ClusterId * const apClusterId) const
CHIP_ERROR CommandPath::Parser::GetClusterId(chip::ClusterId * const apClusterId) const
{
return GetUnsignedInteger(kCsTag_NamespacedClusterId, apClusterId);
return GetUnsignedInteger(kCsTag_ClusterId, apClusterId);
}

CHIP_ERROR CommandPath::Parser::GetCommandId(chip::CommandId * const apCommandId) const
Expand Down Expand Up @@ -219,12 +219,12 @@ CommandPath::Builder & CommandPath::Builder::GroupId(const chip::GroupId aGroupI
return *this;
}

CommandPath::Builder & CommandPath::Builder::NamespacedClusterId(const chip::ClusterId aClusterId)
CommandPath::Builder & CommandPath::Builder::ClusterId(const chip::ClusterId aClusterId)
{
// skip if error has already been set
SuccessOrExit(mError);

mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_NamespacedClusterId), aClusterId);
mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_ClusterId), aClusterId);
ChipLogFunctError(mError);

exit:
Expand Down
22 changes: 11 additions & 11 deletions src/app/MessageDef/CommandPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ namespace app {
namespace CommandPath {
enum
{
kCsTag_EndpointId = 0,
kCsTag_GroupId = 1,
kCsTag_NamespacedClusterId = 2,
kCsTag_CommandId = 3,
kCsTag_EndpointId = 0,
kCsTag_GroupId = 1,
kCsTag_ClusterId = 2,
kCsTag_CommandId = 3,
};

class Parser : public chip::app::Parser
Expand Down Expand Up @@ -95,15 +95,15 @@ class Parser : public chip::app::Parser
CHIP_ERROR GetGroupId(chip::GroupId * const apGroupId) const;

/**
* @brief Get a TLVReader for the NamespacedClusterId. Next() must be called before accessing them.
* @brief Get a TLVReader for the ClusterId. Next() must be called before accessing them.
*
* @param [in] apEndpointId A pointer to NamespacedClusterId
* @param [in] apEndpointId A pointer to ClusterId
*
* @return #CHIP_NO_ERROR on success
* #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
* #CHIP_END_OF_TLV if there is no such element
*/
CHIP_ERROR GetNamespacedClusterId(chip::ClusterId * const apNamespacedClusterId) const;
CHIP_ERROR GetClusterId(chip::ClusterId * const apClusterId) const;

/**
* @brief Get a TLVReader for the CommandId. Next() must be called before accessing them.
Expand Down Expand Up @@ -159,18 +159,18 @@ class Builder : public chip::app::Builder
CommandPath::Builder & GroupId(const chip::GroupId aGroupId);

/**
* @brief Inject NamespacedClusterId into the TLV stream.
* @brief Inject ClusterId into the TLV stream.
*
* @param [in] aNamespacedClusterId NamespacedClusterId for this command path
* @param [in] aClusterId ClusterId for this command path
*
* @return A reference to *this
*/
CommandPath::Builder & NamespacedClusterId(const chip::ClusterId aNamespacedClusterId);
CommandPath::Builder & ClusterId(const chip::ClusterId aClusterId);

/**
* @brief Inject CommandId into the TLV stream
*
* @param [in] aCommandId Command Id for NamespacedClusterId for this command path
* @param [in] aCommandId Command Id for ClusterId for this command path
*
* @return A reference to *this
*/
Expand Down
34 changes: 17 additions & 17 deletions src/app/MessageDef/EventDataElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,10 @@ CHIP_ERROR EventDataElement::Parser::CheckSchemaValidity() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kCsTag_ImportanceLevel:
case kCsTag_PriorityLevel:
// check if this tag has appeared before
VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_ImportanceLevel)), err = CHIP_ERROR_INVALID_TLV_TAG);
TagPresenceMask |= (1 << kCsTag_ImportanceLevel);
VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_PriorityLevel)), err = CHIP_ERROR_INVALID_TLV_TAG);
TagPresenceMask |= (1 << kCsTag_PriorityLevel);
VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);

#if CHIP_DETAIL_LOGGING
Expand All @@ -266,7 +266,7 @@ CHIP_ERROR EventDataElement::Parser::CheckSchemaValidity() const
err = reader.Get(value);
SuccessOrExit(err);

PRETTY_PRINT("\tImportanceLevel = 0x%" PRIx64 ",", value);
PRETTY_PRINT("\tPriorityLevel = 0x%" PRIx64 ",", value);
}
#endif // CHIP_DETAIL_LOGGING
break;
Expand Down Expand Up @@ -335,7 +335,7 @@ CHIP_ERROR EventDataElement::Parser::CheckSchemaValidity() const
err = reader.Get(value);
SuccessOrExit(err);

PRETTY_PRINT("\tDeltaUTCTimestamp= 0x%" PRIx64 ",", value);
PRETTY_PRINT("\tDeltaUTCTimestampstamp= 0x%" PRIx64 ",", value);
}
#endif // CHIP_DETAIL_LOGGING
break;
Expand All @@ -352,7 +352,7 @@ CHIP_ERROR EventDataElement::Parser::CheckSchemaValidity() const
err = reader.Get(value);
SuccessOrExit(err);

PRETTY_PRINT("\tDeltaSystemTimestamp= 0x%" PRIx64 ",", value);
PRETTY_PRINT("\tDeltaSystemTimestamp = 0x%" PRIx64 ",", value);
}
#endif // CHIP_DETAIL_LOGGING
break;
Expand All @@ -372,12 +372,12 @@ CHIP_ERROR EventDataElement::Parser::CheckSchemaValidity() const
}
PRETTY_PRINT("},");
PRETTY_PRINT("");

// if we have exhausted this container
if (CHIP_END_OF_TLV == err)
{
// check for required fields:
const uint16_t RequiredFields =
(1 << kCsTag_EventPath) | (1 << kCsTag_ImportanceLevel) | (1 << kCsTag_Number) | (1 << kCsTag_Data);
const uint16_t RequiredFields = (1 << kCsTag_EventPath) | (1 << kCsTag_PriorityLevel) | (1 << kCsTag_Data);

if ((TagPresenceMask & RequiredFields) == RequiredFields)
{
Expand Down Expand Up @@ -416,9 +416,9 @@ CHIP_ERROR EventDataElement::Parser::GetEventPath(EventPath::Parser * const apEv
return err;
}

CHIP_ERROR EventDataElement::Parser::GetImportanceLevel(uint8_t * const apImportanceLevel)
CHIP_ERROR EventDataElement::Parser::GetPriorityLevel(uint8_t * const apPriorityLevel)
{
return GetUnsignedInteger(kCsTag_ImportanceLevel, apImportanceLevel);
return GetUnsignedInteger(kCsTag_PriorityLevel, apPriorityLevel);
}

CHIP_ERROR EventDataElement::Parser::GetNumber(uint64_t * const apNumber)
Expand All @@ -436,12 +436,12 @@ CHIP_ERROR EventDataElement::Parser::GetSystemTimestamp(uint64_t * const apSyste
return GetUnsignedInteger(kCsTag_SystemTimestamp, apSystemTimestamp);
}

CHIP_ERROR EventDataElement::Parser::GetDeltaUTCTime(uint64_t * const apDeltaUTCTimestamp)
CHIP_ERROR EventDataElement::Parser::GetDeltaUTCTimestamp(uint64_t * const apDeltaUTCTimestampstamp)
{
return GetUnsignedInteger(kCsTag_DeltaUTCTimestamp, apDeltaUTCTimestamp);
return GetUnsignedInteger(kCsTag_DeltaUTCTimestamp, apDeltaUTCTimestampstamp);
}

CHIP_ERROR EventDataElement::Parser::GetDeltaSystemTime(uint64_t * const apDeltaSystemTimestamp)
CHIP_ERROR EventDataElement::Parser::GetDeltaSystemTimestamp(uint64_t * const apDeltaSystemTimestamp)
{
return GetUnsignedInteger(kCsTag_DeltaSystemTimestamp, apDeltaSystemTimestamp);
}
Expand Down Expand Up @@ -473,12 +473,12 @@ EventPath::Builder & EventDataElement::Builder::CreateEventPathBuilder()
return mEventPathBuilder;
}

EventDataElement::Builder EventDataElement::Builder::ImportanceLevel(const uint8_t aImportanceLevel)
EventDataElement::Builder EventDataElement::Builder::PriorityLevel(const uint8_t aPriorityLevel)
{
// skip if error has already been set
SuccessOrExit(mError);

mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_ImportanceLevel), aImportanceLevel);
mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_PriorityLevel), aPriorityLevel);
ChipLogFunctError(mError);

exit:
Expand Down Expand Up @@ -521,7 +521,7 @@ EventDataElement::Builder EventDataElement::Builder::SystemTimestamp(const uint6
return *this;
}

EventDataElement::Builder EventDataElement::Builder::DeltaUTCTime(const uint64_t aDeltaUTCTimestamp)
EventDataElement::Builder EventDataElement::Builder::DeltaUTCTimestamp(const uint64_t aDeltaUTCTimestamp)
{
// skip if error has already been set
SuccessOrExit(mError);
Expand All @@ -533,7 +533,7 @@ EventDataElement::Builder EventDataElement::Builder::DeltaUTCTime(const uint64_t
return *this;
}

EventDataElement::Builder EventDataElement::Builder::DeltaSystemTime(const uint64_t aDeltaSystemTimestamp)
EventDataElement::Builder EventDataElement::Builder::DeltaSystemTimestamp(const uint64_t aDeltaSystemTimestamp)
{
// skip if error has already been set
SuccessOrExit(mError);
Expand Down
Loading

0 comments on commit f5aa958

Please sign in to comment.