abc

Fork of BLE_API by Bluetooth Low Energy

Revision:
394:598368c24bbb
Parent:
392:3201f029c2eb
Child:
395:4124520c17fc
--- a/public/BLEDevice.h	Wed May 13 08:51:09 2015 +0100
+++ b/public/BLEDevice.h	Wed May 13 08:51:09 2015 +0100
@@ -250,12 +250,14 @@
      *
      * @Note: The scan interval and window are recommendations to the BLE stack.
      */
-    ble_error_t setScanParams(uint16_t interval = GapScanningParams::SCAN_INTERVAL_MAX,
-                              uint16_t window   = GapScanningParams::SCAN_WINDOW_MAX,
-                              uint16_t timeout  = 0);
+    ble_error_t setScanParams(uint16_t interval       = GapScanningParams::SCAN_INTERVAL_MAX,
+                              uint16_t window         = GapScanningParams::SCAN_WINDOW_MAX,
+                              uint16_t timeout        = 0,
+                              bool     activeScanning = false);
     ble_error_t setScanInterval(uint16_t interval);
     ble_error_t setScanWindow  (uint16_t window);
     ble_error_t setScanTimeout (uint16_t timeout);
+    void        setActiveScan(bool activeScanning);
 
     /**
      * Start scanning (Observer Procedure) based on the scan-params currently
@@ -745,11 +747,12 @@
 }
 
 inline ble_error_t
-BLEDevice::setScanParams(uint16_t interval, uint16_t window, uint16_t timeout) {
+BLEDevice::setScanParams(uint16_t interval, uint16_t window, uint16_t timeout, bool activeScanning) {
     ble_error_t rc;
     if (((rc = scanningParams.setInterval(interval)) == BLE_ERROR_NONE) &&
         ((rc = scanningParams.setWindow(window))     == BLE_ERROR_NONE) &&
         ((rc = scanningParams.setTimeout(timeout))   == BLE_ERROR_NONE)) {
+        scanningParams.setActiveScanning(activeScanning);
         return BLE_ERROR_NONE;
     }
 
@@ -772,6 +775,11 @@
     return scanningParams.setTimeout(timeout);
 }
 
+inline void
+BLEDevice::setActiveScan(bool activeScanning) {
+    return scanningParams.setActiveScanning(activeScanning);
+}
+
 inline ble_error_t
 BLEDevice::startScan(Gap::AdvertisementReportCallback_t callback) {
     return transport->getGap().startScan(scanningParams, callback);