tset

Fork of X_NUCLEO_IDB0XA1 by ST

Branch:
a38223e17a624c1ac4d9e2589f363d2e202f12a5
Revision:
262:a3460768f3b7
Parent:
259:323f588e5f57
Child:
278:a5209d8cfd61
--- a/source/BlueNRGGattClient.cpp	Thu Sep 15 10:51:23 2016 +0100
+++ b/source/BlueNRGGattClient.cpp	Thu Sep 15 10:51:24 2016 +0100
@@ -72,6 +72,13 @@
   }
 
   if(_currentState == GATT_CHAR_DESC_DISCOVERY) {
+      if(charDescTerminationCallback != NULL) {
+         CharacteristicDescriptorDiscovery::TerminationCallbackParams_t params = {
+                                   _characteristic,
+                                   BLE_ERROR_NONE
+         };
+         charDescTerminationCallback(&params);
+       }
     _currentState = GATT_IDLE;
   }
 
@@ -711,8 +718,12 @@
 
   offset = 0;
 
+  PRINTF("\r\ncharacteristic descriptor discovered: data length %u, format %u\r\n",
+    event_data_length, format);
+
+
   for (i=0; i<numCharacDesc; i++) {
-    attHandle = handle_uuid_pair[offset];
+    memcpy(&attHandle, handle_uuid_pair + offset, sizeof(attHandle));
 
     // UUID Type
     if (handle_uuid_length == 4) {
@@ -751,15 +762,6 @@
 
     offset += handle_uuid_length;
   }
-
-  if(charDescTerminationCallback != NULL) {
-     CharacteristicDescriptorDiscovery::TerminationCallbackParams_t params = {
-                               _characteristic,
-                               BLE_ERROR_NONE
-     };
-     charDescTerminationCallback(&params);
-   }
-
 }
 
 ble_error_t BlueNRGGattClient::discoverCharacteristicDescriptors(
@@ -780,7 +782,7 @@
   GattAttribute::Handle_t valueHandle = characteristic.getValueHandle();
   GattAttribute::Handle_t lastHandle = characteristic.getLastHandle();
 
-  PRINTF("Starting aci_gatt_disc_all_charac_descriptors...\n\r");
+  PRINTF("Starting aci_gatt_disc_all_charac_descriptors... [%u : %u]\n\r", valueHandle, lastHandle);
   ret = aci_gatt_disc_all_charac_descriptors(connHandle, valueHandle, lastHandle);
 
   if (ret == BLE_STATUS_SUCCESS) {