Skip to content

Commit bf9b1ef

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 bf9b1ef

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

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

+16-1
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ 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 =
49+
AllowLargePayload() ? TransportPayloadCapability::kLargePayload : TransportPayloadCapability::kMRPPayload;
4750
return CurrentCommissioner().GetConnectedDevice(mDestinationId, &mOnDeviceConnectedCallback,
48-
&mOnDeviceConnectionFailureCallback);
51+
&mOnDeviceConnectionFailureCallback, transportPayloadCapability);
4952
}
5053

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

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

+7
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ 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(
61+
"allow-large-payload", 0, 1, &mAllowLargePayload,
62+
"Indicates if the session should allow large application payloads. When true, the controller tries to establish a "
63+
"secure session over TCP. Otherwise session is established over MRP. Assumed to be false when not specified.");
6064
}
6165

6266
/////////// CHIPCommand Interface /////////
@@ -82,9 +86,12 @@ class ModelCommand : public CHIPCommand
8286
chip::NodeId mDestinationId;
8387
std::vector<chip::EndpointId> mEndPointId;
8488
chip::Optional<bool> mIsPeerLIT;
89+
chip::Optional<bool> mAllowLargePayload;
8590

8691
void CheckPeerICDType();
8792

93+
bool AllowLargePayload();
94+
8895
static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr,
8996
const chip::SessionHandle & sessionHandle);
9097
static void OnDeviceConnectionFailureFn(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR error);

0 commit comments

Comments
 (0)