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

[chip-tool] Add pairing already-discovered command #24917

Merged
merged 3 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 9 additions & 0 deletions examples/chip-tool/commands/pairing/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ class PairSoftAP : public PairingCommand
{}
};

class PairAlreadyDiscovered : public PairingCommand
{
public:
PairAlreadyDiscovered(CredentialIssuerCommands * credsIssuerConfig) :
PairingCommand("already-discovered", PairingMode::AlreadyDiscovered, PairingNetworkType::Ethernet, credsIssuerConfig)
{}
};

class StartUdcServerCommand : public CHIPCommand
{
public:
Expand All @@ -199,6 +207,7 @@ void registerCommandsPairing(Commands & commands, CredentialIssuerCommands * cre
make_unique<PairBleWiFi>(credsIssuerConfig),
make_unique<PairBleThread>(credsIssuerConfig),
make_unique<PairSoftAP>(credsIssuerConfig),
make_unique<PairAlreadyDiscovered>(credsIssuerConfig),
make_unique<PairOnNetwork>(credsIssuerConfig),
make_unique<PairOnNetworkShort>(credsIssuerConfig),
make_unique<PairOnNetworkLong>(credsIssuerConfig),
Expand Down
4 changes: 4 additions & 0 deletions examples/chip-tool/commands/pairing/PairingCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ CHIP_ERROR PairingCommand::RunInternal(NodeId remoteId)
case PairingMode::SoftAP:
err = Pair(remoteId, PeerAddress::UDP(mRemoteAddr.address, mRemotePort, mRemoteAddr.interfaceId));
break;
case PairingMode::AlreadyDiscovered:
err = Pair(remoteId, PeerAddress::UDP(mRemoteAddr.address, mRemotePort, mRemoteAddr.interfaceId));
break;
}

return err;
Expand All @@ -97,6 +100,7 @@ CommissioningParameters PairingCommand::GetCommissioningParameters()
case PairingNetworkType::Thread:
params.SetThreadOperationalDataset(mOperationalDataset);
break;
case PairingNetworkType::Ethernet:
case PairingNetworkType::None:
break;
}
Expand Down
11 changes: 11 additions & 0 deletions examples/chip-tool/commands/pairing/PairingCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ enum class PairingMode
CodePaseOnly,
Ble,
SoftAP,
AlreadyDiscovered,
OnNetwork,
};

Expand All @@ -42,6 +43,7 @@ enum class PairingNetworkType
None,
WiFi,
Thread,
Ethernet,
yufengwangca marked this conversation as resolved.
Show resolved Hide resolved
};

class PairingCommand : public CHIPCommand,
Expand All @@ -67,6 +69,7 @@ class PairingCommand : public CHIPCommand,
switch (networkType)
{
case PairingNetworkType::None:
case PairingNetworkType::Ethernet:
break;
case PairingNetworkType::WiFi:
AddArgument("ssid", &mSSID);
Expand Down Expand Up @@ -106,6 +109,14 @@ class PairingCommand : public CHIPCommand,
AddArgument("device-remote-port", 0, UINT16_MAX, &mRemotePort);
AddArgument("pase-only", 0, 1, &mPaseOnly);
break;
case PairingMode::AlreadyDiscovered:
AddArgument("skip-commissioning-complete", 0, 1, &mSkipCommissioningComplete);
AddArgument("setup-pin-code", 0, 134217727, &mSetupPINCode);
AddArgument("discriminator", 0, 4096, &mDiscriminator);
yufengwangca marked this conversation as resolved.
Show resolved Hide resolved
AddArgument("device-remote-ip", &mRemoteAddr);
AddArgument("device-remote-port", 0, UINT16_MAX, &mRemotePort);
AddArgument("pase-only", 0, 1, &mPaseOnly);
break;
}

switch (filterType)
Expand Down