Skip to content

Commit

Permalink
[Rendezvous] Do not turn on the WiFi SoftAP if the rendezvous mode is…
Browse files Browse the repository at this point in the history
… set to kBLE (#1481)
  • Loading branch information
vivien-apple authored Jul 7, 2020
1 parent cdb3fb7 commit 8634c55
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions examples/wifi-echo/server/esp32/main/CHIPDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "CHIPDeviceManager.h"
#include <lib/support/CodeUtils.h>
#include <setup_payload/SetupPayload.h>
#include <support/ErrorStr.h>

namespace chip {
Expand Down Expand Up @@ -55,9 +56,21 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb)
err = PlatformMgr().InitChipStack();
SuccessOrExit(err);

// Configure the CHIP Connectivity Manager to always enable the AP. The Station interface
// will be enabled automatically if the required configuration is set.
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
switch (static_cast<RendezvousInformationFlags>(CONFIG_RENDEZVOUS_MODE))
{
case RendezvousInformationFlags::kBLE:
ConnectivityMgr().SetBLEAdvertisingEnabled(ConnectivityManager::kCHIPoBLEServiceMode_Enabled);
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Disabled);
break;

case RendezvousInformationFlags::kWiFi:
ConnectivityMgr().SetBLEAdvertisingEnabled(ConnectivityManager::kCHIPoBLEServiceMode_Disabled);
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
break;

default:
break;
}

// Register a function to receive events from the CHIP device layer. Note that calls to
// this function will happen on the CHIP event loop thread, not the app_main thread.
Expand Down

0 comments on commit 8634c55

Please sign in to comment.