Takeshi Wada / X_NUCLEO_IDB0XA1

Fork of X_NUCLEO_IDB0XA1 by ST

Files at this revision

API Documentation at this revision

Comitter:
Andrea Palmieri
Date:
Thu Dec 03 11:37:55 2015 +0100
Parent:
191:d22cc4715b0c
Parent:
202:caf4864292c1
Child:
205:2b4afe8ce1a0
Commit message:
Merge branch 'master' of https://github.com/ARMmbed/ble-x-nucleo-idb0xa1 into mbed_classic

Changed in this revision

source/BlueNRGGap.cpp 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
x-nucleo-idb0xa1/BlueNRGGap.h Show annotated file Show diff for this revision Revisions of this file
--- a/module.json	Fri Nov 20 16:59:49 2015 +0100
+++ b/module.json	Thu Dec 03 11:37:55 2015 +0100
@@ -1,8 +1,14 @@
 {
   "name": "x-nucleo-idb0xa1",
-  "version": "1.1.1",
+  "version": "1.1.3",
   "description": "ST driver for the mbed BLE API.",
   "keywords": [
+    "expansion",
+    "board",
+    "x-nucleo",
+    "nucleo",
+    "ST",
+    "STM",
     "Bluetooth",
     "BLE"
   ],
@@ -26,7 +32,6 @@
   ],
   "dependencies": {
     "mbed-drivers": ">=0.11.3",
-    "mbed-hal": "^1.0.0",
-    "ble": "^2.0.0"
+    "ble": "^2.1.7"
   }
 }
--- a/source/BlueNRGGap.cpp	Fri Nov 20 16:59:49 2015 +0100
+++ b/source/BlueNRGGap.cpp	Thu Dec 03 11:37:55 2015 +0100
@@ -468,9 +468,9 @@
         }
       }
 
-      // If ADV Data Type is MANUFACTURER SPECIFIC, then the TxP is set implicitly
-      // (i.e., w/o calling setTxPower()
-      if(txPowerAdType || AdvData[1]==AD_TYPE_MANUFACTURER_SPECIFIC_DATA) {
+      // If ADV Data Type is SERVICE DATA or MANUFACTURER SPECIFIC DATA,
+      // we need to delete it to make the needed room in ADV payload
+      if(AdvData[1]==AD_TYPE_SERVICE_DATA || AdvData[1]==AD_TYPE_MANUFACTURER_SPECIFIC_DATA) {
         PRINTF("!!!calling aci_gap_delete_ad_type(AD_TYPE_TX_POWER_LEVEL)!!!\n");
         ret = aci_gap_delete_ad_type(AD_TYPE_TX_POWER_LEVEL);
         if (BLE_STATUS_SUCCESS!=ret){
@@ -1207,12 +1207,13 @@
     tBleStatus ret;
     
     int8_t enHighPower = 0;
-    int8_t paLevel = 0;    
-#ifdef DEBUG
+    int8_t paLevel = 0;
+
     int8_t dbmActuallySet = getHighPowerAndPALevelValue(txPower, enHighPower, paLevel);
-#else
+
+#ifndef DEBUG
     /* avoid compiler warnings about unused variables */
-    (void)txPower;
+    (void)dbmActuallySet;
 #endif
     
     PRINTF("txPower=%d, dbmActuallySet=%d\n\r", txPower, dbmActuallySet);
@@ -1221,8 +1222,7 @@
     if(ret!=BLE_STATUS_SUCCESS) {
       return BLE_ERROR_UNSPECIFIED;
     }
-    
-    txPowerAdType = true;
+
     return BLE_ERROR_NONE;
 }
 
--- a/source/BlueNRGGattServer.cpp	Fri Nov 20 16:59:49 2015 +0100
+++ b/source/BlueNRGGattServer.cpp	Thu Dec 03 11:37:55 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	Fri Nov 20 16:59:49 2015 +0100
+++ b/source/platform/btle.cpp	Thu Dec 03 11:37:55 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);
             }
         } 
--- a/x-nucleo-idb0xa1/BlueNRGGap.h	Fri Nov 20 16:59:49 2015 +0100
+++ b/x-nucleo-idb0xa1/BlueNRGGap.h	Thu Dec 03 11:37:55 2015 +0100
@@ -166,8 +166,6 @@
 
     uint8_t *local_name;
     uint8_t local_name_length;
-    
-    bool txPowerAdType;
 
     uint8_t servUuidlength;
     uint8_t servUuidData[UUID_BUFFER_SIZE];