project
Fork of X_NUCLEO_IDB0XA1 by
Diff: source/BlueNRGGattServer.cpp
- Revision:
- 204:6a6d2f041905
- Parent:
- 202:caf4864292c1
- Child:
- 205:2b4afe8ce1a0
- Child:
- 207:b9df918d6d5a
--- a/source/BlueNRGGattServer.cpp Thu Dec 03 10:25:12 2015 +0100 +++ b/source/BlueNRGGattServer.cpp Mon Dec 07 15:44:42 2015 +0100 @@ -254,16 +254,21 @@ @endcode */ /**************************************************************************/ -ble_error_t BlueNRGGattServer::readValue(uint16_t charHandle, uint8_t buffer[], uint16_t *const lengthP) +ble_error_t BlueNRGGattServer::read(GattAttribute::Handle_t charHandle, uint8_t buffer[], uint16_t *lengthP) { - PRINTF("ReadValue() Not Supported\n\r"); + tBleStatus ret; + + ret = aci_gatt_read_handle_value(charHandle+CHAR_VALUE_OFFSET, *lengthP, lengthP, buffer); - /* avoid compiler warnings about unused variables */ - (void)charHandle; - (void)buffer; - (void)lengthP; - - return BLE_ERROR_NONE; + if(ret == BLE_STATUS_SUCCESS) { + return BLE_ERROR_NONE; + } + switch (ret) { + case ERR_INVALID_HCI_CMD_PARAMS: + return BLE_ERROR_INVALID_PARAM; + default: + return BLE_ERROR_UNSPECIFIED; + } } /**************************************************************************/ @@ -292,7 +297,7 @@ */ /**************************************************************************/ // <<<ANDREA>>> -ble_error_t BlueNRGGattServer::readValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP) { +ble_error_t BlueNRGGattServer::read(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP) { /* avoid compiler warnings about unused variables */ (void)connectionHandle;