Skip to content

Commit

Permalink
Add rendezvous mode ethernet in example chip-tool (project-chip#5733)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjzander-signify committed Apr 1, 2021
1 parent ebc41b5 commit 6dc0266
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/chip-tool/commands/pairing/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ class PairSoftAP : public PairingCommand
PairSoftAP() : PairingCommand("softap", PairingMode::SoftAP) {}
};

class Ethernet : public PairingCommand
{
public:
Ethernet() : PairingCommand("ethernet", PairingMode::Ethernet) {}
};

void registerCommandsPairing(Commands & commands)
{
const char * clusterName = "Pairing";
Expand All @@ -53,6 +59,7 @@ void registerCommandsPairing(Commands & commands)
make_unique<PairBypass>(),
make_unique<PairBle>(),
make_unique<PairSoftAP>(),
make_unique<Ethernet>(),
};

commands.Register(clusterName, clusterCommands);
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 @@ -60,6 +60,9 @@ CHIP_ERROR PairingCommand::RunInternal(NodeId remoteId)
case PairingMode::SoftAP:
err = Pair(remoteId, PeerAddress::UDP(mRemoteAddr.address, mRemotePort));
break;
case PairingMode::Ethernet:
err = Pair(remoteId, PeerAddress::UDP(mRemoteAddr.address, mRemotePort));
break;
}
WaitForResponse(kWaitDurationInSeconds);

Expand Down
7 changes: 7 additions & 0 deletions examples/chip-tool/commands/pairing/PairingCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ enum class PairingMode
Bypass,
Ble,
SoftAP,
Ethernet,
};

class PairingCommand : public Command, public chip::Controller::DevicePairingDelegate
Expand Down Expand Up @@ -55,6 +56,12 @@ class PairingCommand : public Command, public chip::Controller::DevicePairingDel
AddArgument("device-remote-ip", &mRemoteAddr);
AddArgument("device-remote-port", 0, UINT16_MAX, &mRemotePort);
break;
case PairingMode::Ethernet:
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);
break;
}
}

Expand Down

0 comments on commit 6dc0266

Please sign in to comment.