package com.afunx.ble.blelitelib.scanner; import android.bluetooth.BluetoothAdapter; import android.bluetooth.le.BluetoothLeScanner; import android.bluetooth.le.ScanCallback; import android.util.Log; import java.util.UUID; /* loaded from: classes.dex */ public class BleScanner { private static final String TAG = "BlueScanner"; private static BluetoothAdapter getAdapter() { return BluetoothAdapter.getDefaultAdapter(); } public static boolean startLeScan(UUID[] uuidArr, BluetoothAdapter.LeScanCallback leScanCallback) { BluetoothAdapter adapter = getAdapter(); if (adapter != null) { return adapter.startLeScan(uuidArr, leScanCallback); } Log.e(TAG, "This hardware not support bluetooth!"); return false; } public static boolean startScan(ScanCallback scanCallback) { BluetoothAdapter adapter = getAdapter(); if (adapter == null) { Log.e(TAG, "This hardware not support bluetooth!"); return false; } BluetoothLeScanner bluetoothLeScanner = adapter.getBluetoothLeScanner(); if (bluetoothLeScanner == null) { Log.e(TAG, "The bluetooth is disabled!"); return false; } bluetoothLeScanner.startScan(scanCallback); return true; } public static boolean stopLeScan(BluetoothAdapter.LeScanCallback leScanCallback) { BluetoothAdapter adapter = getAdapter(); if (adapter == null) { Log.e(TAG, "This hardware not support bluetooth!"); return false; } adapter.stopLeScan(leScanCallback); return true; } public static boolean stopScan(ScanCallback scanCallback) { BluetoothAdapter adapter = getAdapter(); if (adapter == null) { Log.e(TAG, "This hardware not support bluetooth!"); return false; } BluetoothLeScanner bluetoothLeScanner = adapter.getBluetoothLeScanner(); if (bluetoothLeScanner == null) { Log.e(TAG, "The bluetooth is disabled!"); return false; } bluetoothLeScanner.stopScan(scanCallback); return true; } public static boolean startLeScan(BluetoothAdapter.LeScanCallback leScanCallback) { BluetoothAdapter adapter = getAdapter(); if (adapter == null) { Log.e(TAG, "This hardware not support bluetooth!"); return false; } return adapter.startLeScan(leScanCallback); } }