@Test @Config(sdk = Build.VERSION_CODES.KITKAT) public void startScanWithUuidsOnKitkat() { BluetoothAdapter testAdapter = Mockito.mock(BluetoothAdapter.class); Mockito.when(testAdapter.startLeScan(Mockito.<BluetoothAdapter.LeScanCallback>any())).thenReturn(true); LolipopLEScanner scanner = new LolipopLEScanner(TEST_CONFIGURATION); scanner.onStart(testAdapter, 0); Mockito.verify(testAdapter, Mockito.only()).startLeScan(Mockito.<BluetoothAdapter.LeScanCallback>any()); }
@Override @SuppressWarnings({"SpellCheckingInspection", "deprecation"}) protected void onStart(BluetoothAdapter adapter, int scanMode) { boolean ret; UUID uuids[] = scannerConfiguration.getServiceUUIDs(); if (uuids.length > 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ret = adapter.startLeScan(uuids, callback); } else { ret = adapter.startLeScan(callback); } if (ret) { NeatleLogger.d("Bluetooth LE scan started."); } else { NeatleLogger.i("Bluetooth LE scan failed to start. State = " + adapter.getState()); } }
LolipopLEScanner extends BaseScanner { @Override @SuppressWarnings({"SpellCheckingInspection", "deprecation"}) protected void onStart(BluetoothAdapter adapter, int scanMode) { boolean ret; UUID uuids[] = scannerConfiguration.getServiceUUIDs(); if (uuids.length > 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ret = adapter.startLeScan(uuids, callback); } else { ret = adapter.startLeScan(callback); } if (ret) { NeatleLogger.d("Bluetooth LE scan started."); } else { NeatleLogger.i("Bluetooth LE scan failed to start. State = " + adapter.getState()); } } }
LolipopLEScanner extends BaseScanner { @Override @SuppressWarnings({"SpellCheckingInspection", "deprecation"}) protected void onStart(BluetoothAdapter adapter, int scanMode) { boolean ret; UUID uuids[] = scannerConfiguration.getServiceUUIDs(); if (uuids.length > 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ret = adapter.startLeScan(uuids, callback); } else { ret = adapter.startLeScan(callback); } if (ret) { NeatleLogger.d("Bluetooth LE scan started."); } else { NeatleLogger.i("Bluetooth LE scan failed to start. State = " + adapter.getState()); } } LolipopLEScanner(ScannerConfiguration settings); }
LolipopLEScanner extends BaseScanner { @Override @SuppressWarnings({"SpellCheckingInspection", "deprecation"}) protected void onStart(BluetoothAdapter adapter, int scanMode) { boolean ret; UUID uuids[] = scannerConfiguration.getServiceUUIDs(); if (uuids.length > 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ret = adapter.startLeScan(uuids, callback); } else { ret = adapter.startLeScan(callback); } if (ret) { NeatleLogger.d("Bluetooth LE scan started."); } else { NeatleLogger.i("Bluetooth LE scan failed to start. State = " + adapter.getState()); } } LolipopLEScanner(ScannerConfiguration settings);  }
LolipopLEScanner extends BaseScanner { @Override @SuppressWarnings({"SpellCheckingInspection", "deprecation"}) protected void onStart(BluetoothAdapter adapter, int scanMode) { boolean ret; UUID uuids[] = scannerConfiguration.getServiceUUIDs(); if (uuids.length > 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ret = adapter.startLeScan(uuids, callback); } else { ret = adapter.startLeScan(callback); } if (ret) { NeatleLogger.d("Bluetooth LE scan started."); } else { NeatleLogger.i("Bluetooth LE scan failed to start. State = " + adapter.getState()); } } LolipopLEScanner(ScannerConfiguration settings);   }