@@ -365,34 +365,38 @@ CHIP_ERROR CodegenDataModel::WriteAttribute(const InteractionModel::WriteAttribu
365
365
366
366
Protocols::InteractionModel::Status status;
367
367
368
+ if (dataBuffer.size () > (*attributeMetadata)->size )
369
+ {
370
+ ChipLogDetail (Zcl, " Data to write exceeds the attribute size claimed." );
371
+ return CHIP_IM_GLOBAL_STATUS (InvalidValue);
372
+ }
373
+
368
374
if (request.operationFlags .Has (InteractionModel::OperationFlags::kInternal ))
369
375
{
370
376
// Internal requests use the non-External interface that has less enforcement
371
377
// than the external version (e.g. does not check/enforce writable settings, does not
372
378
// validate attribute types) - see attribute-table.h documentation for details.
373
379
status = emberAfWriteAttribute (request.path .mEndpointId , request.path .mClusterId , request.path .mAttributeId ,
374
- gEmberAttributeIOBufferSpan .data (), (*attributeMetadata)->attributeType );
380
+ dataBuffer .data (), (*attributeMetadata)->attributeType );
375
381
}
376
382
else
377
383
{
378
- if (dataBuffer.size () > (*attributeMetadata)->size )
379
- {
380
- ChipLogDetail (Zcl, " Data to write exceeds the attribute size claimed." );
381
- return CHIP_IM_GLOBAL_STATUS (InvalidValue);
382
- }
383
-
384
384
status = emAfWriteAttributeExternal (request.path .mEndpointId , request.path .mClusterId , request.path .mAttributeId ,
385
- gEmberAttributeIOBufferSpan .data (), (*attributeMetadata)->attributeType );
385
+ dataBuffer .data (), (*attributeMetadata)->attributeType );
386
386
}
387
387
388
388
if (status != Protocols::InteractionModel::Status::Success)
389
389
{
390
390
return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE (status);
391
391
}
392
392
393
- // TODO: this may need more refinement:
394
- // - should internal requests be able to decide if something is marked dirty or not?
395
- // - changes-omitted paths should not be marked dirty (ember is not aware of these)
393
+ // TODO: this WILL requre updates
394
+ //
395
+ // - Internal writes may need to be able to decide if to mark things dirty or not (see AAI as well)
396
+ // - Changes-ommited paths should not be marked dirty (ember is not aware of that flag)
397
+ // - This likely maps to `MatterReportingAttributeChangeCallback` HOWEVER current ember write functions
398
+ // will selectively call that one depending on old attribute state (i.e. calling every time is a
399
+ // change in behavior)
396
400
CurrentContext ().dataModelChangeListener ->MarkDirty (request.path );
397
401
return CHIP_NO_ERROR;
398
402
}
0 commit comments