本文整理汇总了Java中android.bluetooth.le.BluetoothLeScanner.stopScan方法的典型用法代码示例。如果您正苦于以下问题:Java BluetoothLeScanner.stopScan方法的具体用法?Java BluetoothLeScanner.stopScan怎么用?Java BluetoothLeScanner.stopScan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.bluetooth.le.BluetoothLeScanner
的用法示例。
在下文中一共展示了BluetoothLeScanner.stopScan方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stopScan
import android.bluetooth.le.BluetoothLeScanner; //导入方法依赖的package包/类
@Override
public void stopScan(@NonNull ScanCallback callback) {
ScanCallbackHolder holder = callbackHolderMap.get(callback);
if(holder == null) //possibly should throw an exception...
return;
BluetoothLeScanner scanner = getNativeScannerOrThrow();
scanner.stopScan(holder.getNativeCallback());
callbackHolderMap.remove(callback);
}
示例2: stopScan
import android.bluetooth.le.BluetoothLeScanner; //导入方法依赖的package包/类
@Override
public void stopScan(final ScanCallback callback) {
final ScanCallbackWrapper wrapper = mWrappers.get(callback);
if (wrapper == null)
return;
wrapper.close();
mWrappers.remove(callback);
android.bluetooth.le.ScanCallback _callback = mCallbacks.get(callback);
mCallbacks.remove(callback);
mWrappers2.remove(_callback);
final BluetoothLeScanner scanner = mBluetoothAdapter.getBluetoothLeScanner();
if (scanner == null)
return;
scanner.stopScan(_callback);
}
开发者ID:NordicSemiconductor,项目名称:Android-Scanner-Compat-Library,代码行数:19,代码来源:BluetoothLeScannerImplLollipop.java
示例3: stopScan
import android.bluetooth.le.BluetoothLeScanner; //导入方法依赖的package包/类
public static void stopScan(ScanCallback callback) {
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
if (null == adapter) {
Log.e(TAG, "BluetoothAdapter is null");
return;
}
BluetoothLeScanner scanner = adapter.getBluetoothLeScanner();
if (null == scanner) {
Log.e(TAG, "BluetoothLeScanner is null");
return;
}
scanner.stopScan(callback);
}
示例4: stopAndroidOBackgroundScan
import android.bluetooth.le.BluetoothLeScanner; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.O)
void stopAndroidOBackgroundScan() {
try {
final BluetoothManager bluetoothManager =
(BluetoothManager) mContext.getApplicationContext().getSystemService(Context.BLUETOOTH_SERVICE);
BluetoothAdapter bluetoothAdapter = bluetoothManager.getAdapter();
if (bluetoothAdapter == null) {
LogManager.w(TAG, "Failed to construct a BluetoothAdapter");
} else if (!bluetoothAdapter.isEnabled()) {
LogManager.w(TAG, "BluetoothAdapter is not enabled");
} else {
BluetoothLeScanner scanner = bluetoothAdapter.getBluetoothLeScanner();
if (scanner != null) {
scanner.stopScan(getScanCallbackIntent());
}
}
} catch (SecurityException e) {
LogManager.e(TAG, "SecurityException stopping Android O background scanner");
}
}
示例5: pause
import android.bluetooth.le.BluetoothLeScanner; //导入方法依赖的package包/类
private void pause() {
if (bluetoothAdapter != null) {
BluetoothLeScanner scanner = bluetoothAdapter.getBluetoothLeScanner();
if (scanner != null && scanCallback != null) {
scanner.stopScan(scanCallback);
}
}
}
示例6: stopLeScan
import android.bluetooth.le.BluetoothLeScanner; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void stopLeScan(ScanCallback scanCallback) {
final BluetoothLeScanner bluetoothLeScanner = bluetoothAdapter.getBluetoothLeScanner();
if (bluetoothLeScanner == null) {
RxBleLog.d("Cannot perform BluetoothLeScanner.stopScan(ScanCallback) because scanner is unavailable (Probably adapter is off)");
// if stopping the scan is not possible due to BluetoothLeScanner not accessible then it is probably stopped anyway
return;
}
bluetoothLeScanner.stopScan(scanCallback);
}
示例7: stopNativeScan
import android.bluetooth.le.BluetoothLeScanner; //导入方法依赖的package包/类
public static void stopNativeScan(BluetoothAdapter adapter) {
if (adapter == null)
{
Log.e("ScanManager", "Tried to stop the scan, but the Bluetooth Adapter instance was null!");
return;
}
final BluetoothLeScanner scanner = adapter.getBluetoothLeScanner();
if (scanner != null)
scanner.stopScan(m_callback);
else
Log.w("ScanManager", "Tried to stop the scan, but the BluetoothLeScanner instance was null. This implies the scanning has stopped already.");
}
示例8: stopScan
import android.bluetooth.le.BluetoothLeScanner; //导入方法依赖的package包/类
/**
* Stops an ongoing BLE Scan for the given callback.
*
* @param callback An instance of the BleScanCallback, used to start the scan.
*/
public void stopScan(@NonNull final BleScanCallback callback) {
if (mBluetoothAdapter == null) {
Log.w(TAG, "BluetoothAdapter not initialized or unspecified address.");
return;
}
if (mStopScanningRunnable == null) return;
mScanHandler.removeCallbacks(mStopScanningRunnable);
final BluetoothLeScanner bluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();
bluetoothLeScanner.stopScan(callback);
mStopScanningRunnable = null;
callback.onScanStopped();
}