BleScanner extends ScanCallback { public synchronized boolean start() { Log.d(TAG, "start: " + ThreadUtils.currentThreadToString()); if (mState == State.NOT_STARTED) { if (mBluetoothLeScanner != null) { try { mBluetoothLeScanner.startScan(mScanFilters, mScanSettings, this); Log.d(TAG, "start: scan started"); setState(State.RUNNING, true); } catch (Exception e) { Log.e(TAG, "start: Failed to start: " + e.getMessage(), e); } } else { Log.e(TAG, "start: No BLE scanner instance"); } } else { Log.d(TAG, "start: Already running"); } return (mState != State.NOT_STARTED); } BleScanner(Listener listener, BluetoothAdapter bluetoothAdapter);  BleScanner(Listener listener, BluetoothAdapter bluetoothAdapter,
                      ScanSettings.Builder builder, DiscoveryManagerSettings settings); boolean isStarted(); synchronized boolean start(); synchronized void stop(boolean notifyStateChanged); void clearScanFilters(); void addScanFilter(ScanFilter scanFilter); void setScanSettings(ScanSettings scanSettings); @TargetApi(23) void applyAdditionalMarshmallowSettings(ScanSettings.Builder scanSettingsBuilder); @Override void onBatchScanResults(List<ScanResult> scanResults); @Override void onScanFailed(int errorCode); @Override void onScanResult(int callbackType, ScanResult scanResult);  }
@Ignore("https: @Test public void testStart() throws Exception { assertThat("It returns true when the BLE scanning is started", mBleScanner.start(), is(true)); verify(mMockBluetoothLeScanner, times(1)).startScan(mMockScanFilters, mMockScanSettings, mBleScanner); verify(mMockListener, times(1)).onIsScannerStartedChanged(true); assertThat("It should return true as the scanner is either starting or running", mBleScanner.isStarted(), is(true)); reset(mMockBluetoothLeScanner); assertThat("It should return true as scanning is already started", mBleScanner.start(), is(true)); verify(mMockBluetoothLeScanner, never()).startScan(any(List.class), any(ScanSettings.class), any(BleScanner.class)); }