From 4ddc0faae55247c68d5084bda9ba687fd17f714a Mon Sep 17 00:00:00 2001 From: Kevin Schoedel <67607049+kpschoedel@users.noreply.github.com> Date: Wed, 29 Jul 2020 10:53:05 -0400 Subject: [PATCH] Use WiFi credentials from Rendezvous BLE message (#1898) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For this first draft, SSID and key are separated by ‘:’. This will need to change since any character including ‘:’ can appear in an SSID or password. --- examples/wifi-echo/server/esp32/main/RendezvousSession.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/wifi-echo/server/esp32/main/RendezvousSession.cpp b/examples/wifi-echo/server/esp32/main/RendezvousSession.cpp index 8095ddc9550f30..4c26fd09383ba9 100644 --- a/examples/wifi-echo/server/esp32/main/RendezvousSession.cpp +++ b/examples/wifi-echo/server/esp32/main/RendezvousSession.cpp @@ -23,6 +23,8 @@ using namespace ::chip; +extern CHIP_ERROR SetWiFiStationProvisioning(char * ssid, char * key); + BluetoothWidget * RendezvousSession::mVirtualLed; Ble::BLEEndPoint * RendezvousSession::mEndPoint = nullptr; @@ -79,5 +81,8 @@ void RendezvousSession::HandleMessageReceived(Ble::BLEEndPoint * endPoint, Packe ChipLogProgress(Ble, "RendezvousSession: Receive message: %s", msg); - mEndPoint->Send(buffer); + char * ssid = strtok(msg, ":"); + char * key = strtok(NULL, ":"); + ChipLogProgress(Ble, "RendezvousSession: SSID: %s, key: %s", ssid, key); + SetWiFiStationProvisioning(ssid, key); }