Merge branch 'master_hyx'
This commit is contained in:
commit
93cbbb7ae7
@ -346,7 +346,7 @@ class BlueManage {
|
||||
if (isAddEquipment == false) {
|
||||
//取消缓存直接使用,存在配对场景设备信息会更变
|
||||
startScan(10, (List<ScanResult> scanDevices) {
|
||||
_connectDevice(devicesList, deviceName, connectStateCallBack,
|
||||
_connectDevice(scanDevices, deviceName, connectStateCallBack,
|
||||
isAddEquipment: isAddEquipment);
|
||||
});
|
||||
} else {
|
||||
@ -364,6 +364,7 @@ class BlueManage {
|
||||
(d.device.platformName == deviceName) ||
|
||||
(d.advertisementData.advName == deviceName));
|
||||
|
||||
ScanResult? scanResult;//使用局部变量防止出现缓存
|
||||
if (knownDeviceIndex >= 0) {
|
||||
// 存在的时候赋值
|
||||
connectDeviceMacAddress =
|
||||
@ -380,7 +381,7 @@ class BlueManage {
|
||||
}
|
||||
// AppLog.log("1 connectDeviceId:$connectDeviceMacAddress connectDeviceName:$connectDeviceName");
|
||||
// stopScan();
|
||||
if (connectDeviceMacAddress.isEmpty) {
|
||||
if (scanResult == null ||connectDeviceMacAddress.isEmpty) {
|
||||
// connectStateCallBack(BluetoothConnectionState.disconnected!);
|
||||
return;
|
||||
}
|
||||
@ -388,7 +389,7 @@ class BlueManage {
|
||||
// AppLog.log("调用了停止扫描的方法");
|
||||
await stopScan();
|
||||
|
||||
if ((scanResult!.advertisementData.serviceUuids[0].toString()[31] == "0") &&
|
||||
if ((scanResult.advertisementData.serviceUuids[0].toString()[31] == "0") &&
|
||||
isAddEquipment == false) {
|
||||
connectStateCallBack(BluetoothConnectionState.disconnected);
|
||||
EasyLoading.showToast("该锁已被重置".tr, duration: 2000.milliseconds);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user