fix:SKY环境下注释该锁已被重置的弹窗
This commit is contained in:
parent
ea96419e05
commit
d75754e14e
@ -5,6 +5,7 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
|||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_settings.dart';
|
import 'package:star_lock/app_settings/app_settings.dart';
|
||||||
|
import 'package:star_lock/flavors.dart';
|
||||||
import 'package:star_lock/tools/bugly/bugly_tool.dart';
|
import 'package:star_lock/tools/bugly/bugly_tool.dart';
|
||||||
import 'package:star_lock/tools/commonDataManage.dart';
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
|
|
||||||
@ -551,7 +552,10 @@ class BlueManage {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
connectStateCallBack(BluetoothConnectionState.disconnected);
|
connectStateCallBack(BluetoothConnectionState.disconnected);
|
||||||
EasyLoading.showToast('该锁已被重置'.tr, duration: 2000.milliseconds);
|
if (!F.isSKY) {
|
||||||
|
EasyLoading.showToast('该锁已被重置'.tr, duration: 2000.milliseconds);
|
||||||
|
}
|
||||||
|
|
||||||
scanDevices.clear();
|
scanDevices.clear();
|
||||||
|
|
||||||
BuglyTool.uploadException(
|
BuglyTool.uploadException(
|
||||||
@ -582,7 +586,9 @@ class BlueManage {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
connectStateCallBack(BluetoothConnectionState.disconnected);
|
connectStateCallBack(BluetoothConnectionState.disconnected);
|
||||||
EasyLoading.showToast('该锁已被重置'.tr, duration: 2000.milliseconds);
|
if (!F.isSKY) {
|
||||||
|
EasyLoading.showToast('该锁已被重置'.tr, duration: 2000.milliseconds);
|
||||||
|
}
|
||||||
scanDevices.clear();
|
scanDevices.clear();
|
||||||
|
|
||||||
BuglyTool.uploadException(
|
BuglyTool.uploadException(
|
||||||
@ -801,22 +807,27 @@ class BlueManage {
|
|||||||
while (!packetSent && retryCount < maxRetries) {
|
while (!packetSent && retryCount < maxRetries) {
|
||||||
try {
|
try {
|
||||||
if (characteristic.properties.writeWithoutResponse) {
|
if (characteristic.properties.writeWithoutResponse) {
|
||||||
await characteristic.write(subData[i], withoutResponse: true);
|
await characteristic.write(subData[i],
|
||||||
|
withoutResponse: true);
|
||||||
} else if (characteristic.properties.write) {
|
} else if (characteristic.properties.write) {
|
||||||
await characteristic.write(subData[i]);
|
await characteristic.write(subData[i]);
|
||||||
} else {
|
} else {
|
||||||
// 特性不支持写入
|
// 特性不支持写入
|
||||||
throw Exception('This characteristic does not support writing.');
|
throw Exception(
|
||||||
|
'This characteristic does not support writing.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果到这里没有异常,则包发送成功
|
// 如果到这里没有异常,则包发送成功
|
||||||
packetSent = true;
|
packetSent = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.toString().contains('UNKNOWN_GATT_ERROR (133)') && retryCount < maxRetries - 1) {
|
if (e.toString().contains('UNKNOWN_GATT_ERROR (133)') &&
|
||||||
|
retryCount < maxRetries - 1) {
|
||||||
// GATT错误133,尝试重试
|
// GATT错误133,尝试重试
|
||||||
retryCount++;
|
retryCount++;
|
||||||
AppLog.log('蓝牙写入失败(GATT 133),数据包 ${i+1}/${subData.length} 正在重试 $retryCount/$maxRetries...');
|
AppLog.log(
|
||||||
await Future.delayed(Duration(milliseconds: retryDelayMs));
|
'蓝牙写入失败(GATT 133),数据包 ${i + 1}/${subData.length} 正在重试 $retryCount/$maxRetries...');
|
||||||
|
await Future.delayed(
|
||||||
|
Duration(milliseconds: retryDelayMs));
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
// 其他错误或已达到最大重试次数,抛出异常
|
// 其他错误或已达到最大重试次数,抛出异常
|
||||||
@ -827,7 +838,8 @@ class BlueManage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!packetSent) {
|
if (!packetSent) {
|
||||||
throw Exception('蓝牙写入失败,数据包 ${i+1}/${subData.length} 已达到最大重试次数');
|
throw Exception(
|
||||||
|
'蓝牙写入失败,数据包 ${i + 1}/${subData.length} 已达到最大重试次数');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user