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 BLE_API by
Diff: public/DiscoveredCharacteristic.h
- Revision:
- 488:bdba688a550f
- Parent:
- 486:bcb77e15d152
- Child:
- 492:7e0bd56f4957
diff -r 07d4423e442b -r bdba688a550f public/DiscoveredCharacteristic.h --- a/public/DiscoveredCharacteristic.h Fri Jun 19 15:52:01 2015 +0100 +++ b/public/DiscoveredCharacteristic.h Fri Jun 19 15:52:02 2015 +0100 @@ -72,7 +72,15 @@ * 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 = 0; + ble_error_t read(uint16_t offset = 0) const { + printf("DiscoveredCharacteristic::read\r\n"); + if (!props.read()) { + return BLE_ERROR_OPERATION_NOT_PERMITTED; + } + + return BLE_ERROR_NONE; + // return (ble.getGattClient())->read(connHandle, valueHandle, offset); + } /** * Perform a write without response procedure. @@ -94,7 +102,14 @@ * 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 = 0; + ble_error_t writeWoResponse(uint16_t length, const uint8_t *value) const { + if (!props.writeWoResp()) { + return BLE_ERROR_OPERATION_NOT_PERMITTED; + } + + return BLE_ERROR_NONE; + // return (ble.getGattClient())->write(BLE_GATT_OP_WRITE_CMD, connHandle, length, value); + } void setupLongUUID(UUID::LongUUIDBytes_t longUUID) { uuid.setupLong(longUUID);