Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: microbit-dal microbit-dal microbit-ble-open microbit-dal ... more
Fork of BLE_API by
Diff: public/BLEDevice.h
- Revision:
- 380:2109a08c311c
- Parent:
- 371:6c73b5970f2d
- Child:
- 383:7bd527ea7280
--- a/public/BLEDevice.h Wed May 13 08:51:07 2015 +0100
+++ b/public/BLEDevice.h Wed May 13 08:51:07 2015 +0100
@@ -20,6 +20,7 @@
#include "blecommon.h"
#include "Gap.h"
#include "GattServer.h"
+#include "GapScanningParams.h"
#include "BLEDeviceInstanceBase.h"
/**
@@ -232,6 +233,36 @@
ble_error_t stopAdvertising(void);
/**
+ * Setup parameters for GAP scanning--i.e. observer mode.
+ * @param interval Scan interval (in milliseconds) [valid values lie between 2.5ms and 10.24s].
+ * @param window Scan Window (in milliseconds) [valid values lie between 2.5ms and 10.24s].
+ * @param timeout Scan timeout (in seconds) between 0x0001 and 0xFFFF, 0x0000 disables timeout.
+ */
+ ble_error_t setScanningParams(uint16_t interval = GapScanningParams::SCAN_INTERVAL_MAX,
+ uint16_t window = GapScanningParams::SCAN_WINDOW_MAX,
+ uint16_t timeout = 0);
+ ble_error_t setScanningInterval(uint16_t interval);
+ ble_error_t setScanningWindow(uint16_t window);
+ ble_error_t setScanningTimeout(uint16_t timeout);
+
+ /**
+ * Start scanning (Observer Procedure) based on the scan-params currently
+ * in effect.
+ *
+ * @param callback The application callback to be invoked upon receiving
+ * every advertisement report. Can be passed in as NULL, in which case
+ * scanning may not be enabled at all.
+ */
+ ble_error_t startScanning(Gap::AdvertisementReportCallback_t callback);
+
+ /**
+ * Stop scanning. The current scanning parameters remain in effect.
+ *
+ * @retval BLE_ERROR_NONE if successfully stopped scanning procedure.
+ */
+ ble_error_t stopScanning(void);
+
+ /**
* This call initiates the disconnection procedure, and its completion will
* be communicated to the application with an invocation of the
* onDisconnection callback.
@@ -544,6 +575,8 @@
* eventually result in a call to the target's setAdvertisingData() before
* the server begins advertising. This flag marks the status of the pending update.*/
bool needToSetAdvPayload;
+
+ GapScanningParams scanningParams;
};
/* BLEDevice methods. Most of these simply forward the calls to the underlying
