Skip to content

Commit 78d5856

Browse files
committed
Add option to ChipTool to allow session setup for large payloads.
By default, assumed false. When set to 1, it will trigger an attempt to set up a session over TCP to support large payload transfers. E.g., ./chip-tool onoff read on-off 15 2 --allow-large-payload 1 Fixes #29697
1 parent 60ae46d commit 78d5856

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

examples/chip-tool/commands/clusters/ModelCommand.cpp

+17-1
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@ CHIP_ERROR ModelCommand::RunCommand()
4444
return SendCommand(commissioneeDeviceProxy, mEndPointId);
4545
}
4646

47+
// Check if the session needs to allow large payload support.
48+
TransportPayloadCapability transportPayloadCapability = AllowLargePayload() ? TransportPayloadCapability::kLargePayload :
49+
TransportPayloadCapability::kMRPPayload;
4750
return CurrentCommissioner().GetConnectedDevice(mDestinationId, &mOnDeviceConnectedCallback,
48-
&mOnDeviceConnectionFailureCallback);
51+
&mOnDeviceConnectionFailureCallback,
52+
transportPayloadCapability);
4953
}
5054

5155
void ModelCommand::OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr,
@@ -134,3 +138,15 @@ bool ModelCommand::IsPeerLIT()
134138
CheckPeerICDType();
135139
return mIsPeerLIT.ValueOr(false);
136140
}
141+
142+
bool ModelCommand::AllowLargePayload()
143+
{
144+
if (mAllowLargePayload.HasValue())
145+
{
146+
return (mAllowLargePayload.Value());
147+
}
148+
else
149+
{
150+
return false;
151+
}
152+
}

examples/chip-tool/commands/clusters/ModelCommand.h

+5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ class ModelCommand : public CHIPCommand
5757
"Whether to treat the peer as a LIT ICD. false: Always no, true: Always yes, (not set): Yes if the peer is registered "
5858
"to this controller.");
5959
AddArgument("timeout", 0, UINT16_MAX, &mTimeout);
60+
AddArgument("allow-large-payload", 0, 1, &mAllowLargePayload,
61+
"Indicates if the session should allow large application payloads. When true, the controller tries to establish a secure session over TCP. Otherwise session is established over MRP. Assumed to be false when not specified.");
6062
}
6163

6264
/////////// CHIPCommand Interface /////////
@@ -82,9 +84,12 @@ class ModelCommand : public CHIPCommand
8284
chip::NodeId mDestinationId;
8385
std::vector<chip::EndpointId> mEndPointId;
8486
chip::Optional<bool> mIsPeerLIT;
87+
chip::Optional<bool> mAllowLargePayload;
8588

8689
void CheckPeerICDType();
8790

91+
bool AllowLargePayload();
92+
8893
static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr,
8994
const chip::SessionHandle & sessionHandle);
9095
static void OnDeviceConnectionFailureFn(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR error);

0 commit comments

Comments
 (0)