BLE test

Fork of X_NUCLEO_IDB0XA1 by ST

Revision:
229:9981f62cdb1a
Parent:
216:7aa807180321
Child:
242:058b2e731adc
Child:
245:6830f71c197c
--- 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;
+
 }
 																							
 /**