X_NUCLEO_IDB05A1

Dependencies:   mbed-os-example-ble-Advertising

Files at this revision

API Documentation at this revision

Comitter:
Andrea Palmieri
Date:
Thu Dec 03 10:25:12 2015 +0100
Parent:
201:a9bc2e8b01d7
Child:
203:5b9c78101d45
Child:
204:6a6d2f041905
Commit message:
Align with BLE API v2.1.7

Signed-off-by: Andrea Palmieri <andrea.palmieri@st.com>

Changed in this revision

module.json Show annotated file Show diff for this revision Revisions of this file
source/BlueNRGGattServer.cpp Show annotated file Show diff for this revision Revisions of this file
source/platform/btle.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/module.json	Thu Dec 03 10:24:19 2015 +0100
+++ b/module.json	Thu Dec 03 10:25:12 2015 +0100
@@ -32,6 +32,6 @@
   ],
   "dependencies": {
     "mbed-drivers": ">=0.11.3",
-    "ble": "^2.0.0"
+    "ble": "^2.1.7"
   }
 }
--- a/source/BlueNRGGattServer.cpp	Thu Dec 03 10:24:19 2015 +0100
+++ b/source/BlueNRGGattServer.cpp	Thu Dec 03 10:25:12 2015 +0100
@@ -196,8 +196,8 @@
         p_char->getValueAttribute().setHandle(bleCharacteristic);    //Set the characteristic count as the corresponding char handle
         PRINTF("added bleCharacteristic handle =%u\n\r", bleCharacteristic);
 
-        if ((p_char->getValueAttribute().getValuePtr() != NULL) && (p_char->getValueAttribute().getInitialLength() > 0)) {
-            write(p_char->getValueAttribute().getHandle(), p_char->getValueAttribute().getValuePtr(), p_char->getValueAttribute().getInitialLength(), false /* localOnly */);
+        if ((p_char->getValueAttribute().getValuePtr() != NULL) && (p_char->getValueAttribute().getLength() > 0)) {
+            write(p_char->getValueAttribute().getHandle(), p_char->getValueAttribute().getValuePtr(), p_char->getValueAttribute().getLength(), false /* localOnly */);
         }
 
         // add descriptors now
@@ -209,7 +209,7 @@
             uint16_t shortUUID = descriptor->getUUID().getShortUUID();
             const uint8_t uuidArray[] = {(uint8_t)((shortUUID>>8)&0xFF), (uint8_t)((shortUUID&0xFF))};
             ret = aci_gatt_add_char_desc(service.getHandle(), p_char->getValueAttribute().getHandle(), 
-            CHAR_DESC_TYPE_16_BIT, uuidArray, descriptor->getMaxLength(), descriptor->getInitialLength(), 
+            CHAR_DESC_TYPE_16_BIT, uuidArray, descriptor->getMaxLength(), descriptor->getLength(),
             descriptor->getValuePtr(), CHAR_DESC_SECURITY_PERMISSION, CHAR_DESC_ACCESS_PERMISSION, GATT_NOTIFY_ATTRIBUTE_WRITE,
             MIN_ENCRY_KEY_SIZE, CHAR_ATTRIBUTE_LEN_IS_FIXED, &descHandle);
             PRINTF("Adding Descriptor descriptor handle=%d ret=%d\n\r", descHandle, ret);
--- a/source/platform/btle.cpp	Thu Dec 03 10:24:19 2015 +0100
+++ b/source/platform/btle.cpp	Thu Dec 03 10:25:12 2015 +0100
@@ -285,7 +285,7 @@
 
             //BlueNRGGattServer::getInstance().handleEvent(GattServerEvents::GATT_EVENT_DATA_WRITTEN, evt->attr_handle);
             //Write the actual Data to the Attr Handle? (uint8_1[])att_data contains the data
-            if ((p_char->getValueAttribute().getValuePtr() != NULL) && (p_char->getValueAttribute().getInitialLength() > 0)) {
+            if ((p_char->getValueAttribute().getValuePtr() != NULL) && (p_char->getValueAttribute().getLength() > 0)) {
                 BlueNRGGattServer::getInstance().write(p_char->getValueAttribute().getHandle(), (uint8_t*)att_data, data_length, false);
             }
         }