Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
Revision 586:533fd7fdb0fe, committed 2016-01-11
- Comitter:
- vcoubard
- Date:
- Mon Jan 11 10:19:29 2016 +0000
- Parent:
- 585:3775ab44cb4a
- Child:
- 587:596071444447
- Commit message:
- Synchronized with git rev 7f02a2d5
Author: Andres Amaya Garcia
Add check for return code of ble_init
Changed in this revision
source/btle/btle.cpp | Show annotated file Show diff for this revision Revisions of this file |
source/nRF5xn.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/source/btle/btle.cpp Mon Jan 11 10:19:28 2016 +0000 +++ b/source/btle/btle.cpp Mon Jan 11 10:19:29 2016 +0000 @@ -118,9 +118,7 @@ ASSERT_STATUS( softdevice_ble_evt_handler_set(btle_handler)); ASSERT_STATUS( softdevice_sys_evt_handler_set(sys_evt_dispatch)); - btle_gap_init(); - - return ERROR_NONE; + return btle_gap_init(); } static void btle_handler(ble_evt_t *p_ble_evt)
--- a/source/nRF5xn.cpp Mon Jan 11 10:19:28 2016 +0000 +++ b/source/nRF5xn.cpp Mon Jan 11 10:19:29 2016 +0000 @@ -95,6 +95,20 @@ return versionString; } +/**************************************************************************/ +/*! + @brief Initialize the BLE stack. + + @returns ble_error_t + + @retval BLE_ERROR_NONE if everything executed properly and + BLE_ERROR_ALREADY_INITIALIZED if the stack has already + been initialized (possibly through a call to nRF5xn::init(). + BLE_ERROR_INTERNAL_STACK_FAILURE is returned if initialization + of the internal stack (SoftDevice) failed. + +*/ +/**************************************************************************/ ble_error_t nRF5xn::init(BLE::InstanceID_t instanceID, FunctionPointerWithContext<BLE::InitializationCompleteCallbackContext *> callback) { if (initialized) { @@ -109,7 +123,9 @@ instanceID = instanceID; /* ToDo: Clear memory contents, reset the SD, etc. */ - btle_init(); + if (btle_init() != ERROR_NONE) { + return BLE_ERROR_INTERNAL_STACK_FAILURE; + } initialized = true; BLE::InitializationCompleteCallbackContext context = {