@@ -282,33 +282,31 @@ void ClusterStateCacheT<CanEnableDataCaching>::OnReportEnd()
282
282
mCallback .OnReportEnd ();
283
283
}
284
284
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
287
287
{
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);
303
291
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 ;
307
295
}
308
- else
296
+
297
+ if (!attributeState->template Is <AttributeData>())
309
298
{
310
299
return CHIP_ERROR_KEY_NOT_FOUND;
311
300
}
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;
312
310
}
313
311
314
312
template <bool CanEnableDataCaching>
0 commit comments