PBL mbed final

Fork of nRF51822 by Shuta Nakamae

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Mon Nov 02 09:05:10 2015 +0000
Parent:
452:82d81b02ef87
Child:
454:56e938f7d643
Commit message:
Synchronized with git rev a9f33e16
Author: Bogdan Marinescu
Updated dependencies

Changed in this revision

module.json Show annotated file Show diff for this revision Revisions of this file
source/btle/btle.cpp Show annotated file Show diff for this revision Revisions of this file
source/btle/btle_discovery.cpp Show annotated file Show diff for this revision Revisions of this file
source/nRF5xGap.cpp Show annotated file Show diff for this revision Revisions of this file
source/nRF5xGap.h Show annotated file Show diff for this revision Revisions of this file
source/nRF5xGattClient.cpp Show annotated file Show diff for this revision Revisions of this file
source/nRF5xGattClient.h Show annotated file Show diff for this revision Revisions of this file
source/nRF5xGattServer.cpp Show annotated file Show diff for this revision Revisions of this file
source/nordic-sdk/components/softdevice/s130/include/ble_gap.h Show annotated file Show diff for this revision Revisions of this file
--- a/module.json	Mon Nov 02 09:05:10 2015 +0000
+++ b/module.json	Mon Nov 02 09:05:10 2015 +0000
@@ -4,7 +4,9 @@
   "description": "Nordic stack and drivers for the mbed BLE API.",
   "keywords": [
     "Bluetooth",
-    "BLE"
+    "BLE",
+    "mbed",
+    "mbed-official"
   ],
   "author": "Rohit Grover",
   "repository": {
@@ -19,7 +21,7 @@
     }
   ],
   "dependencies": {
-    "ble": "~0.4.7"
+    "ble": "^1.0.0"
   },
   "extraIncludes": [
     "source/btle",
--- a/source/btle/btle.cpp	Mon Nov 02 09:05:10 2015 +0000
+++ b/source/btle/btle.cpp	Mon Nov 02 09:05:10 2015 +0000
@@ -133,7 +133,7 @@
 
     dm_ble_evt_handler(p_ble_evt);
 
-#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110)
+#if !defined(MCU_NRF51_16K_S110) && !defined(MCU_NRF51_32K_S110)
     bleGattcEventHandler(p_ble_evt);
 #endif
 
@@ -141,7 +141,7 @@
     switch (p_ble_evt->header.evt_id) {
         case BLE_GAP_EVT_CONNECTED: {
             Gap::Handle_t handle = p_ble_evt->evt.gap_evt.conn_handle;
-#if defined(TARGET_MCU_NRF51_16K_S110) || defined(TARGET_MCU_NRF51_32K_S110)
+#if defined(MCU_NRF51_16K_S110) || defined(MCU_NRF51_32K_S110)
             /* Only peripheral role is supported by S110 */
             Gap::Role_t role = Gap::PERIPHERAL;
 #else
--- a/source/btle/btle_discovery.cpp	Mon Nov 02 09:05:10 2015 +0000
+++ b/source/btle/btle_discovery.cpp	Mon Nov 02 09:05:10 2015 +0000
@@ -17,7 +17,7 @@
 #include "nRF5xServiceDiscovery.h"
 #include "nRF5xGattClient.h"
 
-#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110)
+#if !defined(MCU_NRF51_16K_S110) && !defined(MCU_NRF51_32K_S110)
 void bleGattcEventHandler(const ble_evt_t *p_ble_evt)
 {
     nRF5xServiceDiscovery &sdSingleton = nRF5xGattClient::getInstance().discovery;
--- a/source/nRF5xGap.cpp	Mon Nov 02 09:05:10 2015 +0000
+++ b/source/nRF5xGap.cpp	Mon Nov 02 09:05:10 2015 +0000
@@ -233,18 +233,17 @@
     }
 
     ble_gap_scan_params_t scanParams;
+    scanParams.active      = 0;    /**< If 1, perform active scanning (scan requests). */
     scanParams.selective   = 0;    /**< If 1, ignore unknown devices (non whitelisted). */
     scanParams.p_whitelist = NULL; /**< Pointer to whitelist, NULL if none is given. */
     if (scanParamsIn != NULL) {
-        scanParams.active      = scanParamsIn->getActiveScanning();   /**< If 1, perform active scanning (scan requests). */
-        scanParams.interval    = scanParamsIn->getInterval();         /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
-        scanParams.window      = scanParamsIn->getWindow();           /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
-        scanParams.timeout     = scanParamsIn->getTimeout();          /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */
+        scanParams.interval    = scanParamsIn->getInterval(); /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
+        scanParams.window      = scanParamsIn->getWindow();   /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
+        scanParams.timeout     = scanParamsIn->getTimeout();  /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */
     } else {
-        scanParams.active      = _scanningParams.getActiveScanning(); /**< If 1, perform active scanning (scan requests). */
-        scanParams.interval    = _scanningParams.getInterval();       /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
-        scanParams.window      = _scanningParams.getWindow();         /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
-        scanParams.timeout     = _scanningParams.getTimeout();        /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */
+        scanParams.interval    = 500; /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
+        scanParams.window      = 200;   /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
+        scanParams.timeout     = 0;  /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */
     }
 
     uint32_t rc = sd_ble_gap_connect(&addr, &scanParams, &connParams);
--- a/source/nRF5xGap.h	Mon Nov 02 09:05:10 2015 +0000
+++ b/source/nRF5xGap.h	Mon Nov 02 09:05:10 2015 +0000
@@ -81,7 +81,7 @@
     }
 
 /* Observer role is not supported by S110, return BLE_ERROR_NOT_IMPLEMENTED */
-#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110)
+#if !defined(MCU_NRF51_16K_S110) && !defined(MCU_NRF51_32K_S110)
     virtual ble_error_t startRadioScan(const GapScanningParams &scanningParams) {
         ble_gap_scan_params_t scanParams = {
             .active      = scanningParams.getActiveScanning(), /**< If 1, perform active scanning (scan requests). */
--- a/source/nRF5xGattClient.cpp	Mon Nov 02 09:05:10 2015 +0000
+++ b/source/nRF5xGattClient.cpp	Mon Nov 02 09:05:10 2015 +0000
@@ -22,7 +22,7 @@
     return nRFGattClientSingleton;
 }
 
-#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110)
+#if !defined(MCU_NRF51_16K_S110) && !defined(MCU_NRF51_32K_S110)
 ble_error_t
 nRF5xGattClient::launchServiceDiscovery(Gap::Handle_t                               connectionHandle,
                                         ServiceDiscovery::ServiceCallback_t         sc,
--- a/source/nRF5xGattClient.h	Mon Nov 02 09:05:10 2015 +0000
+++ b/source/nRF5xGattClient.h	Mon Nov 02 09:05:10 2015 +0000
@@ -29,7 +29,7 @@
      * When using S110, all Gatt client features will return
      * BLE_ERROR_NOT_IMPLEMENTED
      */
-#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110)
+#if !defined(MCU_NRF51_16K_S110) && !defined(MCU_NRF51_32K_S110)
 
     /**
      * Launch service discovery. Once launched, service discovery will remain
--- a/source/nRF5xGattServer.cpp	Mon Nov 02 09:05:10 2015 +0000
+++ b/source/nRF5xGattServer.cpp	Mon Nov 02 09:05:10 2015 +0000
@@ -45,6 +45,7 @@
 /**************************************************************************/
 ble_error_t nRF5xGattServer::addService(GattService &service)
 {
+    /* ToDo: Make sure we don't overflow the array, etc. */
     /* ToDo: Make sure this service UUID doesn't already exist (?) */
     /* ToDo: Basic validation */
 
@@ -62,9 +63,6 @@
 
     /* Add characteristics to the service */
     for (uint8_t i = 0; i < service.getCharacteristicCount(); i++) {
-        if (characteristicCount >= BLE_TOTAL_CHARACTERISTICS) {
-            return BLE_ERROR_NO_MEM;
-        }
         GattCharacteristic *p_char = service.getCharacteristic(i);
 
         /* Skip any incompletely defined, read-only characteristics. */
@@ -110,11 +108,8 @@
         characteristicCount++;
 
         /* Add optional descriptors if any */
+        /* ToDo: Make sure we don't overflow the array */
         for (uint8_t j = 0; j < p_char->getDescriptorCount(); j++) {
-            if (descriptorCount >= BLE_TOTAL_DESCRIPTORS) {
-                return BLE_ERROR_NO_MEM;
-            }
-
             GattAttribute *p_desc = p_char->getDescriptor(j);
             /* skip the user-description-descriptor here; this has already been handled when adding the characteristic (above). */
             if (p_desc->getUUID() == BLE_UUID_DESCRIPTOR_CHAR_USER_DESC) {
--- a/source/nordic-sdk/components/softdevice/s130/include/ble_gap.h	Mon Nov 02 09:05:10 2015 +0000
+++ b/source/nordic-sdk/components/softdevice/s130/include/ble_gap.h	Mon Nov 02 09:05:10 2015 +0000
@@ -547,7 +547,7 @@
 {
   ble_gap_addr_t        peer_addr;              /**< Bluetooth address of the peer device. */
   ble_gap_addr_t        own_addr;               /**< Bluetooth address of the local device used during connection setup. */
-#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110)
+#if !defined(MCU_NRF51_16K_S110) && !defined(MCU_NRF51_32K_S110)
   uint8_t               role;                   /**< BLE role for this connection, see @ref BLE_GAP_ROLES */
 #endif
   uint8_t               irk_match :1;           /**< If 1, peer device's address resolved using an IRK. */