library for BLE_GAP_backpack

Dependencies:   nrf51-sdk

Fork of nRF51822 by Nordic Semiconductor

Revision:
459:98c44deafc70
Parent:
458:b42881afcc6e
Child:
461:1f352d938a33
--- a/source/nRF5xn.cpp	Mon Nov 02 09:05:11 2015 +0000
+++ b/source/nRF5xn.cpp	Mon Nov 02 09:05:11 2015 +0000
@@ -16,6 +16,7 @@
 
 #include "mbed.h"
 #include "nRF5xn.h"
+#include "ble/blecommon.h"
 #include "nrf_soc.h"
 
 #include "btle/btle.h"
@@ -48,6 +49,10 @@
 
 const char *nRF5xn::getVersion(void)
 {
+    if (!initialized) {
+        return "INITIALIZATION_INCOMPLETE";
+    }
+
     static char versionString[32];
     static bool versionFetched = false;
 
@@ -95,6 +100,10 @@
 
 ble_error_t nRF5xn::shutdown(void)
 {
+    if (!initialized) {
+        return BLE_ERROR_INITIALIZATION_INCOMPLETE;
+    }
+
     return (softdevice_handler_sd_disable() == NRF_SUCCESS) ? BLE_ERROR_NONE : BLE_STACK_BUSY;
 }