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_ANCS_SDAPI BLE_temperature BLE_HeartRate writable_gatt ... more
Diff: nRFDiscoveredCharacteristic.h
- Revision:
- 326:77dd705571e2
- Parent:
- 325:eb6914dca928
- Child:
- 327:0ea2b4d48212
--- a/nRFDiscoveredCharacteristic.h Fri Jun 19 15:55:31 2015 +0100
+++ b/nRFDiscoveredCharacteristic.h Fri Jun 19 15:55:31 2015 +0100
@@ -64,9 +64,14 @@
*
* @return BLE_ERROR_NONE if a read has been initiated, else
* BLE_ERROR_INVALID_STATE if some internal state about the connection is invalid, or
- * BLE_STACK_BUSY if some client procedure already in progress.
+ * BLE_STACK_BUSY if some client procedure already in progress, or
+ * BLE_ERROR_OPERATION_NOT_PERMITTED due to the characteristic's properties.
*/
virtual ble_error_t read(uint16_t offset = 0) const {
+ if (!props.read()) {
+ return BLE_ERROR_OPERATION_NOT_PERMITTED;
+ }
+
uint32_t rc = sd_ble_gattc_read(connHandle, valueHandle, offset);
if (rc == NRF_SUCCESS) {
return BLE_ERROR_NONE;
@@ -99,9 +104,14 @@
* @retval BLE_ERROR_NONE Successfully started the Write procedure, else
* BLE_ERROR_INVALID_STATE if some internal state about the connection is invalid, or
* BLE_STACK_BUSY if some client procedure already in progress, or
- * BLE_ERROR_NO_MEM if there are no available buffers left to process the request.
+ * BLE_ERROR_NO_MEM if there are no available buffers left to process the request or
+ * BLE_ERROR_OPERATION_NOT_PERMITTED due to the characteristic's properties.
*/
virtual ble_error_t writeWoResponse(uint16_t length, const uint8_t *value) const {
+ if (!props.writeWoResp()) {
+ return BLE_ERROR_OPERATION_NOT_PERMITTED;
+ }
+
ble_gattc_write_params_t writeParams = {
.write_op = BLE_GATT_OP_WRITE_CMD,
// .flags = 0,

