@@ -54,6 +54,7 @@ CHIP_ERROR ReadHandler::Init(Messaging::ExchangeManager * apExchangeMgr, Interac
54
54
mHoldReport = false ;
55
55
mDirty = false ;
56
56
mActiveSubscription = false ;
57
+ mIsChunkedReport = false ;
57
58
mInteractionType = aInteractionType;
58
59
mInitiatorNodeId = apExchangeContext->GetSessionHandle ().GetPeerNodeId ();
59
60
mFabricIndex = apExchangeContext->GetSessionHandle ().GetFabricIndex ();
@@ -107,6 +108,7 @@ void ReadHandler::Shutdown(ShutdownOptions aOptions)
107
108
mHoldReport = false ;
108
109
mDirty = false ;
109
110
mActiveSubscription = false ;
111
+ mIsChunkedReport = false ;
110
112
mInitiatorNodeId = kUndefinedNodeId ;
111
113
}
112
114
@@ -140,7 +142,18 @@ CHIP_ERROR ReadHandler::OnStatusResponse(Messaging::ExchangeContext * apExchange
140
142
switch (mState )
141
143
{
142
144
case HandlerState::AwaitingReportResponse:
143
- if (IsSubscriptionType ())
145
+ if (IsChunkedReport ())
146
+ {
147
+ InteractionModelEngine::GetInstance ()->GetReportingEngine ().OnReportConfirm ();
148
+ MoveToState (HandlerState::GeneratingReports);
149
+ if (mpExchangeCtx)
150
+ {
151
+ mpExchangeCtx->WillSendMessage ();
152
+ }
153
+ // Trigger ReportingEngine run for sending next chunk of data.
154
+ SuccessOrExit (err = InteractionModelEngine::GetInstance ()->GetReportingEngine ().ScheduleRun ());
155
+ }
156
+ else if (IsSubscriptionType ())
144
157
{
145
158
InteractionModelEngine::GetInstance ()->GetReportingEngine ().OnReportConfirm ();
146
159
if (IsInitialReport ())
@@ -176,10 +189,10 @@ CHIP_ERROR ReadHandler::OnStatusResponse(Messaging::ExchangeContext * apExchange
176
189
return err;
177
190
}
178
191
179
- CHIP_ERROR ReadHandler::SendReportData (System::PacketBufferHandle && aPayload)
192
+ CHIP_ERROR ReadHandler::SendReportData (System::PacketBufferHandle && aPayload, bool aMoreChunks )
180
193
{
181
194
VerifyOrReturnLogError (IsReportable (), CHIP_ERROR_INCORRECT_STATE);
182
- if (IsInitialReport ())
195
+ if (IsInitialReport () || IsChunkedReport () )
183
196
{
184
197
mSessionHandle .SetValue (mpExchangeCtx->GetSessionHandle ());
185
198
}
@@ -190,6 +203,7 @@ CHIP_ERROR ReadHandler::SendReportData(System::PacketBufferHandle && aPayload)
190
203
mpExchangeCtx->SetResponseTimeout (kImMessageTimeout );
191
204
}
192
205
VerifyOrReturnLogError (mpExchangeCtx != nullptr , CHIP_ERROR_INCORRECT_STATE);
206
+ mIsChunkedReport = aMoreChunks;
193
207
MoveToState (HandlerState::AwaitingReportResponse);
194
208
CHIP_ERROR err = mpExchangeCtx->SendMessage (Protocols::InteractionModel::MsgType::ReportData, std::move (aPayload),
195
209
Messaging::SendFlags (Messaging::SendMessageFlags::kExpectResponse ));
@@ -200,7 +214,10 @@ CHIP_ERROR ReadHandler::SendReportData(System::PacketBufferHandle && aPayload)
200
214
err = RefreshSubscribeSyncTimer ();
201
215
}
202
216
}
203
- ClearDirty ();
217
+ if (!aMoreChunks)
218
+ {
219
+ ClearDirty ();
220
+ }
204
221
return err;
205
222
}
206
223
@@ -319,20 +336,28 @@ CHIP_ERROR ReadHandler::ProcessAttributePathList(AttributePathIBs::Parser & aAtt
319
336
AttributePathIB::Parser path;
320
337
err = path.Init (reader);
321
338
SuccessOrExit (err);
322
- // TODO: Support wildcard paths here
323
339
// TODO: MEIs (ClusterId and AttributeId) have a invalid pattern instead of a single invalid value, need to add separate
324
340
// functions for checking if we have received valid values.
341
+ // TODO: Wildcard cluster id with non-global attributes or wildcard attribute paths should be rejected.
325
342
err = path.GetEndpoint (&(clusterInfo.mEndpointId ));
326
343
if (err == CHIP_NO_ERROR)
327
344
{
328
345
VerifyOrExit (!clusterInfo.HasWildcardEndpointId (), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH);
329
346
}
347
+ else if (err == CHIP_END_OF_TLV)
348
+ {
349
+ err = CHIP_NO_ERROR;
350
+ }
330
351
SuccessOrExit (err);
331
352
err = path.GetCluster (&(clusterInfo.mClusterId ));
332
353
if (err == CHIP_NO_ERROR)
333
354
{
334
355
VerifyOrExit (!clusterInfo.HasWildcardClusterId (), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH);
335
356
}
357
+ else if (err == CHIP_END_OF_TLV)
358
+ {
359
+ err = CHIP_NO_ERROR;
360
+ }
336
361
337
362
SuccessOrExit (err);
338
363
err = path.GetAttribute (&(clusterInfo.mAttributeId ));
@@ -364,7 +389,8 @@ CHIP_ERROR ReadHandler::ProcessAttributePathList(AttributePathIBs::Parser & aAtt
364
389
// if we have exhausted this container
365
390
if (CHIP_END_OF_TLV == err)
366
391
{
367
- err = CHIP_NO_ERROR;
392
+ mAttributePathExpandIterator = AttributePathExpandIterator (mpAttributeClusterInfoList);
393
+ err = CHIP_NO_ERROR;
368
394
}
369
395
370
396
exit :
0 commit comments