@@ -238,7 +238,7 @@ class InteractionModelReports
238
238
class InteractionModelCommands
239
239
{
240
240
public:
241
- InteractionModelCommands (chip::app::CommandSender::Callback * callback) : mCallback (callback) { ResetOptions (); }
241
+ InteractionModelCommands (chip::app::CommandSender::ExtendableCallback * callback) : mCallback (callback) { ResetOptions (); }
242
242
243
243
protected:
244
244
template <class T >
@@ -255,9 +255,27 @@ class InteractionModelCommands
255
255
mCallback , device->GetExchangeManager (), mTimedInteractionTimeoutMs .HasValue (), mSuppressResponse .ValueOr (false ));
256
256
VerifyOrReturnError (commandSender != nullptr , CHIP_ERROR_NO_MEMORY);
257
257
258
+ if (mHackedBatchCommand .ValueOr (false ))
259
+ {
260
+ chip::app::CommandSender::ConfigParameters config;
261
+ auto remoteSessionParameters = device->GetSecureSession ().Value ()->GetRemoteSessionParameters ();
262
+ config.SetRemoteMaxPathsPerInvoke (remoteSessionParameters.GetMaxPathsPerInvoke ());
263
+ ReturnErrorOnFailure (commandSender->SetCommandSenderConfig (config));
264
+ }
265
+
258
266
chip::app::CommandSender::AddRequestDataParameters addRequestDataParams (mTimedInteractionTimeoutMs );
267
+ addRequestDataParams.commandRef .SetValue (1 );
259
268
// Using TestOnly AddRequestData to allow for an intentionally malformed request for server validation testing.
260
269
ReturnErrorOnFailure (commandSender->TestOnlyAddRequestDataNoTimedCheck (commandPath, value, addRequestDataParams));
270
+
271
+ if (mHackedBatchCommand .ValueOr (false ))
272
+ {
273
+ chip::app::CommandPathParams hackedCommandPath = { static_cast <chip::EndpointId>(endpointId+1 ), clusterId, commandId,
274
+ (chip::app::CommandPathFlags::kEndpointIdValid ) };
275
+ addRequestDataParams.commandRef .SetValue (2 );
276
+ ReturnErrorOnFailure (commandSender->TestOnlyAddRequestDataNoTimedCheck (hackedCommandPath, value, addRequestDataParams));
277
+ }
278
+
261
279
ReturnErrorOnFailure (commandSender->SendCommandRequest (device->GetSecureSession ().Value ()));
262
280
mCommandSender .push_back (std::move (commandSender));
263
281
@@ -302,7 +320,7 @@ class InteractionModelCommands
302
320
}
303
321
304
322
std::vector<std::unique_ptr<chip::app::CommandSender>> mCommandSender ;
305
- chip::app::CommandSender::Callback * mCallback ;
323
+ chip::app::CommandSender::ExtendableCallback * mCallback ;
306
324
307
325
InteractionModelCommands & SetTimedInteractionTimeoutMs (uint16_t timedInteractionTimeoutMs)
308
326
{
@@ -371,10 +389,12 @@ class InteractionModelCommands
371
389
mRepeatCount = chip::NullOptional;
372
390
mRepeatDelayInMs = chip::NullOptional;
373
391
mBusyWaitForMs = chip::NullOptional;
392
+ mHackedBatchCommand = chip::NullOptional;
374
393
}
375
394
376
395
chip::Optional<uint16_t > mTimedInteractionTimeoutMs ;
377
396
chip::Optional<bool > mSuppressResponse ;
397
+ chip::Optional<bool > mHackedBatchCommand ;
378
398
chip::Optional<uint16_t > mRepeatCount ;
379
399
chip::Optional<uint16_t > mRepeatDelayInMs ;
380
400
chip::Optional<uint16_t > mBusyWaitForMs ;
@@ -587,7 +607,7 @@ class InteractionModel : public InteractionModelReports,
587
607
public InteractionModelWriter,
588
608
public chip::app::ReadClient::Callback,
589
609
public chip::app::WriteClient::Callback,
590
- public chip::app::CommandSender::Callback
610
+ public chip::app::CommandSender::ExtendableCallback
591
611
{
592
612
public:
593
613
InteractionModel () : InteractionModelReports(this ), InteractionModelCommands(this ), InteractionModelWriter(this ){};
@@ -700,9 +720,8 @@ class InteractionModel : public InteractionModelReports,
700
720
void OnError (const chip::app::WriteClient * client, CHIP_ERROR error) override ;
701
721
void OnDone (chip::app::WriteClient * client) override ;
702
722
703
- // ///////// CommandSender Callback Interface /////////
704
- void OnResponse (chip::app::CommandSender * client, const chip::app::ConcreteCommandPath & path,
705
- const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override ;
706
- void OnError (const chip::app::CommandSender * client, CHIP_ERROR error) override ;
723
+ // ///////// CommandSender ExtendableCallback Interface /////////
724
+ void OnResponse (chip::app::CommandSender * client, const chip::app::CommandSender::ResponseData & responseData) override ;
725
+ void OnError (const chip::app::CommandSender * client, const chip::app::CommandSender::ErrorData & errorData) override ;
707
726
void OnDone (chip::app::CommandSender * client) override ;
708
727
};
0 commit comments