Skip to content

Commit

Permalink
Skip network provisioning for IP rendezvous
Browse files Browse the repository at this point in the history
  • Loading branch information
erjiaqing committed Nov 6, 2020
1 parent 35d58d5 commit bc0528f
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions src/transport/RendezvousSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,16 @@ void RendezvousSession::OnPairingComplete()
strlen(kSpake2pI2RSessionInfo), mSecureSession);
VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(Ble, "Failed to initialize a secure session: %s", ErrorStr(err)));

UpdateState(State::kNetworkProvisioning);
// TODO: The NetworkProvisioning is a cluster and will be done using ZCL.
// We won't do NetworkProvisioning when using RendezvousSession and UDP
if (mParams.GetPeerAddress().GetTransportType() == Transport::Type::kUdp)
{
UpdateState(State::kRendezvousComplete);
}
else
{
UpdateState(State::kNetworkProvisioning);
}
exit:
return;
}
Expand Down Expand Up @@ -320,6 +329,13 @@ void RendezvousSession::OnRendezvousMessageReceived(const PacketHeader & packetH
CHIP_ERROR err = CHIP_NO_ERROR;
// TODO: RendezvousSession should handle SecurePairing messages only

if (peerAddress.GetTransportType() == Transport::Type::kUdp)
{
// Always pass message to HandlePairingMessage for UDP transports.
err = HandlePairingMessage(packetHeader, peerAddress, msgBuf);
ExitNow();
}

switch (mCurrentState)
{
case State::kSecurePairing:
Expand Down Expand Up @@ -435,12 +451,22 @@ CHIP_ERROR RendezvousSession::Pair(Optional<NodeId> nodeId, uint32_t setupPINCod

void RendezvousSession::SendNetworkCredentials(const char * ssid, const char * passwd)
{
mNetworkProvision.SendNetworkCredentials(ssid, passwd);
// Keep using BLE for rendezvous session
// TODO: secure message including network prov should go through secure session mgr
if (mParams.GetPeerAddress().GetTransportType() == Transport::Type::kBle)
{
mNetworkProvision.SendNetworkCredentials(ssid, passwd);
}
}

void RendezvousSession::SendThreadCredentials(const DeviceLayer::Internal::DeviceNetworkInfo & threadData)
{
mNetworkProvision.SendThreadCredentials(threadData);
// Keep using BLE for rendezvous session
// TODO: secure message including network prov should go through secure session mgr
if (mParams.GetPeerAddress().GetTransportType() == Transport::Type::kBle)
{
mNetworkProvision.SendThreadCredentials(threadData);
}
}

void RendezvousSession::SendOperationalCredentials() {}
Expand Down

0 comments on commit bc0528f

Please sign in to comment.