Skip to content

Commit 647b26a

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 true Fixes #29697
1 parent 60ae46d commit 647b26a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

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

+9-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 whether 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,8 @@ bool ModelCommand::IsPeerLIT()
134137
CheckPeerICDType();
135138
return mIsPeerLIT.ValueOr(false);
136139
}
140+
141+
bool ModelCommand::AllowLargePayload()
142+
{
143+
return mAllowLargePayload.ValueOr(false);
144+
}

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+
"If true, indicates that the session should allow large application payloads (which requires a TCP connection)."
63+
"Defaults to false, which uses a UDP+MRP session.");
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)