BLE test

Fork of X_NUCLEO_IDB0XA1 by ST

Revision:
205:2b4afe8ce1a0
Parent:
203:5b9c78101d45
Parent:
204:6a6d2f041905
Child:
209:d7cb3b3d0295
--- a/source/BlueNRGGattServer.cpp	Thu Dec 03 11:37:55 2015 +0100
+++ b/source/BlueNRGGattServer.cpp	Mon Dec 07 15:47:02 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;