flesh out nRFDiscoveredCharacteristic::read()

master
Rohit Grover 2015-05-28 08:20:45 +01:00
parent 12ed0b3884
commit 2e38bb80b6
1 changed files with 13 additions and 3 deletions

View File

@ -58,9 +58,19 @@ public:
* BLE_STACK_BUSY if some client procedure already in progress.
*/
virtual ble_error_t read(uint16_t offset = 0) {
// sd_ble_gattc_read()
// SVCALL(SD_BLE_GATTC_READ, uint32_t, sd_ble_gattc_read(uint16_t conn_handle, uint16_t handle, uint16_t offset));
return BLE_ERROR_NONE;
uint32_t rc = sd_ble_gattc_read(connHandle, valueHandle, offset);
if (rc == NRF_SUCCESS) {
return BLE_ERROR_NONE;
}
switch (rc) {
case NRF_ERROR_BUSY:
return BLE_STACK_BUSY;
case BLE_ERROR_INVALID_CONN_HANDLE:
case NRF_ERROR_INVALID_STATE:
case NRF_ERROR_INVALID_ADDR:
default:
return BLE_ERROR_INVALID_STATE;
}
}
};