胁迫卡在蓝牙开锁后消失
This commit is contained in:
parent
9219168df5
commit
137cdf4ab8
@ -26,6 +26,7 @@ import 'package:star_lock/talk/starChart/constant/talk_status.dart';
|
||||
import 'package:star_lock/talk/starChart/handle/other/packet_loss_statistics.dart';
|
||||
import 'package:star_lock/talk/starChart/proto/talk_expect.pb.dart';
|
||||
import 'package:star_lock/talk/starChart/star_chart_manage.dart';
|
||||
import 'package:star_lock/talk/starChart/views/native/talk_view_native_decode_logic.dart';
|
||||
import 'package:star_lock/tools/bugly/bugly_tool.dart';
|
||||
import 'package:star_lock/tools/throttler.dart';
|
||||
import 'package:star_lock/widget/permission/permission_dialog.dart';
|
||||
@ -955,6 +956,8 @@ class LockDetailLogic extends BaseGetXController {
|
||||
showToast('设备未配网'.tr);
|
||||
return;
|
||||
}
|
||||
// 记录开始时间
|
||||
TalkViewNativeDecodeLogic.setMonitorStartTime(DateTime.now());
|
||||
// 重置丢包率监控
|
||||
// PacketLossStatistics().reset();
|
||||
// 发送监控id - 监控模式不设置等待接听状态
|
||||
@ -1132,8 +1135,14 @@ class LockDetailLogic extends BaseGetXController {
|
||||
final int status = reply.data[2];
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
final int dataLength = reply.data[8];
|
||||
state.uploadPasswordDataList.addAll(reply.data.sublist(9, reply.data.length));
|
||||
// 使用同步方式添加数据到列表,避免竞态条件
|
||||
final newData = reply.data.sublist(9, reply.data.length);
|
||||
state.uploadPasswordDataList.addAll(newData);
|
||||
|
||||
if (dataLength == 10) {
|
||||
// 当数据是10的时候继续请求
|
||||
state.uploadPasswordPage = state.uploadPasswordPage + 1;
|
||||
@ -1158,13 +1167,13 @@ class LockDetailLogic extends BaseGetXController {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
state.indexCount.value = state.indexCount.value + 1;
|
||||
// 保存到服务器
|
||||
_lockDataUpload(
|
||||
uploadType: 2,
|
||||
recordType: 2,
|
||||
records: state.uploadPasswordDataList,
|
||||
);
|
||||
// 添加延迟以确保数据完全写入列表,避免竞态条件
|
||||
await Future.delayed(Duration(milliseconds: 50));
|
||||
// 在调用上传方法前确保数据已正确添加
|
||||
if (state.uploadPasswordDataList.isNotEmpty) {
|
||||
state.indexCount.value = state.indexCount.value + 1;
|
||||
_lockDataUpload(uploadType: 2, recordType: 2, records: List.from(state.uploadPasswordDataList));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
@ -1235,7 +1244,10 @@ class LockDetailLogic extends BaseGetXController {
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
final int dataLength = reply.data[8];
|
||||
state.uploadCardDataList.addAll(reply.data.sublist(9, reply.data.length));
|
||||
// 使用同步方式添加数据到列表,避免竞态条件
|
||||
final newData = reply.data.sublist(9, reply.data.length);
|
||||
state.uploadCardDataList.addAll(newData);
|
||||
|
||||
if (dataLength == 10) {
|
||||
// 当数据是10的时候继续请求
|
||||
state.uploadCardPage = state.uploadCardPage + 1;
|
||||
@ -1264,8 +1276,12 @@ class LockDetailLogic extends BaseGetXController {
|
||||
});
|
||||
} else {
|
||||
state.indexCount.value = state.indexCount.value + 1;
|
||||
print('到达上传锁卡,${state.uploadCardDataList}');
|
||||
_lockDataUpload(uploadType: 2, recordType: 3, records: state.uploadCardDataList);
|
||||
// 添加延迟以确保数据完全写入列表,避免竞态条件
|
||||
await Future.delayed(Duration(milliseconds: 50));
|
||||
// 在调用上传方法前确保数据已正确添加
|
||||
if (state.uploadCardDataList.isNotEmpty) {
|
||||
_lockDataUpload(uploadType: 2, recordType: 3, records: List.from(state.uploadCardDataList));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
@ -1338,7 +1354,9 @@ class LockDetailLogic extends BaseGetXController {
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
final int dataLength = reply.data[8];
|
||||
state.uploadFingerprintDataList.addAll(reply.data.sublist(9, reply.data.length));
|
||||
// 使用同步方式添加数据到列表,避免竞态条件
|
||||
final newData = reply.data.sublist(9, reply.data.length);
|
||||
state.uploadFingerprintDataList.addAll(newData);
|
||||
if (dataLength == 10) {
|
||||
// 当数据是10的时候继续请求
|
||||
state.uploadFingerprintPage = state.uploadFingerprintPage + 1;
|
||||
@ -1367,7 +1385,12 @@ class LockDetailLogic extends BaseGetXController {
|
||||
});
|
||||
} else {
|
||||
state.indexCount.value = state.indexCount.value + 1;
|
||||
_lockDataUpload(uploadType: 2, recordType: 4, records: state.uploadFingerprintDataList);
|
||||
// 添加延迟以确保数据完全写入列表,避免竞态条件
|
||||
await Future.delayed(Duration(milliseconds: 50));
|
||||
// 在调用上传方法前确保数据已正确添加
|
||||
if (state.uploadFingerprintDataList.isNotEmpty) {
|
||||
_lockDataUpload(uploadType: 2, recordType: 4, records: List.from(state.uploadFingerprintDataList));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user