Skip to content

Commit

Permalink
Removed logging of empty efs array
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs committed Nov 28, 2023
1 parent 122ca15 commit 6a634b7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
2 changes: 0 additions & 2 deletions src/app/clusters/scenes-server/ExtensionFieldSetsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
namespace chip {
namespace scenes {

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

CHIP_ERROR ExtensionFieldSetsImpl::Serialize(TLV::TLVWriter & writer) const
{
TLV::TLVType arrayContainer;
Expand Down
18 changes: 13 additions & 5 deletions src/app/clusters/scenes-server/SceneTableImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ struct EndpointSceneCount : public PersistentData<kPersistentBufferSceneCountByt
}
};

// Worst case tested: Add Scene Command with EFS using the default SerializeAdd Method. This yielded a serialized scene of 171 bytes
// Worst case tested: Add Scene Command with EFS using the default SerializeAdd Method. This yielded a serialized scene of 175 bytes
// when using the OnOff, Level Control and Color Control as well as the maximal name length of 16 bytes. Putting 256 gives some
// slack in case different clusters are used. Value obtained by using writer.GetLengthWritten at the end of the SceneTableData
// Serialize method.
Expand Down Expand Up @@ -149,8 +149,11 @@ struct SceneTableData : public SceneTableEntry, PersistentData<kPersistentSceneB
}

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

if (!mStorageData.mExtensionFieldSets.IsEmpty())
{
ReturnErrorOnFailure(mStorageData.mExtensionFieldSets.Serialize(writer));
}
return writer.EndContainer(container);
}

Expand All @@ -171,7 +174,7 @@ struct SceneTableData : public SceneTableEntry, PersistentData<kPersistentSceneB
ReturnErrorOnFailure(reader.Next());
TLV::Tag currTag = reader.GetTag();
VerifyOrReturnError(TLV::ContextTag(TagScene::kName) == currTag || TLV::ContextTag(TagScene::kTransitionTimeMs) == currTag,
CHIP_ERROR_WRONG_TLV_TYPE);
CHIP_ERROR_INVALID_TLV_TAG);

CharSpan nameSpan;
// A name may or may not have been stored. Check whether it was.
Expand All @@ -182,9 +185,14 @@ struct SceneTableData : public SceneTableEntry, PersistentData<kPersistentSceneB
}
// Empty name will be initialized if the name wasn't stored
mStorageData.SetName(nameSpan);

ReturnErrorOnFailure(reader.Get(mStorageData.mSceneTransitionTimeMs));
ReturnErrorOnFailure(mStorageData.mExtensionFieldSets.Deserialize(reader));

CHIP_ERROR err = reader.Next();
if (CHIP_END_OF_TLV != err)
{
VerifyOrReturnError(TLV::kTLVType_Array == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE);
ReturnErrorOnFailure(mStorageData.mExtensionFieldSets.Deserialize(reader));
}

return reader.ExitContainer(container);
}
Expand Down
16 changes: 8 additions & 8 deletions src/lib/core/CHIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1473,16 +1473,16 @@ extern const char CHIP_NON_PRODUCTION_MARKER[];
* }
*
* Including all the TLV fields, the following values can help estimate the needed size for a scenes given a number of clusters:
* Empty EFS Scene Max name size: 33bytes
* Scene Max name size + OnOff : 51 bytes
* Scene Max name size + LevelControl : 60 bytes
* Scene Max name size + ColorControl : 126 bytes
* Scene Max name size + OnOff + LevelControl + ColoControl : 171 bytes
* Empty EFS Scene Max name size: 34bytes
* Scene Max name size + OnOff : 55 bytes
* Scene Max name size + LevelControl : 64 bytes
* Scene Max name size + ColorControl : 130 bytes
* Scene Max name size + OnOff + LevelControl + ColoControl : 175 bytes
*
* Cluster Sizes:
* OnOff Cluster Max Size: 18 bytes
* LevelControl Cluster Max Size: 27 bytes
* Color Control Cluster Max Size: 93 bytes
* OnOff Cluster Max Size: 21 bytes
* LevelControl Cluster Max Size: 30 bytes
* Color Control Cluster Max Size: 96 bytes
* */
#ifndef CHIP_CONFIG_SCENES_MAX_SERIALIZED_SCENE_SIZE_BYTES
#define CHIP_CONFIG_SCENES_MAX_SERIALIZED_SCENE_SIZE_BYTES 256
Expand Down

0 comments on commit 6a634b7

Please sign in to comment.