Skip to content

Commit

Permalink
Place everything into a Revision namespace to avoid name collision …
Browse files Browse the repository at this point in the history
…with a Tags enum
  • Loading branch information
andreilitvin committed Feb 20, 2024
1 parent 77d5e0d commit c7d875b
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/app/InteractionModelRevision.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <lib/core/DataModelTypes.h>

namespace chip {
namespace Revision {

/**
* A monothonic number identifying the interaction model revision.
Expand Down Expand Up @@ -51,4 +52,5 @@ inline constexpr uint16_t kDataModelRevision = 17;
*/
inline constexpr uint32_t kSpecificationVersion = 0x01030000;

} // namespace Revision
} // namespace chip
2 changes: 1 addition & 1 deletion src/app/MessageDef/InvokeRequestMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ CHIP_ERROR InvokeRequestMessage::Parser::PrettyPrint() const
PRETTY_PRINT_DECDEPTH();
}
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/InvokeResponseMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ CHIP_ERROR InvokeResponseMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/MessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace chip {
namespace app {
CHIP_ERROR MessageBuilder::EncodeInteractionModelRevision()
{
return mpWriter->Put(TLV::ContextTag(kInteractionModelRevisionTag), kInteractionModelRevision);
return mpWriter->Put(TLV::ContextTag(Revision::kInteractionModelRevisionTag), Revision::kInteractionModelRevision);
}
} // namespace app
} // namespace chip
2 changes: 1 addition & 1 deletion src/app/MessageDef/MessageParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ CHIP_ERROR MessageParser::CheckInteractionModelRevision(TLV::TLVReader & aReader

CHIP_ERROR MessageParser::GetInteractionModelRevision(InteractionModelRevision * const apInteractionModelRevision) const
{
return GetUnsignedInteger(kInteractionModelRevisionTag, apInteractionModelRevision);
return GetUnsignedInteger(Revision::kInteractionModelRevisionTag, apInteractionModelRevision);
}

} // namespace app
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/ReadRequestMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ CHIP_ERROR ReadRequestMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/ReportDataMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ CHIP_ERROR ReportDataMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/StatusResponseMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ CHIP_ERROR StatusResponseMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/SubscribeRequestMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ CHIP_ERROR SubscribeRequestMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/SubscribeResponseMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ CHIP_ERROR SubscribeResponseMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/TimedRequestMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ CHIP_ERROR TimedRequestMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/WriteRequestMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ CHIP_ERROR WriteRequestMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/WriteResponseMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ CHIP_ERROR WriteResponseMessage::Parser::PrettyPrint() const
ReturnErrorOnFailure(writeResponses.PrettyPrint());
PRETTY_PRINT_DECDEPTH();
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
4 changes: 2 additions & 2 deletions src/app/clusters/basic-information/basic-information.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ CHIP_ERROR BasicAttrAccess::Read(const ConcreteReadAttributePath & aPath, Attrib

CHIP_ERROR BasicAttrAccess::ReadDataModelRevision(AttributeValueEncoder & aEncoder)
{
uint16_t revision = kDataModelRevision;
uint16_t revision = Revision::kDataModelRevision;
return aEncoder.Encode(revision);
}

Expand Down Expand Up @@ -398,7 +398,7 @@ CHIP_ERROR BasicAttrAccess::ReadProductAppearance(AttributeValueEncoder & aEncod

CHIP_ERROR BasicAttrAccess::ReadSpecificationVersion(AttributeValueEncoder & aEncoder)
{
uint32_t specification_version = kSpecificationVersion;
uint32_t specification_version = Revision::kSpecificationVersion;
return aEncoder.Encode(specification_version);
}

Expand Down
6 changes: 3 additions & 3 deletions src/protocols/secure_channel/PairingSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ CHIP_ERROR PairingSession::EncodeSessionParameters(TLV::Tag tag, const Optional<
ReturnErrorOnFailure(tlvWriter.Put(TLV::ContextTag(SessionParameters::Tag::kSessionActiveThreshold),
mrpLocalConfig.mActiveThresholdTime.count()));

uint16_t dataModel = kDataModelRevision;
uint16_t dataModel = Revision::kDataModelRevision;
ReturnErrorOnFailure(tlvWriter.Put(TLV::ContextTag(SessionParameters::Tag::kDataModelRevision), dataModel));

uint16_t interactionModel = kInteractionModelRevision;
uint16_t interactionModel = Revision::kInteractionModelRevision;
ReturnErrorOnFailure(tlvWriter.Put(TLV::ContextTag(SessionParameters::Tag::kInteractionModelRevision), interactionModel));

uint32_t specVersion = kSpecificationVersion;
uint32_t specVersion = Revision::kSpecificationVersion;
ReturnErrorOnFailure(tlvWriter.Put(TLV::ContextTag(SessionParameters::Tag::kSpecificationVersion), specVersion));

uint16_t maxPathsPerInvoke = CHIP_CONFIG_MAX_PATHS_PER_INVOKE;
Expand Down

0 comments on commit c7d875b

Please sign in to comment.