BLE_API wrapper library for STMicroelectronics' BlueNRG Bluetooth Low Energy expansion board shield

Fork of X_NUCLEO_IDB0XA1 by ST Expansion SW Team

Revision:
219:9981f62cdb1a
Parent:
206:7aa807180321
Child:
231:b94d080127c7
--- a/source/BlueNRGDevice.cpp	Tue Apr 26 14:44:54 2016 +0200
+++ b/source/BlueNRGDevice.cpp	Mon May 16 17:22:03 2016 +0200
@@ -159,9 +159,9 @@
     @brief  Resets the BLE HW, removing any existing services and
             characteristics
     @param[in] void
-    @returns    ble_error_t
+    @returns    void
 */
-ble_error_t BlueNRGDevice::reset(void)
+void BlueNRGDevice::reset(void)
 {
     wait_us(500);
 
@@ -173,10 +173,7 @@
 
     /* Wait for the radio to come back up */
     wait_us(500);
-    
-    isInitialized = false;
 
-    return BLE_ERROR_NONE;
 }
 
 /*!
@@ -260,7 +257,34 @@
         return BLE_ERROR_INITIALIZATION_INCOMPLETE;
     }
 
-    return reset();
+    /* Reset the BlueNRG device first */
+    reset();
+
+    /* Shutdown the BLE API and BlueNRG glue code */
+    ble_error_t error;
+
+    /* GattServer instance */
+    error = BlueNRGGattServer::getInstance().reset();
+    if (error != BLE_ERROR_NONE) {
+       return error;
+    }
+
+    /* GattClient instance */
+    error = BlueNRGGattClient::getInstance().reset();
+    if (error != BLE_ERROR_NONE) {
+        return error;
+    }
+
+    /* Gap instance */
+    error = BlueNRGGap::getInstance().reset();
+    if (error != BLE_ERROR_NONE) {
+        return error;
+    }
+
+    isInitialized = false;
+
+    return BLE_ERROR_NONE;
+
 }
 																							
 /**