Merge branch 'release_hyx' into release
This commit is contained in:
commit
7703f5949e
@ -65,67 +65,62 @@ class OTAUpgradeCommand extends SenderProtocol {
|
||||
|
||||
@override
|
||||
List<int> messageDetail() {
|
||||
List<int> data = [];
|
||||
List<int> ebcData = [];
|
||||
List<int> data = <int>[];
|
||||
List<int> ebcData = <int>[];
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = type % 256;
|
||||
final int type = commandType!.typeValue;
|
||||
final double typeDouble = type / 256;
|
||||
final int type1 = typeDouble.toInt();
|
||||
final int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
|
||||
|
||||
// 锁id 40
|
||||
int lockIDLength = utf8.encode(lockID!).length;
|
||||
final int lockIDLength = utf8.encode(lockID!).length;
|
||||
data.addAll(utf8.encode(lockID!));
|
||||
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
final int userIDLength = utf8.encode(userID!).length;
|
||||
data.addAll(utf8.encode(userID!));
|
||||
data = getFixedLengthList(data, 20 - userIDLength);
|
||||
|
||||
|
||||
//platform 2
|
||||
int platform0 = (platform! & 0xFF00) >> 8;
|
||||
int platform1 = platform! & 0xFF;
|
||||
final int platform0 = (platform! & 0xFF00) >> 8;
|
||||
final int platform1 = platform! & 0xFF;
|
||||
data.add(platform0);
|
||||
data.add(platform1);
|
||||
|
||||
|
||||
//product 2
|
||||
// int product0 = (product! & 0xFF00) >> 8;
|
||||
// int product1 = product! & 0xFF;
|
||||
// data.add(product0);
|
||||
// data.add(product1);
|
||||
data.addAll([0, 1]); //先默认是 01
|
||||
|
||||
data.addAll(<int>[0, 1]); //先默认是 01
|
||||
|
||||
//HwVersion 20
|
||||
int hwVersionLength = utf8.encode(hwVersion!).length;
|
||||
final int hwVersionLength = utf8.encode(hwVersion!).length;
|
||||
data.addAll(utf8.encode(hwVersion!));
|
||||
data = getFixedLengthList(data, 20 - hwVersionLength);
|
||||
|
||||
//FwVersion 20
|
||||
int fwVersionLength = utf8.encode(fwVersion!).length;
|
||||
final int fwVersionLength = utf8.encode(fwVersion!).length;
|
||||
data.addAll(utf8.encode(fwVersion!));
|
||||
data = getFixedLengthList(data, 20 - fwVersionLength);
|
||||
|
||||
//fwSize 4
|
||||
ByteData bytes = ByteData(4); // 创建一个长度为4的字节数据
|
||||
final ByteData bytes = ByteData(4); // 创建一个长度为4的字节数据
|
||||
bytes.setInt32(0, fwSize!);
|
||||
List<int> byteList = bytes.buffer.asUint8List();
|
||||
final List<int> byteList = bytes.buffer.asUint8List();
|
||||
data.addAll(byteList);
|
||||
|
||||
// 创建一个16字节的字节数组
|
||||
Uint8List result = Uint8List(16);
|
||||
final Uint8List result = Uint8List(16);
|
||||
// 将每个十六进制字符转换为4位二进制数据,并将其存储到结果字节数组中
|
||||
for (int i = 0; i < fwMD5!.length; i += 2) {
|
||||
String hex = fwMD5!.substring(i, i + 2);
|
||||
int byteValue = int.parse(hex, radix: 16);
|
||||
final String hex = fwMD5!.substring(i, i + 2);
|
||||
final int byteValue = int.parse(hex, radix: 16);
|
||||
result[i ~/ 2] = byteValue;
|
||||
}
|
||||
data.addAll(result);
|
||||
@ -135,7 +130,7 @@ class OTAUpgradeCommand extends SenderProtocol {
|
||||
//AuthCodeLen 1
|
||||
data.add(0);
|
||||
} else {
|
||||
List<int> authCodeData = [];
|
||||
final List<int> authCodeData = <int>[];
|
||||
|
||||
//KeyID
|
||||
authCodeData.addAll(utf8.encode(keyID!));
|
||||
@ -144,19 +139,19 @@ class OTAUpgradeCommand extends SenderProtocol {
|
||||
authCodeData.addAll(utf8.encode(userID!));
|
||||
|
||||
//token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||
authCodeData.addAll(token??[]);
|
||||
authCodeData.addAll(token ?? <int>[]);
|
||||
|
||||
authCodeData.addAll(signKey??[]);
|
||||
authCodeData.addAll(signKey ?? <int>[]);
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
data.add(authCode.bytes.length);
|
||||
data.addAll(authCode.bytes);
|
||||
}
|
||||
|
||||
if ((data.length % 16) != 0) {
|
||||
int add = (16 - data.length % 16);
|
||||
final int add = 16 - data.length % 16;
|
||||
for (int i = 0; i < add; i++) {
|
||||
data.add(0);
|
||||
}
|
||||
@ -164,7 +159,6 @@ class OTAUpgradeCommand extends SenderProtocol {
|
||||
printLog(data);
|
||||
|
||||
if (encrypt) {
|
||||
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -176,7 +170,7 @@ class OTAUpgradeCommand extends SenderProtocol {
|
||||
}
|
||||
|
||||
class OTAUpgradeReply extends Reply {
|
||||
List<int> token = [];
|
||||
List<int> token = <int>[];
|
||||
|
||||
OTAUpgradeReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
|
||||
@ -1345,7 +1345,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
|
||||
final double textSizeWidth = textPainter.size.width; // 获取文本的尺寸
|
||||
if (textSizeWidth > 358.w * 2 - 20) {
|
||||
lockAlias = '${lockAlias.substring(0, 25)}...';
|
||||
lockAlias =
|
||||
'${lockAlias.substring(0, lockAlias.length > 25 ? 25 : lockAlias.length)}...';
|
||||
}
|
||||
return Center(
|
||||
child: Stack(
|
||||
@ -1430,7 +1431,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> startOpenLock() async{
|
||||
Future<void> startOpenLock() async {
|
||||
if (state.openLockBtnState.value == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -92,8 +92,8 @@ class LockEscalationLogic extends BaseGetXController {
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: uid,
|
||||
keyID: BlueManage().connectDeviceName,
|
||||
platform: int.tryParse(data['platform'] ?? '0'),
|
||||
product: int.tryParse(data['product'] ?? '0'),
|
||||
platform: int.tryParse(data['platform'] ?? '0') ?? 0,
|
||||
product: int.tryParse(data['product'] ?? '0') ?? 0,
|
||||
hwVersion: data['hwVersion'],
|
||||
fwVersion: data['fwVersion'],
|
||||
fwSize: data['fwSize'],
|
||||
|
||||
@ -182,17 +182,7 @@ class _LockEscalationPageState extends State<LockEscalationPage> {
|
||||
height: 20.h,
|
||||
),
|
||||
Text(
|
||||
'${'机型'.tr}:${logic.headJson?['platform']}-${logic.headJson?['product']}',
|
||||
style: TextStyle(
|
||||
color: AppColors.blackColor,
|
||||
fontSize: 22.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Text(
|
||||
'${'硬件版本'.tr}:${logic.headJson?['hwVersion']}',
|
||||
'${'机型'.tr}:${logic.headJson?['platform']}',
|
||||
style: TextStyle(
|
||||
color: AppColors.blackColor,
|
||||
fontSize: 22.sp,
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/mine/mine/starLockMine_state.dart';
|
||||
import 'package:star_lock/tools/commonItem.dart';
|
||||
import 'package:star_lock/tools/customer_tool.dart';
|
||||
|
||||
import '../../appRouters.dart';
|
||||
import '../../app_settings/app_colors.dart';
|
||||
@ -204,6 +205,12 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||
Get.back();
|
||||
Get.toNamed(Routers.lockMallPage);
|
||||
}),
|
||||
if (F.isSKY)
|
||||
mineItem('images/mine/icon_mine_main_shoppingcart.png',
|
||||
TranslationLoader.lanKeys!.supportStaff!.tr, () {
|
||||
Get.back();
|
||||
CustomerTool.openCustomerService();
|
||||
}),
|
||||
mineItem('images/mine/icon_mine_main_about.png',
|
||||
TranslationLoader.lanKeys!.about!.tr, () {
|
||||
Get.back();
|
||||
|
||||
@ -353,12 +353,13 @@ class _MineSetPageState extends State<MineSetPage>
|
||||
action: () {
|
||||
logic.showToast('功能暂未开放'.tr);
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.supportStaff!.tr,
|
||||
isHaveLine: widget.showAbout,
|
||||
isHaveDirection: true,
|
||||
action: CustomerTool.openCustomerService,
|
||||
),
|
||||
if (F.isXHJ)
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.supportStaff!.tr,
|
||||
isHaveLine: widget.showAbout,
|
||||
isHaveDirection: true,
|
||||
action: CustomerTool.openCustomerService,
|
||||
),
|
||||
if (widget.showAbout)
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.about!.tr,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user