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
Diff: nRF51Gap.cpp
- Revision:
- 266:372234aa31e9
- Parent:
- 265:04673a322cf9
- Child:
- 267:b310cade274e
diff -r 04673a322cf9 -r 372234aa31e9 nRF51Gap.cpp --- a/nRF51Gap.cpp Fri Jun 19 15:55:24 2015 +0100 +++ b/nRF51Gap.cpp Fri Jun 19 15:55:24 2015 +0100 @@ -227,9 +227,27 @@ .conn_sup_timeout = 400, }; - printf("connect returns with %u\r\n", sd_ble_gap_connect(&addr, &scanParams, &connParams)); - - return BLE_ERROR_NONE; + uint32_t rc = sd_ble_gap_connect(&addr, &scanParams, &connParams); + if (rc == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } + switch (rc) { + case NRF_ERROR_INVALID_ADDR: + return BLE_ERROR_INVALID_PARAM; + case NRF_ERROR_INVALID_PARAM: + return BLE_ERROR_INVALID_PARAM; + case NRF_ERROR_INVALID_STATE: + return BLE_ERROR_INVALID_STATE; + case BLE_ERROR_GAP_INVALID_BLE_ADDR: + return BLE_ERROR_INVALID_PARAM; + case NRF_ERROR_NO_MEM: + return BLE_ERROR_NO_MEM; + case NRF_ERROR_BUSY: + return BLE_STACK_BUSY; + default: + case BLE_ERROR_GAP_WHITELIST_IN_USE: + return BLE_ERROR_UNSPECIFIED; + } }