From 4190762d94e05e6c51e25e2743f8d622848d0945 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 12 Jan 2015 20:02:37 -0800 Subject: [PATCH] Add opportunistic ble scan mode. (1/2) Bug: 19003667 Change-Id: Ibed7e9ec604cb11a58736d168d3d19ece53fc77a (cherry picked from commit 7508ddf8b53bf350a3424ef71f1ce62ea17006b8) --- core/java/android/bluetooth/le/ScanSettings.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/java/android/bluetooth/le/ScanSettings.java b/core/java/android/bluetooth/le/ScanSettings.java index 7eae4398e59d..5bdfdb544c44 100644 --- a/core/java/android/bluetooth/le/ScanSettings.java +++ b/core/java/android/bluetooth/le/ScanSettings.java @@ -25,6 +25,15 @@ import android.os.Parcelable; * parameters for the scan. */ public final class ScanSettings implements Parcelable { + + /** + * A special Bluetooth LE scan mode. Applications using this scan mode will passively listen for + * other scan results without starting BLE scans themselves. + * + * @hide + */ + public static final int SCAN_MODE_OPPORTUNISTIC = -1; + /** * Perform Bluetooth LE scan in low power mode. This is the default scan mode as it consumes the * least power. @@ -177,7 +186,7 @@ public final class ScanSettings implements Parcelable { * @throws IllegalArgumentException If the {@code scanMode} is invalid. */ public Builder setScanMode(int scanMode) { - if (scanMode < SCAN_MODE_LOW_POWER || scanMode > SCAN_MODE_LOW_LATENCY) { + if (scanMode < SCAN_MODE_OPPORTUNISTIC || scanMode > SCAN_MODE_LOW_LATENCY) { throw new IllegalArgumentException("invalid scan mode " + scanMode); } mScanMode = scanMode; -- 2.11.0