Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
Revision 230:2c414d3240a8, committed 2014-12-03
- Comitter:
- rgrover1
- Date:
- Wed Dec 03 14:38:40 2014 +0000
- Parent:
- 229:6664b6c0e92b
- Child:
- 231:1c4a4fd961a5
- Commit message:
- Synchronized with git rev 7e9f9a05
Author: Rohit Grover
add API BLEDevice::shutdown() to purge the BLE stack of GATT and GAP state.
init() should be called before restoring state.
fixes #15.
Changed in this revision
| common/BLEDeviceInstanceBase.h | Show annotated file Show diff for this revision Revisions of this file |
| public/BLEDevice.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/common/BLEDeviceInstanceBase.h Wed Dec 03 14:38:40 2014 +0000
+++ b/common/BLEDeviceInstanceBase.h Wed Dec 03 14:38:40 2014 +0000
@@ -28,6 +28,7 @@
virtual Gap& getGap() = 0;
virtual GattServer& getGattServer() = 0;
virtual ble_error_t init(void) = 0;
+ virtual ble_error_t shutdown(void) = 0;
virtual ble_error_t reset(void) = 0;
virtual ble_error_t setTxPower(int8_t txPower) = 0;
virtual void waitForEvent(void) = 0;
@@ -43,4 +44,4 @@
*/
extern BLEDeviceInstanceBase *createBLEDeviceInstance(void);
-#endif // ifndef __BLE_DEVICE_INSTANCE_BASE__
+#endif // ifndef __BLE_DEVICE_INSTANCE_BASE__
\ No newline at end of file
--- a/public/BLEDevice.h Wed Dec 03 14:38:40 2014 +0000
+++ b/public/BLEDevice.h Wed Dec 03 14:38:40 2014 +0000
@@ -36,6 +36,11 @@
ble_error_t init();
ble_error_t reset(void);
+ /**
+ * Purge the BLE stack of GATT and GAP state. init() must be called afterwards to re-instate services and GAP state.
+ */
+ ble_error_t shutdown(void);
+
/* GAP specific APIs */
public:
/**
@@ -365,6 +370,13 @@
}
inline ble_error_t
+BLEDevice::shutdown(void)
+{
+ clearAdvertisingPayload();
+ return transport->shutdown();
+}
+
+inline ble_error_t
BLEDevice::setAddress(Gap::addr_type_t type, const Gap::address_t address)
{
return transport->getGap().setAddress(type, address);
