*/
private static final int LE_SCAN_INTERVAL_MS = 100;
+ /**
+ * Scan params corresponding to scan setting
+ */
+ private static final int SCAN_MODE_LOW_POWER_WINDOW_MS = 500;
+ private static final int SCAN_MODE_LOW_POWER_INTERVAL_MS = 5000;
+ private static final int SCAN_MODE_BALANCED_WINDOW_MS = 1000;
+ private static final int SCAN_MODE_BALANCED_INTERVAL_MS = 5000;
+ private static final int SCAN_MODE_LOW_LATENCY_WINDOW_MS = 2500;
+ private static final int SCAN_MODE_LOW_LATENCY_INTERVAL_MS = 5000;
+
int appIf;
boolean isServer;
UUID[] uuids;
this.scanInterval = scanInterval;
this.settings = settings;
this.filters = filters;
+ if (settings != null) {
+ switch (settings.getScanMode()) {
+ case BluetoothLeScanSettings.SCAN_MODE_LOW_POWER:
+ this.scanWindow = SCAN_MODE_LOW_POWER_WINDOW_MS;
+ this.scanInterval = SCAN_MODE_LOW_POWER_INTERVAL_MS;
+ break;
+ case BluetoothLeScanSettings.SCAN_MODE_BALANCED:
+ this.scanWindow = SCAN_MODE_BALANCED_WINDOW_MS;
+ this.scanInterval = SCAN_MODE_BALANCED_INTERVAL_MS;
+ break;
+ case BluetoothLeScanSettings.SCAN_MODE_LOW_LATENCY:
+ this.scanWindow = SCAN_MODE_LOW_LATENCY_WINDOW_MS;
+ this.scanInterval = SCAN_MODE_LOW_LATENCY_INTERVAL_MS;
+ break;
+ default:
+ this.scanWindow = SCAN_MODE_BALANCED_WINDOW_MS;
+ this.scanInterval = SCAN_MODE_BALANCED_INTERVAL_MS;
+ break;
+ }
+ }
}
}