Skip to content

Commit

Permalink
fix: In bledriver/Scanner.java, we don't need to check the build vers…
Browse files Browse the repository at this point in the history
…ion. (Already done by the Manifest.)

Signed-off-by: jefft0 <jeff@thefirst.org>
  • Loading branch information
jefft0 committed Sep 6, 2022
1 parent f80d43e commit 1d2941e
Showing 1 changed file with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,28 +137,26 @@ public boolean start(String localPID) {
mTask = new TimerTask() {
@Override
public void run() {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
if (getScannerState() == SCANNER_STATE_ENABLED) {
mLogger.d(TAG, "stop scanning");
if (getScannerState() == SCANNER_STATE_ENABLED) {
mLogger.d(TAG, "stop scanning");
if (mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) {
mBluetoothLeScanner.stopScan(callback);
} else {
mLogger.e(TAG, "stop scanner in timer error: BT adapter not running");
}
setScannerState(SCANNER_STATE_PAUSED);

// Processing scan result
processResult();
} else {
if (!isProcessingResult()) {
mLogger.d(TAG, "start scanning");
if (mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) {
mBluetoothLeScanner.stopScan(callback);
mBluetoothLeScanner.startScan(Collections.singletonList(mScanFilter), mScanSettings, callback);
} else {
mLogger.e(TAG, "stop scanner in timer error: BT adapter not running");
}
setScannerState(SCANNER_STATE_PAUSED);

// Processing scan result
processResult();
} else {
if (!isProcessingResult()) {
mLogger.d(TAG, "start scanning");
if (mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) {
mBluetoothLeScanner.startScan(Collections.singletonList(mScanFilter), mScanSettings, callback);
} else {
mLogger.e(TAG, "start scanner in timer error: BT adapter not running");
}
setScannerState(SCANNER_STATE_ENABLED);
mLogger.e(TAG, "start scanner in timer error: BT adapter not running");
}
setScannerState(SCANNER_STATE_ENABLED);
}
}
}
Expand Down

0 comments on commit 1d2941e

Please sign in to comment.