Skip to content

Commit

Permalink
Switch TLV::Tag to being a struct (#13219)
Browse files Browse the repository at this point in the history
* Make TLV::Tag a class.

The changes to the static TLV tags in groups code are to reduce
codesize: constexpr functions get compiled smaller than static
constexpr variables.

* Use a constexpr function, not variable for AnonymousTag.

This leads to smaller compiled code.  We might be able to get the same
with an inline constexpr variable, but those are C++17.

This diff waas mostly generated with:

  git grep -l AnonymousTag | xargs perl -pi -e 's/AnonymousTag/AnonymousTag()/g'
  • Loading branch information
bzbarsky-apple authored Dec 23, 2021
1 parent 6f46e30 commit 5c096ec
Show file tree
Hide file tree
Showing 58 changed files with 537 additions and 507 deletions.
2 changes: 1 addition & 1 deletion src/app/AttributeCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CHIP_ERROR AttributeCache::UpdateCache(const ConcreteDataAttributePath & aPath,

writer.Init(std::move(handle), false);

ReturnErrorOnFailure(writer.CopyElement(TLV::AnonymousTag, *apData));
ReturnErrorOnFailure(writer.CopyElement(TLV::AnonymousTag(), *apData));
ReturnErrorOnFailure(writer.Finalize(&handle));

//
Expand Down
6 changes: 3 additions & 3 deletions src/app/BufferedReadCallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ CHIP_ERROR BufferedReadCallback::GenerateListTLV(TLV::ScopedBufferTLVReader & aR
VerifyOrReturnError(backingBuffer.Get() != nullptr, CHIP_ERROR_NO_MEMORY);

TLV::ScopedBufferTLVWriter writer(std::move(backingBuffer), totalBufSize);
ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Array, outerType));
ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Array, outerType));

