Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to ChipTool to allow session setup for large payloads. #33937

Merged
merged 1 commit into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion examples/chip-tool/commands/clusters/ModelCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ CHIP_ERROR ModelCommand::RunCommand()
return SendCommand(commissioneeDeviceProxy, mEndPointId);
}

// Check whether the session needs to allow large payload support.
TransportPayloadCapability transportPayloadCapability =
AllowLargePayload() ? TransportPayloadCapability::kLargePayload : TransportPayloadCapability::kMRPPayload;
return CurrentCommissioner().GetConnectedDevice(mDestinationId, &mOnDeviceConnectedCallback,
&mOnDeviceConnectionFailureCallback);
&mOnDeviceConnectionFailureCallback, transportPayloadCapability);
}

void ModelCommand::OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr,
Expand Down Expand Up @@ -134,3 +137,8 @@ bool ModelCommand::IsPeerLIT()
CheckPeerICDType();
return mIsPeerLIT.ValueOr(false);
}

bool ModelCommand::AllowLargePayload()
{
return mAllowLargePayload.ValueOr(false);
}
6 changes: 6 additions & 0 deletions examples/chip-tool/commands/clusters/ModelCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class ModelCommand : public CHIPCommand
"Whether to treat the peer as a LIT ICD. false: Always no, true: Always yes, (not set): Yes if the peer is registered "
"to this controller.");
AddArgument("timeout", 0, UINT16_MAX, &mTimeout);
AddArgument("allow-large-payload", 0, 1, &mAllowLargePayload,
"If true, indicates that the session should allow large application payloads (which requires a TCP connection)."
"Defaults to false, which uses a UDP+MRP session.");
}

/////////// CHIPCommand Interface /////////
Expand All @@ -82,9 +85,12 @@ class ModelCommand : public CHIPCommand
chip::NodeId mDestinationId;
std::vector<chip::EndpointId> mEndPointId;
chip::Optional<bool> mIsPeerLIT;
chip::Optional<bool> mAllowLargePayload;

void CheckPeerICDType();

bool AllowLargePayload();

static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr,
const chip::SessionHandle & sessionHandle);
static void OnDeviceConnectionFailureFn(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR error);
Expand Down
Loading