Skip to content

Commit 1785ffc

Browse files
sgbihuyashaswini-hanji
authored andcommitted
Fix Jira 864 After BLE.end() a peripheral is still showing up in scans
1. Stop scan, advertising and disconnect the connected devices when call end Changed files BLEDeviceManager.cpp - do the real action BLEDevice.cpp - only local BLE device call the real end
1 parent 562cd84 commit 1785ffc

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

libraries/CurieBLE/src/BLEDevice.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ void BLEDevice::poll()
8585
}
8686

8787
void BLEDevice::end()
88-
{}
88+
{
89+
if (BLEUtils::isLocalBLE(*this))
90+
{
91+
BLEDeviceManager::instance()->end();
92+
}
93+
}
8994

9095
bool BLEDevice::connected() const
9196
{

libraries/CurieBLE/src/internal/BLEDeviceManager.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ void BLEDeviceManager::poll()
167167

168168
void BLEDeviceManager::end()
169169
{
170+
stopScanning();
171+
stopAdvertising();
172+
// Disconnect the connections
173+
disconnect(&BLE);
170174
}
171175

172176
bool BLEDeviceManager::connected(const BLEDevice *device) const

0 commit comments

Comments
 (0)