for (auto & bufHandle : mBufferedList)
{
Expand All @@ -88,7 +88,7 @@ CHIP_ERROR BufferedReadCallback::GenerateListTLV(TLV::ScopedBufferTLVReader & aR
reader.Init(std::move(bufHandle));

ReturnErrorOnFailure(reader.Next());
ReturnErrorOnFailure(writer.CopyElement(TLV::AnonymousTag, reader));
ReturnErrorOnFailure(writer.CopyElement(TLV::AnonymousTag(), reader));
}

ReturnErrorOnFailure(writer.EndContainer(outerType));
Expand Down Expand Up @@ -120,7 +120,7 @@ CHIP_ERROR BufferedReadCallback::BufferListItem(TLV::TLVReader & reader)

writer.Init(std::move(handle), false);

ReturnErrorOnFailure(writer.CopyElement(TLV::AnonymousTag, reader));
ReturnErrorOnFailure(writer.CopyElement(TLV::AnonymousTag(), reader));
ReturnErrorOnFailure(writer.Finalize(&handle));

// Compact the buffer down to a more reasonably sized packet buffer
Expand Down
2 changes: 1 addition & 1 deletion src/app/CommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ CHIP_ERROR CommandHandler::ProcessInvokeRequest(System::PacketBufferHandle && pa
invokeRequests.GetReader(&invokeRequestsReader);
while (CHIP_NO_ERROR == (err = invokeRequestsReader.Next()))
{
VerifyOrReturnError(TLV::AnonymousTag == invokeRequestsReader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::AnonymousTag() == invokeRequestsReader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
CommandDataIB::Parser commandData;
ReturnErrorOnFailure(commandData.Init(invokeRequestsReader));
ReturnErrorOnFailure(ProcessCommandDataIB(commandData));
Expand Down
2 changes: 1 addition & 1 deletion src/app/CommandSender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ CHIP_ERROR CommandSender::ProcessInvokeResponse(System::PacketBufferHandle && pa

while (CHIP_NO_ERROR == (err = invokeResponsesReader.Next()))
{
VerifyOrReturnError(TLV::AnonymousTag == invokeResponsesReader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::AnonymousTag() == invokeResponsesReader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
InvokeResponseIB::Parser invokeResponse;
ReturnErrorOnFailure(invokeResponse.Init(invokeResponsesReader));
ReturnErrorOnFailure(ProcessInvokeResponseIB(invokeResponse));
Expand Down
2 changes: 1 addition & 1 deletion src/app/EventManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ CHIP_ERROR EventManagement::CopyEvent(const TLVReader & aReader, TLVWriter & aWr

reader.Init(aReader);
ReturnErrorOnFailure(reader.EnterContainer(containerType));
ReturnErrorOnFailure(aWriter.StartContainer(AnonymousTag, kTLVType_Structure, containerType));
ReturnErrorOnFailure(aWriter.StartContainer(AnonymousTag(), kTLVType_Structure, containerType));

ReturnErrorOnFailure(reader.Next());
ReturnErrorOnFailure(reader.EnterContainer(containerType1));
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/ArrayBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ CHIP_ERROR ArrayBuilder::Init(TLV::TLVWriter * const apWriter, const uint8_t aCo
CHIP_ERROR ArrayBuilder::Init(TLV::TLVWriter * const apWriter)
{
mpWriter = apWriter;
mError = mpWriter->StartContainer(TLV::AnonymousTag, chip::TLV::kTLVType_Array, mOuterContainerType);
mError = mpWriter->StartContainer(TLV::AnonymousTag(), chip::TLV::kTLVType_Array, mOuterContainerType);

return mError;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/AttributeDataIBs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ CHIP_ERROR AttributeDataIBs::Parser::CheckSchemaValidity() const

while (CHIP_NO_ERROR == (err = reader.Next()))
{
VerifyOrExit(chip::TLV::AnonymousTag == reader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrExit(chip::TLV::AnonymousTag() == reader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrExit(chip::TLV::kTLVType_Structure == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);

{
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/AttributePathIBs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ CHIP_ERROR AttributePathIBs::Parser::CheckSchemaValidity() const

while (CHIP_NO_ERROR == (err = reader.Next()))
{
VerifyOrReturnError(TLV::AnonymousTag == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::kTLVType_List == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE);
{
AttributePathIB::Parser path;
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/AttributeReportIBs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ CHIP_ERROR AttributeReportIBs::Parser::CheckSchemaValidity() const

while (CHIP_NO_ERROR == (err = reader.Next()))
{
VerifyOrReturnError(TLV::AnonymousTag == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
{
AttributeReportIB::Parser AttributeReport;
ReturnErrorOnFailure(AttributeReport.Init(reader));
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/AttributeStatusIBs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ CHIP_ERROR AttributeStatusIBs::Parser::CheckSchemaValidity() const

while (CHIP_NO_ERROR == (err = reader.Next()))
{
VerifyOrReturnError(TLV::AnonymousTag == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
{
AttributeStatusIB::Parser status;
ReturnErrorOnFailure(status.Init(reader));
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/DataVersionFilterIBs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ CHIP_ERROR DataVersionFilterIBs::Parser::CheckSchemaValidity() const

while (CHIP_NO_ERROR == (err = reader.Next()))
{
VerifyOrReturnError(TLV::AnonymousTag == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
{
DataVersionFilterIB::Parser DataVersionFilter;
ReturnErrorOnFailure(DataVersionFilter.Init(reader));
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/EventFilterIBs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ CHIP_ERROR EventFilterIBs::Parser::CheckSchemaValidity() const

while (CHIP_NO_ERROR == (err = reader.Next()))
{
VerifyOrReturnError(TLV::AnonymousTag == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
{
EventFilterIB::Parser eventFilter;
ReturnErrorOnFailure(eventFilter.Init(reader));
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/EventPathIBs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ CHIP_ERROR EventPathIBs::Parser::CheckSchemaValidity() const

while (CHIP_NO_ERROR == (err = reader.Next()))
{
VerifyOrReturnError(TLV::AnonymousTag == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::kTLVType_List == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE);

{
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/EventReportIBs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ CHIP_ERROR EventReportIBs::Parser::CheckSchemaValidity() const

while (CHIP_NO_ERROR == (err = reader.Next()))
{
VerifyOrReturnError(TLV::AnonymousTag == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
{
EventReportIB::Parser eventReport;
ReturnErrorOnFailure(eventReport.Init(reader));
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/InvokeRequests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ CHIP_ERROR InvokeRequests::Parser::CheckSchemaValidity() const

while (CHIP_NO_ERROR == (err = reader.Next()))
{
VerifyOrReturnError(TLV::AnonymousTag == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
{
CommandDataIB::Parser commandData;
ReturnErrorOnFailure(commandData.Init(reader));
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/InvokeResponseIBs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ CHIP_ERROR InvokeResponseIBs::Parser::CheckSchemaValidity() const

while (CHIP_NO_ERROR == (err = reader.Next()))
{
VerifyOrReturnError(TLV::AnonymousTag == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
{
InvokeResponseIB::Parser invokeResponse;
ReturnErrorOnFailure(invokeResponse.Init(reader));
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/ListBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CHIP_ERROR ListBuilder::Init(TLV::TLVWriter * const apWriter, const uint8_t aCon
CHIP_ERROR ListBuilder::Init(TLV::TLVWriter * const apWriter)
{
mpWriter = apWriter;
mError = mpWriter->StartContainer(TLV::AnonymousTag, TLV::kTLVType_List, mOuterContainerType);
mError = mpWriter->StartContainer(TLV::AnonymousTag(), TLV::kTLVType_List, mOuterContainerType);

return mError;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/StructBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CHIP_ERROR StructBuilder::Init(TLV::TLVWriter * const apWriter, const uint8_t aC
CHIP_ERROR StructBuilder::Init(TLV::TLVWriter * const apWriter)
{
mpWriter = apWriter;
mError = mpWriter->StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, mOuterContainerType);
mError = mpWriter->StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, mOuterContainerType);
return mError;
}
} // namespace app
Expand Down
6 changes: 3 additions & 3 deletions src/app/ReadHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ CHIP_ERROR ReadHandler::ProcessAttributePathList(AttributePathIBs::Parser & aAtt

while (CHIP_NO_ERROR == (err = reader.Next()))
{
VerifyOrExit(TLV::AnonymousTag == reader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrExit(TLV::AnonymousTag() == reader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrExit(TLV::kTLVType_List == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
ClusterInfo clusterInfo;
AttributePathIB::Parser path;
Expand Down Expand Up @@ -420,7 +420,7 @@ CHIP_ERROR ReadHandler::ProcessEventPaths(EventPathIBs::Parser & aEventPathsPars

while (CHIP_NO_ERROR == (err = reader.Next()))
{
VerifyOrReturnError(TLV::AnonymousTag == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
ClusterInfo clusterInfo;
EventPathIB::Parser path;
ReturnErrorOnFailure(path.Init(reader));
Expand Down Expand Up @@ -477,7 +477,7 @@ CHIP_ERROR ReadHandler::ProcessEventFilters(EventFilterIBs::Parser & aEventFilte

while (CHIP_NO_ERROR == (err = reader.Next()))
{
VerifyOrReturnError(TLV::AnonymousTag == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
EventFilterIB::Parser filter;
ReturnErrorOnFailure(filter.Init(reader));
// this is for current node, and would have only one event filter.
Expand Down
2 changes: 1 addition & 1 deletion src/app/WriteClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ CHIP_ERROR WriteClient::ProcessWriteResponseMessage(System::PacketBufferHandle &

while (CHIP_NO_ERROR == (err = attributeStatusesReader.Next()))
{
VerifyOrExit(TLV::AnonymousTag == attributeStatusesReader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG);
VerifyOrExit(TLV::AnonymousTag() == attributeStatusesReader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG);

AttributeStatusIB::Parser element;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ struct AccessControlEntryCodec
{
NodeId subject;
ReturnErrorOnFailure(entry.GetSubject(i, subject));
ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::AnonymousTag, subject));
ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::AnonymousTag(), subject));
}
ReturnErrorOnFailure(aWriter.EndContainer(subjectsContainer));
}
Expand All @@ -180,7 +180,7 @@ struct AccessControlEntryCodec
for (size_t i = 0; i < count; ++i)
{
TLV::TLVType targetContainer;
ReturnErrorOnFailure(aWriter.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, targetContainer));
ReturnErrorOnFailure(aWriter.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, targetContainer));
AccessControl::Entry::Target target;
ReturnErrorOnFailure(entry.GetTarget(i, target));
if (target.flags & AccessControl::Entry::Target::kCluster)
Expand Down
62 changes: 40 additions & 22 deletions src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,18 @@ namespace {

struct GroupKeyCodec
{
static const TLV::Tag kTagFabric = TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupKey::Fields::kFabricIndex));
static const TLV::Tag kTagGroup = TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupKey::Fields::kGroupId));
static const TLV::Tag kTagKeyset =
TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupKey::Fields::kGroupKeySetID));
static constexpr TLV::Tag TagFabric()
{
return TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupKey::Fields::kFabricIndex));
}
static constexpr TLV::Tag TagGroup()
{
return TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupKey::Fields::kGroupId));
}
static constexpr TLV::Tag TagKeyset()
{
return TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupKey::Fields::kGroupKeySetID));
}

chip::FabricIndex mFabric = 0;
GroupDataProvider::GroupKey mMapping;
Expand All @@ -61,11 +69,11 @@ struct GroupKeyCodec
ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer));

// FabricIndex
ReturnErrorOnFailure(DataModel::Encode(writer, kTagFabric, mFabric));
ReturnErrorOnFailure(DataModel::Encode(writer, TagFabric(), mFabric));
// GroupId
ReturnErrorOnFailure(DataModel::Encode(writer, kTagGroup, mMapping.group_id));
ReturnErrorOnFailure(DataModel::Encode(writer, TagGroup(), mMapping.group_id));
// GroupKeySetID
ReturnErrorOnFailure(DataModel::Encode(writer, kTagKeyset, mMapping.keyset_id));
ReturnErrorOnFailure(DataModel::Encode(writer, TagKeyset(), mMapping.keyset_id));

ReturnErrorOnFailure(writer.EndContainer(outer));
return CHIP_NO_ERROR;
Expand All @@ -79,13 +87,13 @@ struct GroupKeyCodec
ReturnErrorOnFailure(reader.EnterContainer(outer));

// FabricIndex
ReturnErrorOnFailure(reader.Next(kTagFabric));
ReturnErrorOnFailure(reader.Next(TagFabric()));
ReturnErrorOnFailure(reader.Get(mFabric));
// GroupId
ReturnErrorOnFailure(reader.Next(kTagGroup));
ReturnErrorOnFailure(reader.Next(TagGroup()));
ReturnErrorOnFailure(reader.Get(mMapping.group_id));
// GroupKeySetID
ReturnErrorOnFailure(reader.Next(kTagKeyset));
ReturnErrorOnFailure(reader.Next(TagKeyset()));
ReturnErrorOnFailure(reader.Get(mMapping.keyset_id));

ReturnErrorOnFailure(reader.ExitContainer(outer));
Expand All @@ -95,12 +103,22 @@ struct GroupKeyCodec

struct GroupTableCodec
{
static const TLV::Tag kTagFabric = TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupInfo::Fields::kFabricIndex));
static const TLV::Tag kTagGroup = TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupInfo::Fields::kGroupId));
static const TLV::Tag kTagEndpoints =
TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupInfo::Fields::kEndpoints));
static const TLV::Tag kTagGroupName =
TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupInfo::Fields::kGroupName));
static constexpr TLV::Tag TagFabric()
{
return TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupInfo::Fields::kFabricIndex));
}
static constexpr TLV::Tag TagGroup()
{
return TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupInfo::Fields::kGroupId));
}
static constexpr TLV::Tag TagEndpoints()
{
return TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupInfo::Fields::kEndpoints));
}
static constexpr TLV::Tag TagGroupName()
{
return TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupInfo::Fields::kGroupName));
}

GroupDataProvider * mProvider = nullptr;
chip::FabricIndex mFabric;
Expand All @@ -116,12 +134,12 @@ struct GroupTableCodec
ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer));

// FabricIndex
ReturnErrorOnFailure(DataModel::Encode(writer, kTagFabric, mFabric));
ReturnErrorOnFailure(DataModel::Encode(writer, TagFabric(), mFabric));
// GroupId
ReturnErrorOnFailure(DataModel::Encode(writer, kTagGroup, mInfo.group_id));
ReturnErrorOnFailure(DataModel::Encode(writer, TagGroup(), mInfo.group_id));
// Endpoints
TLV::TLVType inner;
ReturnErrorOnFailure(writer.StartContainer(kTagEndpoints, TLV::kTLVType_Array, inner));
ReturnErrorOnFailure(writer.StartContainer(TagEndpoints(), TLV::kTLVType_Array, inner));
GroupDataProvider::GroupEndpoint mapping;
auto iter = mProvider->IterateEndpoints(mFabric);
if (nullptr != iter)
Expand All @@ -130,15 +148,15 @@ struct GroupTableCodec
{
if (mapping.group_id == mInfo.group_id)
{
ReturnErrorOnFailure(writer.Put(TLV::AnonymousTag, static_cast<uint16_t>(mapping.endpoint_id)));
ReturnErrorOnFailure(writer.Put(TLV::AnonymousTag(), static_cast<uint16_t>(mapping.endpoint_id)));
}
}
iter->Release();
}
ReturnErrorOnFailure(writer.EndContainer(inner));
// GroupName
uint32_t name_size = static_cast<uint32_t>(strnlen(mInfo.name, GroupDataProvider::GroupInfo::kGroupNameMax));
ReturnErrorOnFailure(writer.PutString(kTagGroupName, mInfo.name, name_size));
ReturnErrorOnFailure(writer.PutString(TagGroupName(), mInfo.name, name_size));

ReturnErrorOnFailure(writer.EndContainer(outer));
return CHIP_NO_ERROR;
Expand Down Expand Up @@ -490,7 +508,7 @@ struct KeySetReadAllIndicesResponse
GroupDataProvider::KeySet keyset;
while (mIterator && mIterator->Next(keyset))
{
ReturnErrorOnFailure(app::DataModel::Encode(writer, TLV::AnonymousTag, keyset.keyset_id));
ReturnErrorOnFailure(app::DataModel::Encode(writer, TLV::AnonymousTag(), keyset.keyset_id));
}

ReturnErrorOnFailure(writer.EndContainer(array));
Expand Down
4 changes: 2 additions & 2 deletions src/app/clusters/groups-server/groups-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ struct GroupMembershipResponse
{
if (mapping.endpoint_id == mEndpoint)
{
ReturnErrorOnFailure(app::DataModel::Encode(writer, TLV::AnonymousTag, mapping.group_id));
ReturnErrorOnFailure(app::DataModel::Encode(writer, TLV::AnonymousTag(), mapping.group_id));
matchCount++;
ChipLogDetail(Zcl, " 0x%02" PRIx16, mapping.group_id);
}
Expand All @@ -252,7 +252,7 @@ struct GroupMembershipResponse
{
if (mapping.endpoint_id == mEndpoint && mapping.group_id == iter.GetValue())
{
ReturnErrorOnFailure(app::DataModel::Encode(writer, TLV::AnonymousTag, mapping.group_id));
ReturnErrorOnFailure(app::DataModel::Encode(writer, TLV::AnonymousTag(), mapping.group_id));
matchCount++;
ChipLogDetail(Zcl, " 0x%02" PRIx16, mapping.group_id);
break;
Expand Down
Loading

0 comments on commit 5c096ec

Please sign in to comment.