Skip to content

Commit 1abc1e1

Browse files
Address review comment.
1 parent bf2cae9 commit 1abc1e1

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

src/app/ClusterStateCache.cpp

+19-21
Original file line numberDiff line numberDiff line change
@@ -282,33 +282,31 @@ void ClusterStateCacheT<CanEnableDataCaching>::OnReportEnd()
282282
mCallback.OnReportEnd();
283283
}
284284

285-
template <bool CanEnableDataCaching>
286-
CHIP_ERROR ClusterStateCacheT<CanEnableDataCaching>::Get(const ConcreteAttributePath & path, TLV::TLVReader & reader) const
285+
template <>
286+
CHIP_ERROR ClusterStateCacheT<true>::Get(const ConcreteAttributePath & path, TLV::TLVReader & reader) const
287287
{
288-
if constexpr (CanEnableDataCaching)
289-
{
290-
CHIP_ERROR err;
291-
auto attributeState = GetAttributeState(path.mEndpointId, path.mClusterId, path.mAttributeId, err);
292-
ReturnErrorOnFailure(err);
293-
294-
if (attributeState->template Is<StatusIB>())
295-
{
296-
return CHIP_ERROR_IM_STATUS_CODE_RECEIVED;
297-
}
298-
299-
if (!attributeState->template Is<AttributeData>())
300-
{
301-
return CHIP_ERROR_KEY_NOT_FOUND;
302-
}
288+
CHIP_ERROR err;
289+
auto attributeState = GetAttributeState(path.mEndpointId, path.mClusterId, path.mAttributeId, err);
290+
ReturnErrorOnFailure(err);
303291

304-
reader.Init(attributeState->template Get<AttributeData>().Get(),
305-
attributeState->template Get<AttributeData>().AllocatedSize());
306-
return reader.Next();
292+
if (attributeState->template Is<StatusIB>())
293+
{
294+
return CHIP_ERROR_IM_STATUS_CODE_RECEIVED;
307295
}
308-
else
296+
297+
if (!attributeState->template Is<AttributeData>())
309298
{
310299
return CHIP_ERROR_KEY_NOT_FOUND;
311300
}
301+
302+
reader.Init(attributeState->template Get<AttributeData>().Get(), attributeState->template Get<AttributeData>().AllocatedSize());
303+
return reader.Next();
304+
}
305+
306+
template <>
307+
CHIP_ERROR ClusterStateCacheT<false>::Get(const ConcreteAttributePath & path, TLV::TLVReader & reader) const
308+
{
309+
return CHIP_ERROR_KEY_NOT_FOUND;
312310
}
313311

314312
template <bool CanEnableDataCaching>

0 commit comments

Comments
 (0)