feature():1.修改连接的方式,增加连接速度

This commit is contained in:
lvwang2002 2024-05-15 23:35:38 +08:00
parent a7a77d34a9
commit e81b7b33e2
1 changed files with 6 additions and 3 deletions

View File

@ -7,6 +7,7 @@ import android.bluetooth.BluetoothManager;
import android.bluetooth.le.BluetoothLeScanner; import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.le.ScanCallback; import android.bluetooth.le.ScanCallback;
import android.bluetooth.le.ScanResult; import android.bluetooth.le.ScanResult;
import android.bluetooth.le.ScanSettings;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -864,7 +865,9 @@ public class BleDeviceManager {
return false; return false;
} }
//RNLog.d(TAG,"start scan:"); //RNLog.d(TAG,"start scan:");
scanner.startScan(mDeviceListener.scanCallback); //scanner.startScan(mDeviceListener.scanCallback);
ScanSettings scannerSetting = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();
scanner.startScan(null,scannerSetting,mDeviceListener.scanCallback);
return true; return true;
} }