Skip to content

Commit

Permalink
[chip-tool] Add pairing already-discovered command
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca committed Feb 8, 2023
1 parent 4982399 commit 324f52c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
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,
};

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);
AddArgument("device-remote-ip", &mRemoteAddr);
AddArgument("device-remote-port", 0, UINT16_MAX, &mRemotePort);
AddArgument("pase-only", 0, 1, &mPaseOnly);
break;
}

switch (filterType)
Expand Down

0 comments on commit 324f52c

Please sign in to comment.