Java Code Examples for no.nordicsemi.android.support.v18.scanner.BluetoothLeScannerCompat#stopScan()

The following examples show how to use no.nordicsemi.android.support.v18.scanner.BluetoothLeScannerCompat#stopScan() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BleScanner.java    From Bluefruit_LE_Connect_Android_V2 with MIT License 5 votes vote down vote up
public synchronized void stop() {
    if (mIsScanning) {
        BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
        scanner.stopScan(mScanCallback);
        mIsScanning = false;
        BleScannerListener listener = mWeakListener.get();
        if (listener != null) {
            listener.onScanStatusChanged(false);
        }
    }
}
 
Example 2
Source File: NrfMeshRepository.java    From Android-nRF-Mesh-Library with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * stop scanning for bluetooth devices.
 */
private void stopScan() {
    mHandler.removeCallbacks(mScannerTimeout);
    final BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
    scanner.stopScan(scanCallback);
    mIsScanning = false;
}
 
Example 3
Source File: ScannerFragment.java    From Android-nRF-Beacon-for-Eddystone with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Stop scan if user tap Cancel button
 */
private void stopScan() {
	if (mIsScanning) {
		mScanButton.setText(R.string.scanner_action_scan);

		final BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
		scanner.stopScan(scanCallback);

		mIsScanning = false;
	}
}
 
Example 4
Source File: ScannerViewModel.java    From Android-nRF-Blinky with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Stop scanning for bluetooth devices.
 */
public void stopScan() {
	if (scannerStateLiveData.isScanning() && scannerStateLiveData.isBluetoothEnabled()) {
		final BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
		scanner.stopScan(scanCallback);
		scannerStateLiveData.scanningStopped();
	}
}
 
Example 5
Source File: DevicesAdapter.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void stopLeScan() {
	if (!scanning)
		return;

	final BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
	scanner.stopScan(scanCallback);

	handler.removeCallbacks(stopScanTask);
	scanning = false;
	notifyItemChanged(devices.size());
}
 
Example 6
Source File: ScannerFragment.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Stop scan if user tap Cancel button
 */
private void stopScan() {
	if (scanning) {
		scanButton.setText(R.string.scanner_action_scan);

		final BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
		scanner.stopScan(scanCallback);

		scanning = false;
	}
}
 
Example 7
Source File: ScannerFragment.java    From Android-nRF-Beacon with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Stop scan if user tap Cancel button
 */
private void stopScan() {
	if (mIsScanning) {
		mScanButton.setText(R.string.scanner_action_scan);

		final BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
		scanner.stopScan(scanCallback);

		mIsScanning = false;
	}
}
 
Example 8
Source File: ScannerRepository.java    From Android-nRF-Mesh-Library with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * stop scanning for bluetooth devices.
 */
public void stopScan() {
    final BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
    scanner.stopScan(mScanCallbacks);
    mScannerStateLiveData.scanningStopped();
}
 
Example 9
Source File: ScannerViewModel.java    From mcumgr-android with Apache License 2.0 4 votes vote down vote up
/**
 * Stop scanning for Bluetooth LE devices.
 */
public void stopScan() {
    final BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
    scanner.stopScan(scanCallback);
    mScannerStateLiveData.scanningStopped();
}