BLE test

Fork of X_NUCLEO_IDB0XA1 by ST

Revision:
216:7aa807180321
Parent:
183:3bc6d59b9c81
Child:
229:9981f62cdb1a
diff -r 926ca3e4ccce -r 7aa807180321 source/BlueNRGDevice.cpp
--- a/source/BlueNRGDevice.cpp	Fri Mar 18 12:06:37 2016 +0100
+++ b/source/BlueNRGDevice.cpp	Thu Mar 31 10:17:31 2016 +0200
@@ -142,7 +142,7 @@
 	
 	/* ToDo: Clear memory contents, reset the SD, etc. */
 	// By default, we set the device GAP role to PERIPHERAL
-	btle_init(BlueNRGGap::getInstance().getIsSetAddress(), GAP_PERIPHERAL_ROLE_IDB04A1);
+	btleInit(BlueNRGGap::getInstance().getIsSetAddress(), GAP_PERIPHERAL_ROLE_IDB04A1);
 	
 	isInitialized = true;
 	BLE::InitializationCompleteCallbackContext context = {
@@ -205,14 +205,14 @@
  
 /*!
     @brief  get GAP version
+    @brief Get the BLE stack version information
     @param[in] void
     @returns    char *
+    @returns char *
 */
 const char *BlueNRGDevice::getVersion(void)
 {
-    char *version = new char[6];
-    memcpy((void *)version, "1.0.0", 5);
-    return version;
+    return getVersionString();
 }
 
 /**************************************************************************/
@@ -251,11 +251,15 @@
  
 /**************************************************************************/
 /*!
-    @brief  shut down the the BLE device
+    @brief  shut down the BLE device
     @param[out] error if any
 */
 /**************************************************************************/
 ble_error_t  BlueNRGDevice::shutdown(void) {
+    if (!isInitialized) {
+        return BLE_ERROR_INITIALIZATION_INCOMPLETE;
+    }
+
     return reset();
 }