23
23
24
24
#include < app/ClusterInfo.h>
25
25
#include < app/Command.h>
26
+ #include < app/ConcreteAttributePath.h>
26
27
#include < app/InteractionModelEngine.h>
27
28
#include < app/reporting/Engine.h>
28
29
#include < app/util/af.h>
@@ -189,21 +190,19 @@ bool ServerClusterCommandExists(const ConcreteCommandPath & aCommandPath)
189
190
return emberAfContainsServer (aCommandPath.mEndpointId , aCommandPath.mClusterId );
190
191
}
191
192
192
- CHIP_ERROR ReadSingleClusterData (ClusterInfo & aClusterInfo , TLV::TLVWriter * apWriter, bool * apDataExists)
193
+ CHIP_ERROR ReadSingleClusterData (const ConcreteAttributePath & aPath , TLV::TLVWriter * apWriter, bool * apDataExists)
193
194
{
194
195
ChipLogDetail (DataManagement,
195
- " Received Cluster Command: Cluster=" ChipLogFormatMEI " NodeId=0x" ChipLogFormatX64 " Endpoint=%" PRIx16
196
- " AttributeId=%" PRIx32 " ListIndex=%" PRIx16,
197
- ChipLogValueMEI (aClusterInfo.mClusterId ), ChipLogValueX64 (aClusterInfo.mNodeId ), aClusterInfo.mEndpointId ,
198
- aClusterInfo.mFieldId , aClusterInfo.mListIndex );
196
+ " Reading attribute: Cluster=" ChipLogFormatMEI " Endpoint=%" PRIx16 " AttributeId=" ChipLogFormatMEI,
197
+ ChipLogValueMEI (aPath.mClusterId ), aPath.mEndpointId , ChipLogValueMEI (aPath.mAttributeId ));
199
198
200
- AttributeAccessInterface * attrOverride = findAttributeAccessOverride (aClusterInfo .mEndpointId , aClusterInfo .mClusterId );
199
+ AttributeAccessInterface * attrOverride = findAttributeAccessOverride (aPath .mEndpointId , aPath .mClusterId );
201
200
if (attrOverride != nullptr )
202
201
{
203
202
// TODO: We should probably clone the writer and convert failures here
204
203
// into status responses, unless our caller already does that.
205
204
AttributeValueEncoder valueEncoder (apWriter);
206
- ReturnErrorOnFailure (attrOverride->Read (aClusterInfo , valueEncoder));
205
+ ReturnErrorOnFailure (attrOverride->Read (aPath , valueEncoder));
207
206
208
207
if (valueEncoder.TriedEncode ())
209
208
{
@@ -223,8 +222,8 @@ CHIP_ERROR ReadSingleClusterData(ClusterInfo & aClusterInfo, TLV::TLVWriter * ap
223
222
224
223
EmberAfAttributeType attributeType;
225
224
EmberAfStatus status;
226
- status = emberAfReadAttribute (aClusterInfo .mEndpointId , aClusterInfo .mClusterId , aClusterInfo. mFieldId , CLUSTER_MASK_SERVER,
227
- attributeData, sizeof (attributeData), &attributeType);
225
+ status = emberAfReadAttribute (aPath .mEndpointId , aPath .mClusterId , aPath. mAttributeId , CLUSTER_MASK_SERVER, attributeData ,
226
+ sizeof (attributeData), &attributeType);
228
227
229
228
if (apDataExists != nullptr )
230
229
{
@@ -349,9 +348,9 @@ CHIP_ERROR ReadSingleClusterData(ClusterInfo & aClusterInfo, TLV::TLVWriter * ap
349
348
ReturnErrorOnFailure (
350
349
apWriter->StartContainer (TLV::ContextTag (AttributeDataElement::kCsTag_Data ), TLV::kTLVType_List , containerType));
351
350
// TODO: Encode data in TLV, now raw buffers
352
- ReturnErrorOnFailure (apWriter-> PutBytes (
353
- TLV::AnonymousTag, attributeData,
354
- emberAfAttributeValueSize (aClusterInfo .mClusterId , aClusterInfo. mFieldId , attributeType, attributeData)));
351
+ ReturnErrorOnFailure (
352
+ apWriter-> PutBytes ( TLV::AnonymousTag, attributeData,
353
+ emberAfAttributeValueSize (aPath .mClusterId , aPath. mAttributeId , attributeType, attributeData)));
355
354
ReturnErrorOnFailure (apWriter->EndContainer (containerType));
356
355
break ;
357
356
}
0 commit comments