diff --git a/lmbluetoothsdk/src/main/java/co/lujun/lmbluetoothsdk/BluetoothLEController.java b/lmbluetoothsdk/src/main/java/co/lujun/lmbluetoothsdk/BluetoothLEController.java index fa2755a..77bdd83 100755 --- a/lmbluetoothsdk/src/main/java/co/lujun/lmbluetoothsdk/BluetoothLEController.java +++ b/lmbluetoothsdk/src/main/java/co/lujun/lmbluetoothsdk/BluetoothLEController.java @@ -121,7 +121,7 @@ public boolean isSupportBLE(){ } @Override - public boolean startScan() { + public boolean startScan(UUID[] serviceUUIDs) { if (!isAvailable() && !isEnabled()){ return false; } @@ -130,12 +130,23 @@ public boolean startScan() { mLeSettings = new ScanSettings.Builder() .setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY) .build(); - mLeFilters = new ArrayList(); + mLeFilters = scanFilters(serviceUUIDs); } scanLeDevice(); return true; } + private List scanFilters(UUID[] serviceUUIDs) { + List list = new ArrayList<>(); + + for (int i = 0; i