From ead3cbcb028000f5af132ac7fd92a314f21398dd Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Thu, 9 May 2024 17:06:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=E5=AE=8C=E6=88=90=E6=BB=A1=2032=20?= =?UTF-8?q?=E4=B8=AA=E7=94=A8=E6=88=B7=E6=B8=85=E9=99=A4=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=90=8E=E6=B7=BB=E5=8A=A0=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/lib/blue/blue_manage.dart | 6 +- star_lock/lib/blue/io_reply.dart | 47 ++--- star_lock/lib/blue/reciver_data.dart | 3 - .../lib/blue/sender_beforeDataManage.dart | 186 ++++++------------ star_lock/lib/debug/controller.dart | 49 ++++- 5 files changed, 140 insertions(+), 151 deletions(-) diff --git a/star_lock/lib/blue/blue_manage.dart b/star_lock/lib/blue/blue_manage.dart index 3822e77f..4d86e8be 100644 --- a/star_lock/lib/blue/blue_manage.dart +++ b/star_lock/lib/blue/blue_manage.dart @@ -477,7 +477,7 @@ class BlueManage { // 当包有头时 // 判断是否需要分包 dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度 - AppLog.log("dataLen1111:$dataLen getDataLength:${data.length} data:$data"); + // AppLog.log("dataLen1111:$dataLen getDataLength:${data.length} data:$data"); if (dataLen! + 14 > data.length) { // 当前包的长度小于实际的包时 分包添加 不解析 allData.addAll(data); @@ -493,8 +493,8 @@ class BlueManage { // 当包没有头时 是分包的包 直接添加 allData.addAll(data); // var len = allData[8] * 256 + allData[9]; - AppLog.log( - "dataLen3333:$dataLen allData.length:${allData.length} allData:$allData"); + // AppLog.log( + // "dataLen3333:$dataLen allData.length:${allData.length} allData:$allData"); if (((dataLen ?? 0) + 14) <= allData.length) { // 当长度小于等于当前包的数据时 直接解析数据 CommandReciverManager.appDataReceive(allData); diff --git a/star_lock/lib/blue/io_reply.dart b/star_lock/lib/blue/io_reply.dart index 61d8a25d..c8625aeb 100644 --- a/star_lock/lib/blue/io_reply.dart +++ b/star_lock/lib/blue/io_reply.dart @@ -12,121 +12,124 @@ abstract class Reply{ //command key flag int status = 0; List data = []; + static String logTag= '锁 -> App,指令订阅类型 :'; Reply.parseData(this.commandType, List dataDetail); void errorWithStstus(int status){ + switch(status){ case 0x00: // 成功 + AppLog.log("$logTag ${commandType?.typeName} 0x00 成功"); break; case 0x01: // 包格式错误 - AppLog.log("${commandType!.typeName} 0x01 包格式错误"); + AppLog.log("$logTag ${commandType!.typeName} 0x01 包格式错误"); showErrorMessage("包格式错误"); break; case 0x02: // 密码错误 - AppLog.log("${commandType!.typeName} 0x02 密码错误"); + AppLog.log("$logTag ${commandType!.typeName} 0x02 密码错误"); showErrorMessage("密码错误"); break; case 0x03: // 网络中断 - AppLog.log("${commandType!.typeName} 0x03 网络中断"); + AppLog.log("$logTag ${commandType!.typeName} 0x03 网络中断"); showErrorMessage("网络中断"); break; case 0x04: // 用户未登记 - AppLog.log("${commandType!.typeName} 0x04 用户未登记"); + AppLog.log("$logTag ${commandType!.typeName} 0x04 用户未登记"); showErrorMessage("用户未登记"); break; case 0x05: // 参数错误 - AppLog.log("${commandType!.typeName} 0x05 参数错误"); + AppLog.log("$logTag ${commandType!.typeName} 0x05 参数错误"); showErrorMessage("参数错误"); break; case 0x06: // 需要鉴权 - AppLog.log("${commandType!.typeName} 0x06 需要鉴权"); + AppLog.log("$logTag ${commandType!.typeName} 0x06 需要鉴权"); // showErrorMessage("需要鉴权"); break; case 0x07: // 无权限 - AppLog.log("${commandType!.typeName} 0x07 无权限"); + AppLog.log("$logTag ${commandType!.typeName} 0x07 无权限"); // showErrorMessage("无权限"); break; case 0x08: // 应答超时 - AppLog.log("${commandType!.typeName} 0x08 应答超时"); + AppLog.log("$logTag ${commandType!.typeName} 0x08 应答超时"); showErrorMessage("应答超时"); break; case 0x09: // 权限校验错误 - AppLog.log("${commandType!.typeName} 0x09 权限校验错误"); + AppLog.log("$logTag ${commandType!.typeName} 0x09 权限校验错误"); showErrorMessage("权限校验错误"); break; case 0x0a: // 钥匙不存在 showErrorMessage("钥匙不存在"); - AppLog.log("${commandType!.typeName} 0x0a 钥匙不存在"); + AppLog.log("$logTag ${commandType!.typeName} 0x0a 钥匙不存在"); break; case 0x0b: // 钥匙过期 showErrorMessage("钥匙过期"); - AppLog.log("${commandType!.typeName} 0x0b 钥匙过期"); + AppLog.log("$logTag ${commandType!.typeName} 0x0b 钥匙过期"); break; case 0x0c: // 钥匙数量已到上限 showErrorMessage("钥匙数量已到上限"); - AppLog.log("${commandType!.typeName} 0x0c 钥匙数量已到上限"); + AppLog.log("$logTag ${commandType!.typeName} 0x0c 钥匙数量已到上限"); break; case 0x0d: // 钥匙无效 showErrorMessage("钥匙无效"); - AppLog.log("${commandType!.typeName} 0x0d 钥匙无效"); + AppLog.log("$logTag ${commandType!.typeName} 0x0d 钥匙无效"); break; case 0x0e: // 钥匙已存在 showErrorMessage("钥匙已存在"); - AppLog.log("${commandType!.typeName} 0x0e 钥匙无效"); + AppLog.log("$logTag ${commandType!.typeName} 0x0e 钥匙无效"); break; case 0x0f: // 用户已存在 - AppLog.log("${commandType!.typeName} 0x0f 用户已存在"); + AppLog.log("$logTag ${commandType!.typeName} 0x0f 用户已存在"); showErrorMessage("用户已存在"); break; case 0x10: // 密码失效 - AppLog.log("${commandType!.typeName} 0x11 密码失效"); + AppLog.log("$logTag ${commandType!.typeName} 0x11 密码失效"); showErrorMessage("密码失效"); break; case 0x11: // 无效指令 - AppLog.log("${commandType!.typeName} 0x11 无效指令"); + AppLog.log("$logTag ${commandType!.typeName} 0x11 无效指令"); showErrorMessage("无效指令"); break; case 0x12: // 门锁时间异常 - AppLog.log("${commandType!.typeName} 0x12 门锁时间异常"); + AppLog.log("$logTag ${commandType!.typeName} 0x12 门锁时间异常"); showErrorMessage("门锁时间异常"); break; case 0x15: // APP(手机)未联网 - AppLog.log("${commandType!.typeName} 0x15 APP(手机)未联网"); + AppLog.log("$logTag ${commandType!.typeName} 0x15 APP(手机)未联网"); showErrorMessage("APP(手机)未联网"); break; case 0x16: // 正在开锁中... - AppLog.log("${commandType!.typeName}正在开锁中..."); + AppLog.log("$logTag ${commandType!.typeName}正在开锁中..."); // showErrorMessage("正在开锁中..."); break; case 0xff: // 异常,未知错误 - AppLog.log("${commandType!.typeName} 0xff"); + AppLog.log("$logTag ${commandType!.typeName} 0xff"); showErrorMessage("异常,未知错误"); break; default: //失败 - AppLog.log("蓝牙返回其他错误问题"); + AppLog.log("$logTag ${commandType!.typeName} 蓝牙返回其他错误问题"); break; } } diff --git a/star_lock/lib/blue/reciver_data.dart b/star_lock/lib/blue/reciver_data.dart index 5ba45b40..e2aaad2b 100644 --- a/star_lock/lib/blue/reciver_data.dart +++ b/star_lock/lib/blue/reciver_data.dart @@ -110,9 +110,6 @@ class CommandReciverManager { } parseData(oriDataList).then((Reply? value) async { EasyLoading.dismiss(); - if (value != null) { - AppLog.log("锁 -> App,指令订阅类型 :${value.commandType?.typeName} \n $value"); - } await EventBusManager().eventBusFir(value); }).catchError((error) { AppLog.log("APP解析数据时发生错误: $error"); diff --git a/star_lock/lib/blue/sender_beforeDataManage.dart b/star_lock/lib/blue/sender_beforeDataManage.dart index ed927f13..55c78e30 100644 --- a/star_lock/lib/blue/sender_beforeDataManage.dart +++ b/star_lock/lib/blue/sender_beforeDataManage.dart @@ -44,6 +44,7 @@ class SenderBeforeDataManage { // 监听设备返回的数据 StreamSubscription? _replySubscription; + // 启动订阅 void _initReplySubscription() { _replySubscription ??= EventBusManager().eventBus!.on().listen((reply) async { @@ -52,128 +53,36 @@ class SenderBeforeDataManage { _replyAddUserKey(reply); } - if(reply is CleanUpUsersReply){ + if (reply is CleanUpUsersReply) { _cleanUpUsersReply(reply); } }); } - // 添加用户 + // 解析添加用户订阅 Future _replyAddUserKey(Reply reply) async { int status = reply.data[46]; switch (status) { case 0x00: //成功 - CommonDataManage().currentLockUserNo = listChangInt(reply.data.sublist(47, 49)); - CommonDataManage().currentKeyInfo.lockUserNo = CommonDataManage().currentLockUserNo; + CommonDataManage().currentLockUserNo = + listChangInt(reply.data.sublist(47, 49)); + CommonDataManage().currentKeyInfo.lockUserNo = + CommonDataManage().currentLockUserNo; _updateLockUserNo(); break; case 0x06: //无权限 - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); - - var publicKey = await Storage.getStringList(saveBluePublicKey); - List publicKeyDataList = changeStringListToIntList(publicKey!); - var token = reply.data.sublist(42, 46); List strTokenList = changeIntListToStringList(token); Storage.setStringList(saveBlueToken, strTokenList); - - // IoSenderManage.senderAddUser( - // lockID: BlueManage().connectDeviceName, - // authUserID: CommonDataManage().currentKeyInfo.senderUserId!.toString(), - // keyID: CommonDataManage().currentKeyInfo.keyId.toString(), - // userID: await Storage.getUid(), - // openMode: 1, - // keyType: 0, - // startDate: CommonDataManage().currentKeyInfo.startDate!~/10000, - // expireDate: CommonDataManage().currentKeyInfo.endDate!~/10000, - // role: CommonDataManage().currentKeyInfo.keyRight == 1 ? 1 : 0, - // password: "123456", - // needAuthor: 1, - // publicKey: publicKeyDataList, - // privateKey: getPrivateKeyList, - // token: token); - LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo; - AppLog.log( - "startDate111:${currentKeyInfo.startDate} endDate:${currentKeyInfo.endDate}"); - DateTime startTime = DateTime.fromMillisecondsSinceEpoch( - currentKeyInfo.startDate! ~/ 1000); - DateTime endTime = DateTime.fromMillisecondsSinceEpoch( - currentKeyInfo.endDate! ~/ 1000); - bool isRound = currentKeyInfo.keyType == 2; - var addUserData = AddUserCommand( - lockID: BlueManage().connectDeviceName, - authUserID: currentKeyInfo.senderUserId!.toString(), - keyID: currentKeyInfo.keyId.toString(), - userID: await Storage.getUid(), - openMode: 1, - keyType: currentKeyInfo.keyType, - startDate: currentKeyInfo.startDate! ~/ 1000, - expireDate: currentKeyInfo.endDate! ~/ 1000, - useCountLimit: 0xFFFF, - // useCountLimit: 1, - isRound: isRound ? 1 : 0, - weekRound: isRound - ? DateTool().accordingTheCycleIntoTheCorrespondingNumber( - currentKeyInfo.weekDays!) - : 0, - startHour: isRound ? startTime.hour : 0, - startMin: isRound ? startTime.minute : 0, - endHour: isRound ? endTime.hour : 0, - endMin: isRound ? endTime.minute : 0, - role: currentKeyInfo.keyRight == 1 ? 1 : 0, - password: "123456", - needAuthor: 1, - publicKey: publicKeyDataList, - privateKey: getPrivateKeyList, - token: token); - eventBus.fire(LockAddUserSucceedEvent(addUserData.packageData(), 1)); + var addUserData = await getAddUserKeyData(tokenList: token); + eventBus.fire(LockAddUserSucceedEvent(addUserData, 1)); break; case 0x0c: //锁设备用户超过 32个,需要同步锁用户列表刷新 - var entity = await ApiRepository.to.getLockUserNoList( - lockId: CommonDataManage().currentKeyInfo.lockId!); - if (!entity.errorCode!.codeIsSuccessful && - (entity.data?.userNos ?? []).isNotEmpty) { - return; - } - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); - - var publicKey = await Storage.getStringList(saveBluePublicKey); - List publicKeyDataList = changeStringListToIntList(publicKey!); - - var tokenKey = await Storage.getStringList(saveBlueToken); - List tokenList = changeStringListToIntList(tokenKey!); - AppLog.log('---> ${entity.data?.userNos}'); - - var cleanUpUsersData = CleanUpUsersCommand( - lockID: BlueManage().connectDeviceName, - authUserID: CommonDataManage().currentKeyInfo.senderUserId!.toString(), - keyID: CommonDataManage().currentKeyInfo.keyId.toString(), - userID: await Storage.getUid(), - needAuthor: 1, - publicKey: publicKeyDataList, - privateKey: getPrivateKeyList, - userNoList: entity.data!.userNos!, - token: tokenList, - ).packageData(); - CommandSenderManager().sendNormalData(cleanUpUsersData); - - // IoSenderManage.senderCleanUpUsersCommand( - // lockID: BlueManage().connectDeviceName, - // authUserID: - // CommonDataManage().currentKeyInfo.senderUserId!.toString(), - // keyID: CommonDataManage().currentKeyInfo.keyId.toString(), - // userID: await Storage.getUid(), - // userNoList: entity.data!.userNos!, - // needAuthor: 1, - // publicKey: publicKeyDataList, - // privateKey: getPrivateKeyList, - // token: tokenList); - + var addUserData = await getCleanUpUsers(); + CommandSenderManager().sendNormalData(addUserData); break; default: //失败 @@ -181,47 +90,81 @@ class SenderBeforeDataManage { } } - // 清理用户 + // 解析清理用户订阅 Future _cleanUpUsersReply(Reply reply) async { int status = reply.data[6]; switch (status) { case 0x00: //成功 - + //添加用户 + var addUserData = await getAddUserKeyData(); + CommandSenderManager().sendNormalData(addUserData); break; case 0x06: - //无权限 - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); - - var publicKey = await Storage.getStringList(saveBluePublicKey); - List publicKeyDataList = changeStringListToIntList(publicKey!); - - var token = reply.data.sublist(42, 46); + //无权限 + var token = reply.data.sublist(2, 6); List strTokenList = changeIntListToStringList(token); Storage.setStringList(saveBlueToken, strTokenList); - - + var addUserData = await getCleanUpUsers(tokenList: token); + CommandSenderManager().sendNormalData(addUserData); break; default: - //失败 + //失败 break; } } - Future> getAddUserKeyData() async { + //获取清除用户列表指令 + Future> getCleanUpUsers({List? tokenList}) async { + var entity = await ApiRepository.to + .getLockUserNoList(lockId: CommonDataManage().currentKeyInfo.lockId!); + if (!entity.errorCode!.codeIsSuccessful || + (entity.data?.userNos ?? []).isEmpty) { + throw Exception('ApiRepository.to.getLockUserNoList 访问失败'); + } var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); var publicKey = await Storage.getStringList(saveBluePublicKey); List publicKeyDataList = changeStringListToIntList(publicKey!); - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); + if (tokenList == null) { + var tokenKey = await Storage.getStringList(saveBlueToken); + tokenList = changeStringListToIntList(tokenKey!); + } + + var cleanUpUsersData = CleanUpUsersCommand( + lockID: BlueManage().connectDeviceName, + authUserID: CommonDataManage().currentKeyInfo.senderUserId!.toString(), + keyID: CommonDataManage().currentKeyInfo.keyId.toString(), + userID: await Storage.getUid(), + needAuthor: 1, + publicKey: publicKeyDataList, + privateKey: getPrivateKeyList, + userNoList: entity.data!.userNos!, + token: tokenList, + ); + return cleanUpUsersData.packageData(); + } + + //获取添加用户指令 + Future> getAddUserKeyData({List? tokenList}) async { + var privateKey = await Storage.getStringList(saveBluePrivateKey); + List getPrivateKeyList = changeStringListToIntList(privateKey!); + + var publicKey = await Storage.getStringList(saveBluePublicKey); + List publicKeyDataList = changeStringListToIntList(publicKey!); + + if (tokenList == null) { + var token = await Storage.getStringList(saveBlueToken); + tokenList = changeStringListToIntList(token!); + } LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo; - DateTime startTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.startDate! ~/ 1000); - DateTime endTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.endDate! ~/ 1000); + DateTime startTime = + DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.startDate! ~/ 1000); + DateTime endTime = + DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.endDate! ~/ 1000); bool isRound = currentKeyInfo.keyType == 2; var addUserData = AddUserCommand( @@ -234,7 +177,6 @@ class SenderBeforeDataManage { startDate: currentKeyInfo.startDate! ~/ 1000, expireDate: currentKeyInfo.endDate! ~/ 1000, useCountLimit: 0xFFFF, - // useCountLimit: 1, isRound: isRound ? 1 : 0, weekRound: isRound ? DateTool().accordingTheCycleIntoTheCorrespondingNumber( @@ -249,7 +191,7 @@ class SenderBeforeDataManage { needAuthor: 1, publicKey: publicKeyDataList, privateKey: getPrivateKeyList, - token: getTokenList); + token: tokenList); return addUserData.packageData(); } diff --git a/star_lock/lib/debug/controller.dart b/star_lock/lib/debug/controller.dart index 1d87cccb..27cbdb43 100644 --- a/star_lock/lib/debug/controller.dart +++ b/star_lock/lib/debug/controller.dart @@ -9,11 +9,16 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:rxdart/rxdart.dart'; import 'package:star_lock/app_settings/app_colors.dart'; +import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/blue/blue_manage.dart'; +import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart'; import 'package:star_lock/blue/io_tool/io_tool.dart'; +import 'package:star_lock/blue/sender_data.dart'; import 'package:star_lock/blue/sender_manage.dart'; import 'package:star_lock/debug/log.dart'; import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart'; +import 'package:star_lock/network/api_repository.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/commonDataManage.dart'; import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/storage.dart'; @@ -85,6 +90,14 @@ class DebugConsoleController { .catchError(EasyLoading.dismiss); }, child: const Text('给锁设备创建 32个用户')), + ElevatedButton( + onPressed: () { + EasyLoading.show(); + sendCleanUpUsers() + .then((value) => EasyLoading.dismiss()) + .catchError(EasyLoading.dismiss); + }, + child: const Text('清除用户,只保留超级管理员')), ], ), ), @@ -141,9 +154,11 @@ class DebugConsoleController { privateKey: getPrivateKeyList, token: tokenList); } + + AppLog.log('--> 添加第$count 用户'); }); - await Future.delayed(const Duration(seconds: 2)); + await Future.delayed(const Duration(seconds: 3)); count++; await randomlyCreate32Users(count, max); } @@ -155,4 +170,36 @@ class DebugConsoleController { return List.generate(length, (index) => chars[random.nextInt(chars.length)]) .join(); } + + //获取清除用户列表指令 + Future sendCleanUpUsers({List? tokenList}) async { + var privateKey = await Storage.getStringList(saveBluePrivateKey); + List getPrivateKeyList = changeStringListToIntList(privateKey!); + + var publicKey = await Storage.getStringList(saveBluePublicKey); + List publicKeyDataList = changeStringListToIntList(publicKey!); + + if (tokenList == null) { + var tokenKey = await Storage.getStringList(saveBlueToken); + tokenList = changeStringListToIntList(tokenKey!); + } + + BlueManage().bludSendData(BlueManage().connectDeviceName, + (BluetoothConnectionState deviceConnectionState) async { + if (deviceConnectionState == BluetoothConnectionState.connected) { + IoSenderManage.senderCleanUpUsersCommand( + lockID: BlueManage().connectDeviceName, + authUserID: + CommonDataManage().currentKeyInfo.senderUserId!.toString(), + keyID: CommonDataManage().currentKeyInfo.keyId.toString(), + userID: await Storage.getUid(), + needAuthor: 1, + publicKey: publicKeyDataList, + privateKey: getPrivateKeyList, + userNoList: [1], + token: tokenList, + ); + } + }); + } } From dfced733487ab11994ea076f6de0ed4402c5e3b1 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Thu, 9 May 2024 17:32:38 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E9=85=8D=E5=AF=B9?= =?UTF-8?q?=E5=89=8D=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/images/lan/lan_en.json | 3 +- star_lock/images/lan/lan_keys.json | 3 +- star_lock/images/lan/lan_zh.json | 4 ++- .../addLock/nearbyLock/nearbyLock_logic.dart | 1 - .../addLock/nearbyLock/nearbyLock_page.dart | 33 ++++++++++++------- 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json index eed00e5f..90eb2734 100644 --- a/star_lock/images/lan/lan_en.json +++ b/star_lock/images/lan/lan_en.json @@ -832,5 +832,6 @@ "钥匙详情":"Key details", "姓名":"Name", "发送":"Send", - "请确认姓名全名和身份证号码是否正确":"Please confirm that the full name and ID number are correct" + "请确认姓名全名和身份证号码是否正确":"Please confirm that the full name and ID number are correct", + "传输期间请勿离开当前页面":"Do not leave the current page during transfer" } diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json index b1e72ad1..7aaa9d43 100644 --- a/star_lock/images/lan/lan_keys.json +++ b/star_lock/images/lan/lan_keys.json @@ -860,5 +860,6 @@ "钥匙详情":"钥匙详情", "姓名":"姓名", "发送":"发送", - "请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确" + "请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确", + "传输期间请勿离开当前页面":"传输期间请勿离开当前页面" } diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index c159b3c3..42188044 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -863,5 +863,7 @@ "钥匙详情":"钥匙详情", "姓名":"姓名", "发送":"发送", - "请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确" + "请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确", + "传输期间请勿离开当前页面":"传输期间请勿离开当前页面" + } diff --git a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart index a7fe8858..75c57c81 100644 --- a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart +++ b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart @@ -479,7 +479,6 @@ class NearbyLockLogic extends BaseGetXController { token: token, encrypt: false, ).packageData()); - showTitleEasyLoading("连接设备中..."); } else if (deviceConnectionState == BluetoothConnectionState.disconnected) {} },isAddEquipment: true); diff --git a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_page.dart b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_page.dart index 3740694b..cdf99f97 100644 --- a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_page.dart +++ b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_page.dart @@ -279,20 +279,31 @@ class OTAProgressDialog extends StatelessWidget { title: Text( '固件升级中'.tr, ), - content: Row( + content: Column( children: [ - Text( - '传输中'.tr, - style: TextStyle(fontSize: 22.sp, color: AppColors.mainColor), + Padding( + padding: EdgeInsets.only(top: 20.h, bottom: 10.h), + child: Text( + '传输期间请勿离开当前页面'.tr, + style: TextStyle(fontSize: 20.sp, color: AppColors.blackColor), + ), ), - SizedBox( - width: 15.w, + Row( + children: [ + Text( + '传输中'.tr, + style: TextStyle(fontSize: 18.sp, color: AppColors.mainColor), + ), + SizedBox( + width: 15.w, + ), + Expanded( + child: LinearProgressIndicator( + value: logic.state.otaProgress.value, + color: AppColors.mainColor, + )), + ], ), - Expanded( - child: LinearProgressIndicator( - value: logic.state.otaProgress.value, - color: AppColors.mainColor, - )), ], ), actions: [ From 171469ef9884264e306bced364bbbceef9ce031f Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Thu, 9 May 2024 17:36:05 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=E5=9B=9E=E5=A4=8D=20log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/lib/blue/io_protocol/io_otaUpgrade.dart | 1 - star_lock/lib/blue/io_sender.dart | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/star_lock/lib/blue/io_protocol/io_otaUpgrade.dart b/star_lock/lib/blue/io_protocol/io_otaUpgrade.dart index bb02f62d..05c30b1c 100644 --- a/star_lock/lib/blue/io_protocol/io_otaUpgrade.dart +++ b/star_lock/lib/blue/io_protocol/io_otaUpgrade.dart @@ -183,7 +183,6 @@ class OTAUpgradeReply extends Reply { data = dataDetail; token = data.sublist(2, 6); status = data[6]; - // AppLog.log('--->2' + data.toString()); errorWithStstus(status); } } diff --git a/star_lock/lib/blue/io_sender.dart b/star_lock/lib/blue/io_sender.dart index f51300b1..3d98678d 100644 --- a/star_lock/lib/blue/io_sender.dart +++ b/star_lock/lib/blue/io_sender.dart @@ -34,8 +34,8 @@ abstract class SenderProtocol extends IOData { } void printLog(List data) { - // AppLog.log( - // "App -> 锁,指令类型:${commandType!.typeName} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}"); + AppLog.log( + "App -> 锁,指令类型:${commandType!.typeName} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}"); } //TODO:拼装数据Ï