Skip to content

Commit

Permalink
[chip-tool] Add pairing already-discovered command (#24917)
Browse files Browse the repository at this point in the history
* [chip-tool] Add pairing already-discovered command

* Address review comments

* Use PairingNetworkType::None instead of PairingNetworkType::Network
  • Loading branch information
yufengwangca authored and pull[bot] committed Sep 20, 2023
1 parent 25ab99b commit b88a5d5
Show file tree
Hide file tree
Showing 3 changed files with 20 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::None, 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
3 changes: 3 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 Down
8 changes: 8 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 Down Expand Up @@ -106,6 +107,13 @@ 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("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 b88a5d5

Please sign in to comment.