Skip to content

Commit 2557153

Browse files
lpbeliveau-silabsbzbarsky-apple
authored andcommitted
Apply suggestions from code review
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent c23116f commit 2557153

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

src/app/clusters/scenes/ExtensionFieldSetsImpl.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ CHIP_ERROR ExtensionFieldSetsImpl::Serialize(TLV::TLVWriter & writer, TLV::Tag s
2626
{
2727
TLV::TLVType container;
2828
ReturnErrorOnFailure(writer.StartContainer(structTag, TLV::kTLVType_Structure, container));
29-
// ReturnErrorOnFailure(writer.Put(TLV::ContextTag(TagEFS::kFieldSetsCount), static_cast<uint8_t>(mFieldSetsCount)));
3029
ReturnErrorOnFailure(writer.StartContainer(TLV::ContextTag(TagEFS::kFieldSetArrayContainer), TLV::kTLVType_Array, container));
3130
for (uint8_t i = 0; i < mFieldSetsCount; i++)
3231
{
@@ -132,7 +131,7 @@ CHIP_ERROR ExtensionFieldSetsImpl::RemoveFieldAtPosition(uint8_t position)
132131

133132
mFieldSetsCount--;
134133
// Clear last occupied position
135-
mFieldSets[mFieldSetsCount].Clear(); //
134+
mFieldSets[mFieldSetsCount].Clear();
136135

137136
return CHIP_NO_ERROR;
138137
}

src/app/clusters/scenes/SceneTable.h

+8-9
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static constexpr size_t kSceneNameMaxLength = CHIP_CONFIG_SCENES_CLUSTER_MAXIMUM
5050
///
5151
/// A SceneHandler can handle a single <endpoint, cluster> pair, or many such pairs.
5252
///
53-
/// @note If more than one handler claims to handl a specific <endpoint, cluster> pair, only one of
53+
/// @note If more than one handler claims to handle a specific <endpoint, cluster> pair, only one of
5454
/// those handlers will get called when executing actions related to extension field sets on the scene
5555
/// table. It is not defined which handler will be selected.
5656

@@ -110,8 +110,7 @@ class SceneHandler : public IntrusiveListNodeBase<>
110110
///
111111
/// @param extensionFieldSet[out] ExtensionFieldSet in command format
112112
/// @return CHIP_NO_ERROR if successful, CHIP_ERROR value otherwise
113-
/// @note Only gets called after the scene-cluster has previously verified that the endpoint,cluster valuer pair is supported by
114-
/// the handler. It is therefore the implementation's reponsibility to also implement the SupportsCluster method.
113+
/// @note Only gets called for handlers for which SupportsCluster() is true for the given endpoint and cluster.
115114
virtual CHIP_ERROR Deserialize(EndpointId endpoint, ClusterId cluster, const ByteSpan & serializedBytes,
116115

117116
app::Clusters::Scenes::Structs::ExtensionFieldSet::Type & extensionFieldSet) = 0;
@@ -220,16 +219,16 @@ class SceneTable
220219

221220
bool operator==(const SceneData & other)
222221
{
223-
return (this->mNameLength == other.mNameLength && !memcmp(this->mName, other.mName, this->mNameLength) &&
224-
(this->mSceneTransitionTimeMs == other.mSceneTransitionTimeMs) &&
225-
(this->mExtensionFieldSets == other.mExtensionFieldSets));
222+
return (mNameLength == other.mNameLength && !memcmp(mName, other.mName,mNameLength) &&
223+
(mSceneTransitionTimeMs == other.mSceneTransitionTimeMs) &&
224+
(mExtensionFieldSets == other.mExtensionFieldSets));
226225
}
227226

228227
void operator=(const SceneData & other)
229228
{
230-
this->SetName(CharSpan(other.mName, other.mNameLength));
231-
this->mExtensionFieldSets = other.mExtensionFieldSets;
232-
this->mSceneTransitionTimeMs = other.mSceneTransitionTimeMs;
229+
SetName(CharSpan(other.mName, other.mNameLength));
230+
mExtensionFieldSets = other.mExtensionFieldSets;
231+
mSceneTransitionTimeMs = other.mSceneTransitionTimeMs;
233232
}
234233
};
235234

src/app/clusters/scenes/SceneTableImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace chip {
2424
namespace scenes {
2525

2626
/// @brief Tags Used to serialize Scenes so they can be stored in flash memory.
27-
/// kSceneCount: Number of scene in a Fabric
27+
/// kSceneCount: Number of scenes in a Fabric
2828
/// kStorageIDArray: Array of StorageID struct
2929
/// kEndpointID: Tag for the Endpoint ID to which this scene applies to
3030
/// kGroupID: Tag for GroupID if the Scene is a Group Scene

src/app/clusters/scenes/SceneTableImpl.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class DefaultSceneHandlerImpl : public scenes::SceneHandler
5050
/// @return CHIP_NO_ERROR if successful, CHIP_ERROR_INVALID_ARGUMENT if the cluster is not supported, CHIP_ERROR value otherwise
5151
virtual CHIP_ERROR SerializeAdd(EndpointId endpoint,
5252
const app::Clusters::Scenes::Structs::ExtensionFieldSet::DecodableType & extensionFieldSet,
53-
ClusterId & cluster, MutableByteSpan & serialisedBytes) override
53+
ClusterId & cluster, MutableByteSpan & serializedBytes) override
5454
{
5555
app::Clusters::Scenes::Structs::AttributeValuePair::DecodableType aVPair;
5656
TLV::TLVWriter writer;
@@ -93,7 +93,7 @@ class DefaultSceneHandlerImpl : public scenes::SceneHandler
9393
writer.Init(serialisedBytes);
9494
ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outer));
9595
ReturnErrorOnFailure(app::DataModel::Encode(
96-
writer, TLV::ContextTag(to_underlying(app::Clusters::Scenes::Structs::ExtensionFieldSet::Fields::kAttributeValueList)),
96+
writer, TLV::ContextTag(app::Clusters::Scenes::Structs::ExtensionFieldSet::Fields::kAttributeValueList),
9797
attributeValueList));
9898
ReturnErrorOnFailure(writer.EndContainer(outer));
9999

@@ -125,7 +125,7 @@ class DefaultSceneHandlerImpl : public scenes::SceneHandler
125125
ReturnErrorOnFailure(reader.EnterContainer(outer));
126126
ReturnErrorOnFailure(reader.Next(
127127
TLV::kTLVType_Array,
128-
TLV::ContextTag(to_underlying(app::Clusters::Scenes::Structs::ExtensionFieldSet::Fields::kAttributeValueList))));
128+
TLV::ContextTag(app::Clusters::Scenes::Structs::ExtensionFieldSet::Fields::kAttributeValueList)));
129129
attributeValueList.Decode(reader);
130130

131131
auto pair_iterator = attributeValueList.begin();

0 commit comments

Comments
 (0)