Android Bluetooth Low Energy (BLE) Fast Development Framework. It uses simple ways to filter, scan, connect, read ,write, notify, readRssi, setMTU, and multiConnection.
recently i face weird issue on samsung device operating android 11 and 12 OS.
when i read or write command it will compare with key with below function of MultipleBluetoothController
public synchronized BleBluetooth getBleBluetooth(BleDevice bleDevice) {
if (bleDevice != null) {
if (bleLruHashMap.containsKey(bleDevice.getKey())) {
return bleLruHashMap.get(bleDevice.getKey());
}
}
return null;
}
in this bleLruHashMap has name null & mac address and in BleDevice has name & mac address. i m attaching snap for reference.
ISSUE comes very first time when i install app and after restart device first launch(It will throw 102 - device not connected default Error handle).
I have apply ScanRule as below.
-------------------------------START OF CODE----------------------------------------
val scanRuleConfig = BleScanRuleConfig.Builder()
.setServiceUuids(null)
.setDeviceName(true, "")
.setDeviceMac(SharedPref.instance!!.getValueFromPreferences(getString(R.string.pref_device_mac)))
.setAutoConnect(true)
.setScanTimeOut(18000000)
.build()
BleManager.getInstance().initScanRule(scanRuleConfig)
-----------------------------------------END OF CODE------------------------------------------------
Hi @Jasonchenlijian and @liaolintao,
recently i face weird issue on samsung device operating android 11 and 12 OS. when i read or write command it will compare with key with below function of MultipleBluetoothController
public synchronized BleBluetooth getBleBluetooth(BleDevice bleDevice) { if (bleDevice != null) { if (bleLruHashMap.containsKey(bleDevice.getKey())) { return bleLruHashMap.get(bleDevice.getKey()); } } return null; }
in this bleLruHashMap has name null & mac address and in BleDevice has name & mac address. i m attaching snap for reference. ISSUE comes very first time when i install app and after restart device first launch(It will throw 102 - device not connected default Error handle).
I have apply ScanRule as below.
-------------------------------START OF CODE---------------------------------------- val scanRuleConfig = BleScanRuleConfig.Builder() .setServiceUuids(null) .setDeviceName(true, "") .setDeviceMac(SharedPref.instance!!.getValueFromPreferences(getString(R.string.pref_device_mac))) .setAutoConnect(true) .setScanTimeOut(18000000) .build() BleManager.getInstance().initScanRule(scanRuleConfig) -----------------------------------------END OF CODE------------------------------------------------
Image Reference 1
Image Reference 2
Help Appreciated. thanks in advance.