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.
Dependents: BLE_Acceleration_Statejudging
Fork of nRF51822 by
Revision 630:435a3d9e6456, committed 2016-04-11
- Comitter:
- vcoubard
- Date:
- Mon Apr 11 15:07:10 2016 +0100
- Parent:
- 629:f575b18563cf
- Child:
- 631:e613866d34ba
- Commit message:
- Synchronized with git rev 527cd906
Author: Vincent Coubard
Fix return value of nRF5xGattServer::write.
While fixing the return value, nRF5xGattServer::write will also return a
more meaningful result in case of faillure than just
BLE_ERROR_PARAM_OUT_OF_RANGE.
Changed in this revision
| module.json | Show annotated file Show diff for this revision Revisions of this file |
| source/nRF5xGattServer.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/module.json Fri Apr 08 12:51:32 2016 +0000
+++ b/module.json Mon Apr 11 15:07:10 2016 +0100
@@ -1,6 +1,6 @@
{
"name": "ble-nrf51822",
- "version": "2.6.0",
+ "version": "2.5.3",
"description": "Nordic stack and drivers for the mbed BLE API.",
"keywords": [
"Bluetooth",
--- a/source/nRF5xGattServer.cpp Fri Apr 08 12:51:32 2016 +0000
+++ b/source/nRF5xGattServer.cpp Mon Apr 11 15:07:10 2016 +0100
@@ -269,10 +269,28 @@
}
}
} else {
- returnValue = BLE_ERROR_INVALID_STATE; // if assert is not used
- ASSERT_INT( ERROR_NONE,
- sd_ble_gatts_value_set(connectionHandle, attributeHandle, &value),
- BLE_ERROR_PARAM_OUT_OF_RANGE );
+ uint32_t err = sd_ble_gatts_value_set(connectionHandle, attributeHandle, &value);
+ switch(err) {
+ case NRF_SUCCESS:
+ returnValue = BLE_ERROR_NONE;
+ break;
+ case NRF_ERROR_INVALID_ADDR:
+ case NRF_ERROR_INVALID_PARAM:
+ returnValue = BLE_ERROR_INVALID_PARAM;
+ break;
+ case NRF_ERROR_NOT_FOUND:
+ case NRF_ERROR_DATA_SIZE:
+ case BLE_ERROR_INVALID_CONN_HANDLE:
+ case BLE_ERROR_GATTS_INVALID_ATTR_TYPE:
+ returnValue = BLE_ERROR_PARAM_OUT_OF_RANGE;
+ break;
+ case NRF_ERROR_FORBIDDEN:
+ returnValue = BLE_ERROR_OPERATION_NOT_PERMITTED;
+ break;
+ default:
+ returnValue = BLE_ERROR_UNSPECIFIED;
+ break;
+ }
}
return returnValue;
