PBL mbed final

Fork of nRF51822 by Shuta Nakamae

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Tue Aug 11 15:14:23 2015 +0100
Parent:
417:d79a89cccddd
Child:
419:2656c0c1c9b5
Commit message:
Synchronized with git rev 2c011097
Author: Rohit Grover
Merge pull request #38 from jpbrucker/s110_compat

Disable GattClient features when using S110 SoftDevice

Changed in this revision

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.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
--- a/source/btle/btle.cpp	Tue Aug 11 15:14:23 2015 +0100
+++ b/source/btle/btle.cpp	Tue Aug 11 15:14:23 2015 +0100
@@ -107,7 +107,9 @@
 
     dm_ble_evt_handler(p_ble_evt);
 
+#if !defined(MCU_NORDIC_16K_S110) && !defined(MCU_NORDIC_32K_S110)
     bleGattcEventHandler(p_ble_evt);
+#endif
 
     /* Custom event handler */
     switch (p_ble_evt->header.evt_id) {
--- a/source/btle/btle_discovery.cpp	Tue Aug 11 15:14:23 2015 +0100
+++ b/source/btle/btle_discovery.cpp	Tue Aug 11 15:14:23 2015 +0100
@@ -17,6 +17,7 @@
 #include "nRF5xServiceDiscovery.h"
 #include "nRF5xGattClient.h"
 
+#if !defined(MCU_NORDIC_16K_S110) && !defined(MCU_NORDIC_32K_S110)
 void bleGattcEventHandler(const ble_evt_t *p_ble_evt)
 {
     nRF5xServiceDiscovery &sdSingleton = nRF5xGattClient::getInstance().discovery;
@@ -95,3 +96,4 @@
     sdSingleton.progressCharacteristicDiscovery();
     sdSingleton.progressServiceDiscovery();
 }
+#endif
--- a/source/nRF5xGap.h	Tue Aug 11 15:14:23 2015 +0100
+++ b/source/nRF5xGap.h	Tue Aug 11 15:14:23 2015 +0100
@@ -80,6 +80,8 @@
         return BLE_ERROR_UNSPECIFIED;
     }
 
+/* Observer role is not supported by S110, return BLE_ERROR_NOT_IMPLEMENTED */
+#if !defined(MCU_NORDIC_16K_S110) && !defined(MCU_NORDIC_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). */
@@ -104,6 +106,7 @@
 
         return BLE_STACK_BUSY;
     }
+#endif
 
 private:
     /**
--- a/source/nRF5xGattClient.cpp	Tue Aug 11 15:14:23 2015 +0100
+++ b/source/nRF5xGattClient.cpp	Tue Aug 11 15:14:23 2015 +0100
@@ -22,6 +22,7 @@
     return nRFGattClientSingleton;
 }
 
+#if !defined(MCU_NORDIC_16K_S110) && !defined(MCU_NORDIC_32K_S110)
 ble_error_t
 nRF5xGattClient::launchServiceDiscovery(Gap::Handle_t                               connectionHandle,
                                         ServiceDiscovery::ServiceCallback_t         sc,
@@ -30,4 +31,5 @@
                                         const UUID                                 &matchingCharacteristicUUIDIn)
 {
     return discovery.launch(connectionHandle, sc, cc, matchingServiceUUIDIn, matchingCharacteristicUUIDIn);
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file
--- a/source/nRF5xGattClient.h	Tue Aug 11 15:14:23 2015 +0100
+++ b/source/nRF5xGattClient.h	Tue Aug 11 15:14:23 2015 +0100
@@ -26,6 +26,12 @@
     static nRF5xGattClient &getInstance();
 
     /**
+     * When using S110, all Gatt client features will return
+     * BLE_ERROR_NOT_IMPLEMENTED
+     */
+#if !defined(MCU_NORDIC_16K_S110) && !defined(MCU_NORDIC_32K_S110)
+
+    /**
      * Launch service discovery. Once launched, service discovery will remain
      * active with callbacks being issued back into the application for matching
      * services/characteristics. isActive() can be used to determine status; and
@@ -152,6 +158,8 @@
 
 private:
     nRF5xServiceDiscovery discovery;
+
+#endif // if !S110
 };
 
 #endif // ifndef __NRF51822_GATT_CLIENT_H__
\ No newline at end of file