@@ -36,10 +36,12 @@ using namespace Protocols::InteractionModel;
36
36
using Status = Protocols::InteractionModel::Status;
37
37
constexpr uint8_t kListAttributeType = 0x48 ;
38
38
39
- CHIP_ERROR WriteHandler::Init ()
39
+ CHIP_ERROR WriteHandler::Init (WriteHandlerDelegate * apWriteHandlerDelegate )
40
40
{
41
41
VerifyOrReturnError (!mExchangeCtx , CHIP_ERROR_INCORRECT_STATE);
42
+ VerifyOrReturnError (apWriteHandlerDelegate, CHIP_ERROR_INVALID_ARGUMENT);
42
43
44
+ mDelegate = apWriteHandlerDelegate;
43
45
MoveToState (State::Initialized);
44
46
45
47
mACLCheckCache .ClearValue ();
@@ -241,7 +243,8 @@ CHIP_ERROR WriteHandler::DeliverFinalListWriteEndForGroupWrite(bool writeWasSucc
241
243
242
244
processingConcreteAttributePath.mEndpointId = mapping.endpoint_id ;
243
245
244
- if (!InteractionModelEngine::GetInstance ()->HasConflictWriteRequests (this , processingConcreteAttributePath))
246
+ VerifyOrReturnError (mDelegate , CHIP_ERROR_INCORRECT_STATE);
247
+ if (!mDelegate ->HasConflictWriteRequests (this , processingConcreteAttributePath))
245
248
{
246
249
DeliverListWriteEnd (processingConcreteAttributePath, writeWasSuccessful);
247
250
}
@@ -306,7 +309,8 @@ CHIP_ERROR WriteHandler::ProcessAttributeDataIBs(TLV::TLVReader & aAttributeData
306
309
dataAttributePath.mListOp = ConcreteDataAttributePath::ListOperation::ReplaceAll;
307
310
}
308
311
309
- if (InteractionModelEngine::GetInstance ()->HasConflictWriteRequests (this , dataAttributePath) ||
312
+ VerifyOrExit (mDelegate , err = CHIP_ERROR_INCORRECT_STATE);
313
+ if (mDelegate ->HasConflictWriteRequests (this , dataAttributePath) ||
310
314
// Per chunking protocol, we are processing the list entries, but the initial empty list is not processed, so we reject
311
315
// it with Busy status code.
312
316
(dataAttributePath.IsListItemOperation () && !IsSameAttribute (mProcessingAttributePath , dataAttributePath)))
@@ -458,13 +462,15 @@ CHIP_ERROR WriteHandler::ProcessGroupAttributeDataIBs(TLV::TLVReader & aAttribut
458
462
{
459
463
auto processingConcreteAttributePath = mProcessingAttributePath .Value ();
460
464
processingConcreteAttributePath.mEndpointId = mapping.endpoint_id ;
461
- if (!InteractionModelEngine::GetInstance ()->HasConflictWriteRequests (this , processingConcreteAttributePath))
465
+ VerifyOrExit (mDelegate , err = CHIP_ERROR_INCORRECT_STATE);
466
+ if (mDelegate ->HasConflictWriteRequests (this , processingConcreteAttributePath))
462
467
{
463
468
DeliverListWriteEnd (processingConcreteAttributePath, true /* writeWasSuccessful */ );
464
469
}
465
470
}
466
471
467
- if (InteractionModelEngine::GetInstance ()->HasConflictWriteRequests (this , dataAttributePath))
472
+ VerifyOrExit (mDelegate , err = CHIP_ERROR_INCORRECT_STATE);
473
+ if (mDelegate ->HasConflictWriteRequests (this , dataAttributePath))
468
474
{
469
475
ChipLogDetail (DataManagement,
470
476
" Writing attribute endpoint=%u Cluster=" ChipLogFormatMEI " attribute=" ChipLogFormatMEI
0 commit comments