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