From ac9d04a400b8b514f5ac42743571dcd936d036d7 Mon Sep 17 00:00:00 2001 From: Robert Alfaro Date: Mon, 20 Jan 2020 06:31:12 -0800 Subject: [PATCH] Add BLEDevice::stopAdvertising() helper method to compliment startAdvertising(). (#3624) --- libraries/BLE/src/BLEDevice.cpp | 6 ++++++ libraries/BLE/src/BLEDevice.h | 1 + 2 files changed, 7 insertions(+) diff --git a/libraries/BLE/src/BLEDevice.cpp b/libraries/BLE/src/BLEDevice.cpp index 345b8257..128ede98 100644 --- a/libraries/BLE/src/BLEDevice.cpp +++ b/libraries/BLE/src/BLEDevice.cpp @@ -578,6 +578,12 @@ void BLEDevice::startAdvertising() { log_v("<< startAdvertising"); } // startAdvertising +void BLEDevice::stopAdvertising() { + log_v(">> stopAdvertising"); + getAdvertising()->stop(); + log_v("<< stopAdvertising"); +} // stopAdvertising + /* multi connect support */ /* requires a little more work */ std::map BLEDevice::getPeerDevices(bool _client) { diff --git a/libraries/BLE/src/BLEDevice.h b/libraries/BLE/src/BLEDevice.h index cbba54e3..4ecdf04c 100644 --- a/libraries/BLE/src/BLEDevice.h +++ b/libraries/BLE/src/BLEDevice.h @@ -50,6 +50,7 @@ public: /* move advertising to BLEDevice for saving ram and flash in beacons */ static BLEAdvertising* getAdvertising(); static void startAdvertising(); + static void stopAdvertising(); static uint16_t m_appId; /* multi connect */ static std::map getPeerDevices(bool client);