add API BLEDevice::shutdown() to purge the BLE stack of GATT and GAP state.

init() should be called before restoring state.

fixes #15.
This commit is contained in:
Rohit Grover 2014-12-03 11:44:10 +00:00
parent ac3a548eff
commit 7e9f9a0530
2 changed files with 13 additions and 0 deletions

View file

@ -28,6 +28,7 @@ public:
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;

View file

@ -36,6 +36,11 @@ public:
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:
/**
@ -364,6 +369,13 @@ BLEDevice::reset(void)
return transport->reset();
}
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)
{