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: source/nRF5xGattServer.cpp
- Revision:
- 630:435a3d9e6456
- Parent:
- 621:1d79da5c393e
diff -r f575b18563cf -r 435a3d9e6456 source/nRF5xGattServer.cpp
--- 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;
