Skip to content

Commit

Permalink
Disable advertising once commissioned
Browse files Browse the repository at this point in the history
  • Loading branch information
mspang committed Aug 22, 2020
1 parent 81aa3ea commit 59ea5af
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_THREAD_IPP
#define GENERIC_CONNECTIVITY_MANAGER_IMPL_THREAD_IPP

#include <platform/internal/BLEManager.h>
#include <platform/internal/CHIPDeviceLayerInternal.h>
#include <platform/internal/GenericConnectivityManagerImpl_Thread.h>
#include <support/CodeUtils.h>
Expand All @@ -44,6 +45,15 @@ void GenericConnectivityManagerImpl_Thread<ImplClass>::_OnPlatformEvent(const Ch
(event->Type == DeviceEventType::kThreadStateChange && event->ThreadStateChange.NetDataChanged);
const bool fabricMembershipChanged = (event->Type == DeviceEventType::kFabricMembershipChange);

#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
if (threadConnChanged || threadAddrChanged || threadNetDataChanged) {
if (ThreadStackMgr().IsThreadAttached()) {
ChipLogError(DeviceLayer, "Thread attached. Stop advertising");
BLEMgr().SetAdvertisingEnabled(false);
}
}
#endif

// If any of the above events has occurred, assess whether there's been a change in
// service connectivity via Thread.
if (threadConnChanged || threadAddrChanged || threadNetDataChanged || fabricMembershipChanged)
Expand Down

0 comments on commit 59ea5af

Please sign in to comment.