Skip to content

Commit

Permalink
Removed the tag from ExtensionFieldSetsImpl.Serialize() signature
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs committed Nov 27, 2023
1 parent 5924e04 commit 5536571
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/app/clusters/scenes-server/ExtensionFieldSets.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ class ExtensionFieldSets
ExtensionFieldSets(){};
virtual ~ExtensionFieldSets() = default;

virtual CHIP_ERROR Serialize(TLV::TLVWriter & writer, TLV::Tag structTa) const = 0;
virtual CHIP_ERROR Deserialize(TLV::TLVReader & reader, TLV::Tag structTa) = 0;
virtual void Clear() = 0;
virtual bool IsEmpty() const = 0;
virtual CHIP_ERROR Serialize(TLV::TLVWriter & writer) const = 0;
virtual CHIP_ERROR Deserialize(TLV::TLVReader & reader) = 0;
virtual void Clear() = 0;
virtual bool IsEmpty() const = 0;
/// @brief Gets a count of how many initialized fields sets are in the object
/// @return The number of initialized field sets the object
/// @note Field set refers to extension field sets, from the scene cluster (see 1.4.6.2 ExtensionFieldSet in Matter Application
Expand Down
4 changes: 2 additions & 2 deletions src/app/clusters/scenes-server/ExtensionFieldSetsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace scenes {

// ExtensionFieldSetsImpl::ExtensionFieldSetsImpl() : ExtensionFieldSets() {}

CHIP_ERROR ExtensionFieldSetsImpl::Serialize(TLV::TLVWriter & writer, TLV::Tag structTag) const
CHIP_ERROR ExtensionFieldSetsImpl::Serialize(TLV::TLVWriter & writer) const
{
TLV::TLVType arrayContainer;
ReturnErrorOnFailure(
Expand All @@ -35,7 +35,7 @@ CHIP_ERROR ExtensionFieldSetsImpl::Serialize(TLV::TLVWriter & writer, TLV::Tag s
return writer.EndContainer(arrayContainer);
}

CHIP_ERROR ExtensionFieldSetsImpl::Deserialize(TLV::TLVReader & reader, TLV::Tag structTag)
CHIP_ERROR ExtensionFieldSetsImpl::Deserialize(TLV::TLVReader & reader)
{
TLV::TLVType arrayContainer;
ReturnErrorOnFailure(reader.Next(TLV::kTLVType_Array, TLV::ContextTag(TagEFS::kFieldSetArrayContainer)));
Expand Down
4 changes: 2 additions & 2 deletions src/app/clusters/scenes-server/ExtensionFieldSetsImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ class ExtensionFieldSetsImpl : public ExtensionFieldSets
~ExtensionFieldSetsImpl() override{};

// overrides
CHIP_ERROR Serialize(TLV::TLVWriter & writer, TLV::Tag structTag) const override;
CHIP_ERROR Deserialize(TLV::TLVReader & reader, TLV::Tag structTag) override;
CHIP_ERROR Serialize(TLV::TLVWriter & writer) const override;
CHIP_ERROR Deserialize(TLV::TLVReader & reader) override;
void Clear() override;
bool IsEmpty() const override { return (mFieldSetsCount == 0); }
uint8_t GetFieldSetCount() const override { return mFieldSetsCount; };
Expand Down
7 changes: 2 additions & 5 deletions src/app/clusters/scenes-server/SceneTableImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ enum class TagScene : uint8_t
kSceneID,
kName,
kTransitionTimeMs,
kExtensionFieldSetsContainer,
};

using SceneTableEntry = DefaultSceneTableImpl::SceneTableEntry;
Expand Down Expand Up @@ -150,8 +149,7 @@ struct SceneTableData : public SceneTableEntry, PersistentData<kPersistentSceneB
}

ReturnErrorOnFailure(writer.Put(TLV::ContextTag(TagScene::kTransitionTimeMs), mStorageData.mSceneTransitionTimeMs));
ReturnErrorOnFailure(
mStorageData.mExtensionFieldSets.Serialize(writer, TLV::ContextTag(TagScene::kExtensionFieldSetsContainer)));
ReturnErrorOnFailure(mStorageData.mExtensionFieldSets.Serialize(writer));

return writer.EndContainer(container);
}
Expand Down Expand Up @@ -186,8 +184,7 @@ struct SceneTableData : public SceneTableEntry, PersistentData<kPersistentSceneB
mStorageData.SetName(nameSpan);

ReturnErrorOnFailure(reader.Get(mStorageData.mSceneTransitionTimeMs));
ReturnErrorOnFailure(
mStorageData.mExtensionFieldSets.Deserialize(reader, TLV::ContextTag(TagScene::kExtensionFieldSetsContainer)));
ReturnErrorOnFailure(mStorageData.mExtensionFieldSets.Deserialize(reader));

return reader.ExitContainer(container);
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/tests/TestExtensionFieldSets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,15 @@ void TestSerializeDerializeExtensionFieldSet(nlTestSuite * aSuite, void * aConte
// All ExtensionFieldSets serialize / deserialize
writer.Init(sceneEFSBuffer);
writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outer);
NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->Serialize(writer, TLV::ContextTag(TagTestEFS::kEFS)));
NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->Serialize(writer));
writer.EndContainer(outer);
sceneEFS_serialized_length = writer.GetLengthWritten();
NL_TEST_ASSERT(aSuite, sceneEFS_serialized_length <= kPersistentSceneBufferMax);

reader.Init(sceneEFSBuffer);
NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.Next());
NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.EnterContainer(outerRead));
NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testSceneEFS.Deserialize(reader, TLV::ContextTag(TagTestEFS::kEFS)));
NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testSceneEFS.Deserialize(reader));

NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.ExitContainer(outerRead));
NL_TEST_ASSERT(aSuite, *EFS == testSceneEFS);
Expand Down

0 comments on commit 5536571

Please sign in to comment.