1、修复卡指纹常开模式循环日期问题。2、添加与蓝牙交互时,统一管理协议返回的错误码。3、添加部分国际化
This commit is contained in:
parent
04c5b703e5
commit
cda022c112
@ -717,6 +717,8 @@
|
||||
"请手动在系统设置中开启": "Please manually enable it in the system settings",
|
||||
"权限以继续使用应用": "Permission to continue using the application.",
|
||||
"去设置": "Go set it up",
|
||||
"当前网络": "Current network",
|
||||
"位置信息": "Location information",
|
||||
|
||||
"虹膜":"iris",
|
||||
"手掌":"palm",
|
||||
|
||||
@ -699,6 +699,8 @@
|
||||
"重命名": "重命名",
|
||||
"分组下的锁将被移到未分组里": "分组下的锁将被移到未分组里",
|
||||
"编辑成功": "编辑成功",
|
||||
"当前网络": "当前网络",
|
||||
"位置信息": "位置信息",
|
||||
|
||||
"相机": "相机",
|
||||
"相册": "相册",
|
||||
|
||||
@ -701,6 +701,8 @@
|
||||
"重命名": "重命名",
|
||||
"分组下的锁将被移到未分组里": "分组下的锁将被移到未分组里",
|
||||
"编辑成功": "编辑成功",
|
||||
"当前网络": "当前网络",
|
||||
"位置信息": "位置信息",
|
||||
|
||||
"相机": "相机",
|
||||
"相册": "相册",
|
||||
|
||||
@ -287,27 +287,20 @@ class BlueManage {
|
||||
print("Error Turning On:");
|
||||
}
|
||||
}
|
||||
;
|
||||
} else {
|
||||
Get.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// 调用发送数据
|
||||
Future<void> bludSendData(String deviceName, ConnectStateCallBack stateCallBack,
|
||||
{bool isAddEquipment = false}) async {
|
||||
/// 调用发送数据 List senderData,
|
||||
Future<void> bludSendData(String deviceName, ConnectStateCallBack stateCallBack, {bool isAddEquipment = false}) async {
|
||||
FlutterBluePlus.isSupported.then((isAvailable) async {
|
||||
if (isAvailable) {
|
||||
if (_adapterState == BluetoothAdapterState.on) {
|
||||
// 蓝牙已开启,可以进行蓝牙操作
|
||||
if (bluetoothConnectionState != BluetoothConnectionState.connected) {
|
||||
_connect(deviceName, (state) {
|
||||
// if(bluetoothConnectionState != BluetoothConnectionState.connected){
|
||||
// stateCallBack(bluetoothConnectionState!);
|
||||
// }else{
|
||||
// stateCallBack(bluetoothConnectionState!);
|
||||
// }
|
||||
stateCallBack(bluetoothConnectionState!);
|
||||
}, isAddEquipment: isAddEquipment);
|
||||
} else {
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -104,8 +106,6 @@ class SenderAddFaceCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -122,7 +122,8 @@ class SenderAddFaceCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -9,146 +9,145 @@ import '../io_type.dart';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
///TODO:添加指纹
|
||||
/// 该协议已弃用 使用新协议SenderAddFingerprintWithTimeCycleCoercionCommand 2024.4.16 addby 魏少阳
|
||||
/*
|
||||
备注:
|
||||
删除单个指纹规则:UseCountLimit 设置为 0。删除全部指纹规则: UseCountLimit 设置为 0,FingerNo 设置为 255,userId 设置为“Delete All !@#”,只有门锁管理员才有权限
|
||||
**/
|
||||
class SenderAddFingerprintCommand extends SenderProtocol {
|
||||
|
||||
String? keyID;
|
||||
String? userID;
|
||||
int? fingerNo;
|
||||
int? useCountLimit;
|
||||
List<int>? token;
|
||||
int? startTime;
|
||||
int? endTime;
|
||||
int? needAuthor;
|
||||
List<int>? signKey;
|
||||
List<int>? privateKey;
|
||||
|
||||
SenderAddFingerprintCommand({
|
||||
this.keyID,
|
||||
this.userID,
|
||||
this.fingerNo,
|
||||
this.useCountLimit,
|
||||
this.token,
|
||||
this.startTime,
|
||||
this.endTime,
|
||||
this.needAuthor,
|
||||
this.signKey,
|
||||
this.privateKey,
|
||||
}) : super(CommandType.generalExtendedCommond);
|
||||
|
||||
@override
|
||||
List<int> messageDetail() {
|
||||
List<int> data = [];
|
||||
List<int> subData = [];
|
||||
List<int> ebcData = [];
|
||||
|
||||
print("pwdNopwdNopwdNopwdNo:$fingerNo");
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
|
||||
// 子命令类型
|
||||
data.add(31);
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
// PwdNo
|
||||
subData.add(fingerNo!);
|
||||
|
||||
// UseCountLimit
|
||||
subData.add(useCountLimit!);
|
||||
|
||||
// token
|
||||
subData.addAll(token!);
|
||||
|
||||
// startTime 4
|
||||
subData.add((startTime! & 0xff000000) >> 24);
|
||||
subData.add((startTime! & 0xff0000) >> 16);
|
||||
subData.add((startTime! & 0xff00) >> 8);
|
||||
subData.add((startTime! & 0xff));
|
||||
|
||||
// endTime 4
|
||||
subData.add((endTime! & 0xff000000) >> 24);
|
||||
subData.add((endTime! & 0xff0000) >> 16);
|
||||
subData.add((endTime! & 0xff00) >> 8);
|
||||
subData.add((endTime! & 0xff));
|
||||
|
||||
if(needAuthor == 0){
|
||||
//AuthCodeLen 1
|
||||
subData.add(0);
|
||||
} else {
|
||||
List<int> authCodeData = [];
|
||||
//KeyID
|
||||
authCodeData.addAll(utf8.encode(keyID!));
|
||||
|
||||
//authUserID
|
||||
authCodeData.addAll(utf8.encode(userID!));
|
||||
|
||||
//token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||
authCodeData.addAll(token!);
|
||||
|
||||
authCodeData.addAll(signKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
subData.add(authCode.bytes.length);
|
||||
subData.addAll(authCode.bytes);
|
||||
}
|
||||
|
||||
data.add(subData.length);
|
||||
data.addAll(subData);
|
||||
|
||||
if ((data.length % 16) != 0) {
|
||||
int add = (16 - data.length % 16);
|
||||
for (int i = 0; i < add; i++) {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
}
|
||||
|
||||
class SenderAddFingerprintReply extends Reply {
|
||||
SenderAddFingerprintReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
}
|
||||
}
|
||||
|
||||
class SenderAddFingerprintProcessReply extends Reply {
|
||||
SenderAddFingerprintProcessReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
}
|
||||
}
|
||||
|
||||
class SenderAddFingerprintConfirmationReply extends Reply {
|
||||
SenderAddFingerprintConfirmationReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
}
|
||||
}
|
||||
// class SenderAddFingerprintCommand extends SenderProtocol {
|
||||
//
|
||||
// String? keyID;
|
||||
// String? userID;
|
||||
// int? fingerNo;
|
||||
// int? useCountLimit;
|
||||
// List<int>? token;
|
||||
// int? startTime;
|
||||
// int? endTime;
|
||||
// int? needAuthor;
|
||||
// List<int>? signKey;
|
||||
// List<int>? privateKey;
|
||||
//
|
||||
// SenderAddFingerprintCommand({
|
||||
// this.keyID,
|
||||
// this.userID,
|
||||
// this.fingerNo,
|
||||
// this.useCountLimit,
|
||||
// this.token,
|
||||
// this.startTime,
|
||||
// this.endTime,
|
||||
// this.needAuthor,
|
||||
// this.signKey,
|
||||
// this.privateKey,
|
||||
// }) : super(CommandType.generalExtendedCommond);
|
||||
//
|
||||
// @override
|
||||
// List<int> messageDetail() {
|
||||
// List<int> data = [];
|
||||
// List<int> subData = [];
|
||||
// List<int> ebcData = [];
|
||||
//
|
||||
// print("pwdNopwdNopwdNopwdNo:$fingerNo");
|
||||
//
|
||||
// // 指令类型
|
||||
// int type = commandType!.typeValue;
|
||||
// double typeDouble = type / 256;
|
||||
// int type1 = typeDouble.toInt();
|
||||
// int type2 = type % 256;
|
||||
// data.add(type1);
|
||||
// data.add(type2);
|
||||
//
|
||||
// // 子命令类型
|
||||
// data.add(31);
|
||||
//
|
||||
// // keyID 40
|
||||
// int keyIDLength = utf8.encode(keyID!).length;
|
||||
// // print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
// subData.addAll(utf8.encode(keyID!));
|
||||
// subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
//
|
||||
// //userID 20
|
||||
// int userIDLength = utf8.encode(userID!).length;
|
||||
// // print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
// subData.addAll(utf8.encode(userID!));
|
||||
// subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
//
|
||||
// // PwdNo
|
||||
// subData.add(fingerNo!);
|
||||
//
|
||||
// // UseCountLimit
|
||||
// subData.add(useCountLimit!);
|
||||
//
|
||||
// // token
|
||||
// subData.addAll(token!);
|
||||
//
|
||||
// // startTime 4
|
||||
// subData.add((startTime! & 0xff000000) >> 24);
|
||||
// subData.add((startTime! & 0xff0000) >> 16);
|
||||
// subData.add((startTime! & 0xff00) >> 8);
|
||||
// subData.add((startTime! & 0xff));
|
||||
//
|
||||
// // endTime 4
|
||||
// subData.add((endTime! & 0xff000000) >> 24);
|
||||
// subData.add((endTime! & 0xff0000) >> 16);
|
||||
// subData.add((endTime! & 0xff00) >> 8);
|
||||
// subData.add((endTime! & 0xff));
|
||||
//
|
||||
// if(needAuthor == 0){
|
||||
// //AuthCodeLen 1
|
||||
// subData.add(0);
|
||||
// } else {
|
||||
// List<int> authCodeData = [];
|
||||
// //KeyID
|
||||
// authCodeData.addAll(utf8.encode(keyID!));
|
||||
//
|
||||
// //authUserID
|
||||
// authCodeData.addAll(utf8.encode(userID!));
|
||||
//
|
||||
// //token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||
// authCodeData.addAll(token!);
|
||||
//
|
||||
// authCodeData.addAll(signKey!);
|
||||
//
|
||||
// // 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
// var authCode = crypto.md5.convert(authCodeData);
|
||||
//
|
||||
// subData.add(authCode.bytes.length);
|
||||
// subData.addAll(authCode.bytes);
|
||||
// }
|
||||
//
|
||||
// data.add(subData.length);
|
||||
// data.addAll(subData);
|
||||
//
|
||||
// if ((data.length % 16) != 0) {
|
||||
// int add = (16 - data.length % 16);
|
||||
// for (int i = 0; i < add; i++) {
|
||||
// data.add(0);
|
||||
// }
|
||||
// }
|
||||
// print("${commandType!.typeName} SM4Data:$data");
|
||||
// // 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
// return ebcData;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class SenderAddFingerprintReply extends Reply {
|
||||
// SenderAddFingerprintReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
// : super.parseData(commandType, dataDetail) {
|
||||
// data = dataDetail;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class SenderAddFingerprintProcessReply extends Reply {
|
||||
// SenderAddFingerprintProcessReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
// : super.parseData(commandType, dataDetail) {
|
||||
// data = dataDetail;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class SenderAddFingerprintConfirmationReply extends Reply {
|
||||
// SenderAddFingerprintConfirmationReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
// : super.parseData(commandType, dataDetail) {
|
||||
// data = dataDetail;
|
||||
// }
|
||||
// }
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -25,8 +27,8 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
int? weekRound;
|
||||
int? startDate;
|
||||
int? endDate;
|
||||
int? startTime;
|
||||
int? endTime;
|
||||
String? startTime;
|
||||
String? endTime;
|
||||
int? needAuthor;
|
||||
List<int>? signKey;
|
||||
List<int>? privateKey;
|
||||
@ -55,8 +57,6 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
List<int> subData = [];
|
||||
List<int> ebcData = [];
|
||||
|
||||
print("pwdNopwdNopwdNopwdNo:$fingerNo");
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
@ -111,16 +111,22 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
subData.add((endDate! & 0xff));
|
||||
|
||||
// startTime 4
|
||||
subData.add((startTime! & 0xff000000) >> 24);
|
||||
subData.add((startTime! & 0xff0000) >> 16);
|
||||
subData.add((startTime! & 0xff00) >> 8);
|
||||
subData.add((startTime! & 0xff));
|
||||
List<int> startTimeList = [0,0,0,0];
|
||||
if(startTime!.contains(":")){
|
||||
List<String> getStartTimeList = startTime!.split(":");
|
||||
startTimeList[2] = int.parse(getStartTimeList[0]);
|
||||
startTimeList[3] = int.parse(getStartTimeList[1]);
|
||||
}
|
||||
subData.addAll(startTimeList);
|
||||
|
||||
// endTime 4
|
||||
subData.add((endTime! & 0xff000000) >> 24);
|
||||
subData.add((endTime! & 0xff0000) >> 16);
|
||||
subData.add((endTime! & 0xff00) >> 8);
|
||||
subData.add((endTime! & 0xff));
|
||||
List<int> endTimeList = [0,0,0,0];
|
||||
if(endTime!.contains(":")){
|
||||
List<String> getendTimeList = endTime!.split(":");
|
||||
endTimeList[2] = int.parse(getendTimeList[0]);
|
||||
endTimeList[3] = int.parse(getendTimeList[1]);
|
||||
}
|
||||
subData.addAll(endTimeList);
|
||||
|
||||
if(needAuthor == 0){
|
||||
//AuthCodeLen 1
|
||||
@ -138,8 +144,6 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(signKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -156,7 +160,8 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -167,6 +172,8 @@ class SenderAddFingerprintWithTimeCycleCoercionReply extends Reply {
|
||||
SenderAddFingerprintWithTimeCycleCoercionReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,6 +181,8 @@ class SenderAddFingerprintProcessReply extends Reply {
|
||||
SenderAddFingerprintProcessReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,5 +190,7 @@ class SenderAddFingerprintConfirmationReply extends Reply {
|
||||
SenderAddFingerprintConfirmationReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -11,139 +11,137 @@ import '../sm4Encipher/sm4.dart';
|
||||
///TODO:该协议已弃用 使用新协议SenderAddICCardWithTimeCycleCoercionCommand 2024.4.16 addby 魏少阳
|
||||
///
|
||||
///TODO:设置自定义密码
|
||||
/*
|
||||
备注:
|
||||
删除单个指纹规则:UseCountLimit 设置为 0。删除全部指纹规则: UseCountLimit 设置为 0,FingerNo 设置为 255,userId 设置为“Delete All !@#”,只有门锁管理员才有权限
|
||||
**/
|
||||
class SenderAddICCardCommand extends SenderProtocol {
|
||||
String? keyID;
|
||||
String? userID;
|
||||
int? cardNo;
|
||||
int? useCountLimit;
|
||||
List<int>? token;
|
||||
int? startTime;
|
||||
int? endTime;
|
||||
int? needAuthor;
|
||||
List<int>? signKey;
|
||||
List<int>? privateKey;
|
||||
|
||||
SenderAddICCardCommand({
|
||||
this.keyID,
|
||||
this.userID,
|
||||
this.cardNo,
|
||||
this.useCountLimit,
|
||||
this.token,
|
||||
this.startTime,
|
||||
this.endTime,
|
||||
this.needAuthor,
|
||||
this.signKey,
|
||||
this.privateKey,
|
||||
}) : super(CommandType.generalExtendedCommond);
|
||||
|
||||
@override
|
||||
List<int> messageDetail() {
|
||||
List<int> data = [];
|
||||
List<int> subData = [];
|
||||
List<int> ebcData = [];
|
||||
|
||||
print("pwdNopwdNopwdNopwdNo:$cardNo");
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
|
||||
// 子命令类型
|
||||
data.add(21);
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
// PwdNo
|
||||
subData.add(cardNo!);
|
||||
|
||||
// UseCountLimit
|
||||
subData.add(useCountLimit!);
|
||||
|
||||
// token
|
||||
subData.addAll(token!);
|
||||
|
||||
// startTime 4
|
||||
subData.add((startTime! & 0xff000000) >> 24);
|
||||
subData.add((startTime! & 0xff0000) >> 16);
|
||||
subData.add((startTime! & 0xff00) >> 8);
|
||||
subData.add((startTime! & 0xff));
|
||||
|
||||
// endTime 4
|
||||
subData.add((endTime! & 0xff000000) >> 24);
|
||||
subData.add((endTime! & 0xff0000) >> 16);
|
||||
subData.add((endTime! & 0xff00) >> 8);
|
||||
subData.add((endTime! & 0xff));
|
||||
|
||||
if (needAuthor == 0) {
|
||||
//AuthCodeLen 1
|
||||
subData.add(0);
|
||||
} else {
|
||||
List<int> authCodeData = [];
|
||||
//KeyID
|
||||
authCodeData.addAll(utf8.encode(keyID!));
|
||||
|
||||
//authUserID
|
||||
authCodeData.addAll(utf8.encode(userID!));
|
||||
|
||||
//token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||
authCodeData.addAll(token!);
|
||||
|
||||
authCodeData.addAll(signKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
subData.add(authCode.bytes.length);
|
||||
subData.addAll(authCode.bytes);
|
||||
}
|
||||
|
||||
data.add(subData.length);
|
||||
data.addAll(subData);
|
||||
|
||||
if ((data.length % 16) != 0) {
|
||||
int add = (16 - data.length % 16);
|
||||
for (int i = 0; i < add; i++) {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
}
|
||||
|
||||
class SenderAddICCardReply extends Reply {
|
||||
SenderAddICCardReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
}
|
||||
}
|
||||
|
||||
class SenderAddICCardConfirmationReply extends Reply {
|
||||
SenderAddICCardConfirmationReply.parseData(
|
||||
CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
}
|
||||
}
|
||||
// /*
|
||||
// 备注:
|
||||
// 删除单个指纹规则:UseCountLimit 设置为 0。删除全部指纹规则: UseCountLimit 设置为 0,FingerNo 设置为 255,userId 设置为“Delete All !@#”,只有门锁管理员才有权限
|
||||
// **/
|
||||
// class SenderAddICCardCommand extends SenderProtocol {
|
||||
// String? keyID;
|
||||
// String? userID;
|
||||
// int? cardNo;
|
||||
// int? useCountLimit;
|
||||
// List<int>? token;
|
||||
// int? startTime;
|
||||
// int? endTime;
|
||||
// int? needAuthor;
|
||||
// List<int>? signKey;
|
||||
// List<int>? privateKey;
|
||||
//
|
||||
// SenderAddICCardCommand({
|
||||
// this.keyID,
|
||||
// this.userID,
|
||||
// this.cardNo,
|
||||
// this.useCountLimit,
|
||||
// this.token,
|
||||
// this.startTime,
|
||||
// this.endTime,
|
||||
// this.needAuthor,
|
||||
// this.signKey,
|
||||
// this.privateKey,
|
||||
// }) : super(CommandType.generalExtendedCommond);
|
||||
//
|
||||
// @override
|
||||
// List<int> messageDetail() {
|
||||
// List<int> data = [];
|
||||
// List<int> subData = [];
|
||||
// List<int> ebcData = [];
|
||||
//
|
||||
// print("pwdNopwdNopwdNopwdNo:$cardNo");
|
||||
//
|
||||
// // 指令类型
|
||||
// int type = commandType!.typeValue;
|
||||
// double typeDouble = type / 256;
|
||||
// int type1 = typeDouble.toInt();
|
||||
// int type2 = type % 256;
|
||||
// data.add(type1);
|
||||
// data.add(type2);
|
||||
//
|
||||
// // 子命令类型
|
||||
// data.add(21);
|
||||
//
|
||||
// // keyID 40
|
||||
// int keyIDLength = utf8.encode(keyID!).length;
|
||||
// // print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
// subData.addAll(utf8.encode(keyID!));
|
||||
// subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
//
|
||||
// //userID 20
|
||||
// int userIDLength = utf8.encode(userID!).length;
|
||||
// // print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
// subData.addAll(utf8.encode(userID!));
|
||||
// subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
//
|
||||
// // PwdNo
|
||||
// subData.add(cardNo!);
|
||||
//
|
||||
// // UseCountLimit
|
||||
// subData.add(useCountLimit!);
|
||||
//
|
||||
// // token
|
||||
// subData.addAll(token!);
|
||||
//
|
||||
// // startTime 4
|
||||
// subData.add((startTime! & 0xff000000) >> 24);
|
||||
// subData.add((startTime! & 0xff0000) >> 16);
|
||||
// subData.add((startTime! & 0xff00) >> 8);
|
||||
// subData.add((startTime! & 0xff));
|
||||
//
|
||||
// // endTime 4
|
||||
// subData.add((endTime! & 0xff000000) >> 24);
|
||||
// subData.add((endTime! & 0xff0000) >> 16);
|
||||
// subData.add((endTime! & 0xff00) >> 8);
|
||||
// subData.add((endTime! & 0xff));
|
||||
//
|
||||
// if (needAuthor == 0) {
|
||||
// //AuthCodeLen 1
|
||||
// subData.add(0);
|
||||
// } else {
|
||||
// List<int> authCodeData = [];
|
||||
// //KeyID
|
||||
// authCodeData.addAll(utf8.encode(keyID!));
|
||||
//
|
||||
// //authUserID
|
||||
// authCodeData.addAll(utf8.encode(userID!));
|
||||
//
|
||||
// //token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||
// authCodeData.addAll(token!);
|
||||
//
|
||||
// authCodeData.addAll(signKey!);
|
||||
//
|
||||
// // 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
// var authCode = crypto.md5.convert(authCodeData);
|
||||
//
|
||||
// subData.add(authCode.bytes.length);
|
||||
// subData.addAll(authCode.bytes);
|
||||
// }
|
||||
//
|
||||
// data.add(subData.length);
|
||||
// data.addAll(subData);
|
||||
//
|
||||
// if ((data.length % 16) != 0) {
|
||||
// int add = (16 - data.length % 16);
|
||||
// for (int i = 0; i < add; i++) {
|
||||
// data.add(0);
|
||||
// }
|
||||
// }
|
||||
// print("${commandType!.typeName} SM4Data:$data");
|
||||
// // 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
// return ebcData;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class SenderAddICCardReply extends Reply {
|
||||
// SenderAddICCardReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
// : super.parseData(commandType, dataDetail) {
|
||||
// data = dataDetail;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class SenderAddICCardConfirmationReply extends Reply {
|
||||
// SenderAddICCardConfirmationReply.parseData(
|
||||
// CommandType commandType, List<int> dataDetail)
|
||||
// : super.parseData(commandType, dataDetail) {
|
||||
// data = dataDetail;
|
||||
// }
|
||||
// }
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -25,8 +27,8 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
int? weekRound;
|
||||
int? startDate;
|
||||
int? endDate;
|
||||
int? startTime;
|
||||
int? endTime;
|
||||
String? startTime;
|
||||
String? endTime;
|
||||
int? needAuthor;
|
||||
List<int>? signKey;
|
||||
List<int>? privateKey;
|
||||
@ -55,8 +57,6 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
List<int> subData = [];
|
||||
List<int> ebcData = [];
|
||||
|
||||
print("cardNocardNocardNocardNo:$cardNo");
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
@ -111,16 +111,22 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
subData.add((endDate! & 0xff));
|
||||
|
||||
// startTime 4
|
||||
subData.add((startTime! & 0xff000000) >> 24);
|
||||
subData.add((startTime! & 0xff0000) >> 16);
|
||||
subData.add((startTime! & 0xff00) >> 8);
|
||||
subData.add((startTime! & 0xff));
|
||||
List<int> startTimeList = [0,0,0,0];
|
||||
if(startTime!.contains(":")){
|
||||
List<String> getStartTimeList = startTime!.split(":");
|
||||
startTimeList[2] = int.parse(getStartTimeList[0]);
|
||||
startTimeList[3] = int.parse(getStartTimeList[1]);
|
||||
}
|
||||
subData.addAll(startTimeList);
|
||||
|
||||
// endTime 4
|
||||
subData.add((endTime! & 0xff000000) >> 24);
|
||||
subData.add((endTime! & 0xff0000) >> 16);
|
||||
subData.add((endTime! & 0xff00) >> 8);
|
||||
subData.add((endTime! & 0xff));
|
||||
List<int> endTimeList = [0,0,0,0];
|
||||
if(endTime!.contains(":")){
|
||||
List<String> getendTimeList = endTime!.split(":");
|
||||
endTimeList[2] = int.parse(getendTimeList[0]);
|
||||
endTimeList[3] = int.parse(getendTimeList[1]);
|
||||
}
|
||||
subData.addAll(endTimeList);
|
||||
|
||||
if(needAuthor == 0){
|
||||
//AuthCodeLen 1
|
||||
@ -138,8 +144,6 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(signKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -156,7 +160,8 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -167,6 +172,8 @@ class SenderAddICCardWithTimeCycleCoercionReply extends Reply {
|
||||
SenderAddICCardWithTimeCycleCoercionReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,5 +181,7 @@ class SenderAddICCardConfirmationReply extends Reply {
|
||||
SenderAddICCardConfirmationReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,133 +13,131 @@ import 'package:crypto/crypto.dart' as crypto;
|
||||
备注:
|
||||
删除单个指纹规则:UseCountLimit 设置为 0。删除全部指纹规则: UseCountLimit 设置为 0,FingerNo 设置为 255,userId 设置为“Delete All !@#”,只有门锁管理员才有权限
|
||||
**/
|
||||
class SenderAddStressFingerprintCommand extends SenderProtocol {
|
||||
|
||||
String? keyID;
|
||||
String? userID;
|
||||
int? fingerNo;
|
||||
int? fingerType;
|
||||
int? useCountLimit;
|
||||
List<int>? token;
|
||||
int? startTime;
|
||||
int? endTime;
|
||||
int? needAuthor;
|
||||
List<int>? publicKey;
|
||||
List<int>? privateKey;
|
||||
List<int>? signKey;
|
||||
|
||||
SenderAddStressFingerprintCommand({
|
||||
this.keyID,
|
||||
this.userID,
|
||||
this.fingerNo,
|
||||
this.fingerType,
|
||||
this.useCountLimit,
|
||||
this.token,
|
||||
this.startTime,
|
||||
this.endTime,
|
||||
this.needAuthor,
|
||||
this.publicKey,
|
||||
this.privateKey,
|
||||
this.signKey
|
||||
}) : super(CommandType.generalExtendedCommond);
|
||||
|
||||
@override
|
||||
List<int> messageDetail() {
|
||||
List<int> data = [];
|
||||
List<int> subData = [];
|
||||
List<int> ebcData = [];
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
|
||||
// 子命令类型
|
||||
data.add(62);
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
// PwdNo
|
||||
subData.add(fingerNo!);
|
||||
|
||||
// fingerType
|
||||
subData.add(fingerType!);
|
||||
|
||||
// UseCountLimit
|
||||
subData.add(255);
|
||||
|
||||
// token
|
||||
subData.addAll(token!);
|
||||
|
||||
// startTime 4
|
||||
subData.add((startTime! & 0xff000000) >> 24);
|
||||
subData.add((startTime! & 0xff0000) >> 16);
|
||||
subData.add((startTime! & 0xff00) >> 8);
|
||||
subData.add((startTime! & 0xff));
|
||||
|
||||
// endTime 4
|
||||
subData.add((endTime! & 0xff000000) >> 24);
|
||||
subData.add((endTime! & 0xff0000) >> 16);
|
||||
subData.add((endTime! & 0xff00) >> 8);
|
||||
subData.add((endTime! & 0xff));
|
||||
|
||||
if(needAuthor == 0){
|
||||
//AuthCodeLen 1
|
||||
subData.add(0);
|
||||
} else {
|
||||
List<int> authCodeData = [];
|
||||
|
||||
//KeyID
|
||||
authCodeData.addAll(utf8.encode(keyID!));
|
||||
|
||||
//authUserID
|
||||
authCodeData.addAll(utf8.encode(userID!));
|
||||
|
||||
//token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||
authCodeData.addAll(token!);
|
||||
|
||||
authCodeData.addAll(signKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
subData.add(authCode.bytes.length);
|
||||
subData.addAll(authCode.bytes);
|
||||
}
|
||||
|
||||
data.add(subData.length);
|
||||
data.addAll(subData);
|
||||
|
||||
if ((data.length % 16) != 0) {
|
||||
int add = (16 - data.length % 16);
|
||||
for (int i = 0; i < add; i++) {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
}
|
||||
|
||||
class SenderAddStressFingerprintReply extends Reply {
|
||||
SenderAddStressFingerprintReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
}
|
||||
}
|
||||
// class SenderAddStressFingerprintCommand extends SenderProtocol {
|
||||
//
|
||||
// String? keyID;
|
||||
// String? userID;
|
||||
// int? fingerNo;
|
||||
// int? fingerType;
|
||||
// int? useCountLimit;
|
||||
// List<int>? token;
|
||||
// int? startTime;
|
||||
// int? endTime;
|
||||
// int? needAuthor;
|
||||
// List<int>? publicKey;
|
||||
// List<int>? privateKey;
|
||||
// List<int>? signKey;
|
||||
//
|
||||
// SenderAddStressFingerprintCommand({
|
||||
// this.keyID,
|
||||
// this.userID,
|
||||
// this.fingerNo,
|
||||
// this.fingerType,
|
||||
// this.useCountLimit,
|
||||
// this.token,
|
||||
// this.startTime,
|
||||
// this.endTime,
|
||||
// this.needAuthor,
|
||||
// this.publicKey,
|
||||
// this.privateKey,
|
||||
// this.signKey
|
||||
// }) : super(CommandType.generalExtendedCommond);
|
||||
//
|
||||
// @override
|
||||
// List<int> messageDetail() {
|
||||
// List<int> data = [];
|
||||
// List<int> subData = [];
|
||||
// List<int> ebcData = [];
|
||||
//
|
||||
// // 指令类型
|
||||
// int type = commandType!.typeValue;
|
||||
// double typeDouble = type / 256;
|
||||
// int type1 = typeDouble.toInt();
|
||||
// int type2 = type % 256;
|
||||
// data.add(type1);
|
||||
// data.add(type2);
|
||||
//
|
||||
// // 子命令类型
|
||||
// data.add(62);
|
||||
//
|
||||
// // keyID 40
|
||||
// int keyIDLength = utf8.encode(keyID!).length;
|
||||
// // print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
// subData.addAll(utf8.encode(keyID!));
|
||||
// subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
//
|
||||
// //userID 20
|
||||
// int userIDLength = utf8.encode(userID!).length;
|
||||
// // print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
// subData.addAll(utf8.encode(userID!));
|
||||
// subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
//
|
||||
// // PwdNo
|
||||
// subData.add(fingerNo!);
|
||||
//
|
||||
// // fingerType
|
||||
// subData.add(fingerType!);
|
||||
//
|
||||
// // UseCountLimit
|
||||
// subData.add(255);
|
||||
//
|
||||
// // token
|
||||
// subData.addAll(token!);
|
||||
//
|
||||
// // startTime 4
|
||||
// subData.add((startTime! & 0xff000000) >> 24);
|
||||
// subData.add((startTime! & 0xff0000) >> 16);
|
||||
// subData.add((startTime! & 0xff00) >> 8);
|
||||
// subData.add((startTime! & 0xff));
|
||||
//
|
||||
// // endTime 4
|
||||
// subData.add((endTime! & 0xff000000) >> 24);
|
||||
// subData.add((endTime! & 0xff0000) >> 16);
|
||||
// subData.add((endTime! & 0xff00) >> 8);
|
||||
// subData.add((endTime! & 0xff));
|
||||
//
|
||||
// if(needAuthor == 0){
|
||||
// //AuthCodeLen 1
|
||||
// subData.add(0);
|
||||
// } else {
|
||||
// List<int> authCodeData = [];
|
||||
//
|
||||
// //KeyID
|
||||
// authCodeData.addAll(utf8.encode(keyID!));
|
||||
//
|
||||
// //authUserID
|
||||
// authCodeData.addAll(utf8.encode(userID!));
|
||||
//
|
||||
// //token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||
// authCodeData.addAll(token!);
|
||||
//
|
||||
// authCodeData.addAll(signKey!);
|
||||
//
|
||||
// // 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
// var authCode = crypto.md5.convert(authCodeData);
|
||||
// subData.add(authCode.bytes.length);
|
||||
// subData.addAll(authCode.bytes);
|
||||
// }
|
||||
//
|
||||
// data.add(subData.length);
|
||||
// data.addAll(subData);
|
||||
//
|
||||
// if ((data.length % 16) != 0) {
|
||||
// int add = (16 - data.length % 16);
|
||||
// for (int i = 0; i < add; i++) {
|
||||
// data.add(0);
|
||||
// }
|
||||
// }
|
||||
// print("${commandType!.typeName} SM4Data:$data");
|
||||
// // 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
// return ebcData;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class SenderAddStressFingerprintReply extends Reply {
|
||||
// SenderAddStressFingerprintReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
// : super.parseData(commandType, dataDetail) {
|
||||
// data = dataDetail;
|
||||
// }
|
||||
// }
|
||||
@ -15,134 +15,132 @@ import 'package:crypto/crypto.dart' as crypto;
|
||||
备注:
|
||||
删除单个指纹规则:UseCountLimit 设置为 0。删除全部指纹规则: UseCountLimit 设置为 0,FingerNo 设置为 255,userId 设置为“Delete All !@#”,只有门锁管理员才有权限
|
||||
**/
|
||||
class SenderAddStressICCardCommand extends SenderProtocol {
|
||||
|
||||
String? keyID;
|
||||
String? userID;
|
||||
int? icCardNo;
|
||||
int? cardType;
|
||||
int? useCountLimit;
|
||||
List<int>? token;
|
||||
int? startTime;
|
||||
int? endTime;
|
||||
int? needAuthor;
|
||||
List<int>? publicKey;
|
||||
List<int>? privateKey;
|
||||
List<int>? signKey;
|
||||
|
||||
SenderAddStressICCardCommand({
|
||||
this.keyID,
|
||||
this.userID,
|
||||
this.icCardNo,
|
||||
this.cardType,
|
||||
this.useCountLimit,
|
||||
this.token,
|
||||
this.startTime,
|
||||
this.endTime,
|
||||
this.needAuthor,
|
||||
this.publicKey,
|
||||
this.privateKey,
|
||||
this.signKey
|
||||
}) : super(CommandType.generalExtendedCommond);
|
||||
|
||||
@override
|
||||
List<int> messageDetail() {
|
||||
List<int> data = [];
|
||||
List<int> subData = [];
|
||||
List<int> ebcData = [];
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
|
||||
// 子命令类型
|
||||
data.add(61);
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
// icCardNo
|
||||
subData.add(icCardNo!);
|
||||
|
||||
// cardType
|
||||
subData.add(cardType!);
|
||||
|
||||
// UseCountLimit
|
||||
subData.add(0xff);
|
||||
|
||||
// token
|
||||
subData.addAll(token!);
|
||||
|
||||
// startTime 4
|
||||
subData.add((startTime! & 0xff000000) >> 24);
|
||||
subData.add((startTime! & 0xff0000) >> 16);
|
||||
subData.add((startTime! & 0xff00) >> 8);
|
||||
subData.add((startTime! & 0xff));
|
||||
|
||||
// endTime 4
|
||||
subData.add((endTime! & 0xff000000) >> 24);
|
||||
subData.add((endTime! & 0xff0000) >> 16);
|
||||
subData.add((endTime! & 0xff00) >> 8);
|
||||
subData.add((endTime! & 0xff));
|
||||
|
||||
if(needAuthor == 0){
|
||||
//AuthCodeLen 1
|
||||
subData.add(0);
|
||||
} else {
|
||||
List<int> authCodeData = [];
|
||||
|
||||
//KeyID
|
||||
authCodeData.addAll(utf8.encode(keyID!));
|
||||
|
||||
//authUserID
|
||||
authCodeData.addAll(utf8.encode(userID!));
|
||||
|
||||
//token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||
authCodeData.addAll(token!);
|
||||
|
||||
authCodeData.addAll(signKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
subData.add(authCode.bytes.length);
|
||||
subData.addAll(authCode.bytes);
|
||||
}
|
||||
|
||||
data.add(subData.length);
|
||||
data.addAll(subData);
|
||||
|
||||
if ((data.length % 16) != 0) {
|
||||
int add = (16 - data.length % 16);
|
||||
for (int i = 0; i < add; i++) {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
}
|
||||
|
||||
class SenderAddStressICCardReply extends Reply {
|
||||
SenderAddStressICCardReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
}
|
||||
}
|
||||
// class SenderAddStressICCardCommand extends SenderProtocol {
|
||||
//
|
||||
// String? keyID;
|
||||
// String? userID;
|
||||
// int? icCardNo;
|
||||
// int? cardType;
|
||||
// int? useCountLimit;
|
||||
// List<int>? token;
|
||||
// int? startTime;
|
||||
// int? endTime;
|
||||
// int? needAuthor;
|
||||
// List<int>? publicKey;
|
||||
// List<int>? privateKey;
|
||||
// List<int>? signKey;
|
||||
//
|
||||
// SenderAddStressICCardCommand({
|
||||
// this.keyID,
|
||||
// this.userID,
|
||||
// this.icCardNo,
|
||||
// this.cardType,
|
||||
// this.useCountLimit,
|
||||
// this.token,
|
||||
// this.startTime,
|
||||
// this.endTime,
|
||||
// this.needAuthor,
|
||||
// this.publicKey,
|
||||
// this.privateKey,
|
||||
// this.signKey
|
||||
// }) : super(CommandType.generalExtendedCommond);
|
||||
//
|
||||
// @override
|
||||
// List<int> messageDetail() {
|
||||
// List<int> data = [];
|
||||
// List<int> subData = [];
|
||||
// List<int> ebcData = [];
|
||||
//
|
||||
// // 指令类型
|
||||
// int type = commandType!.typeValue;
|
||||
// double typeDouble = type / 256;
|
||||
// int type1 = typeDouble.toInt();
|
||||
// int type2 = type % 256;
|
||||
// data.add(type1);
|
||||
// data.add(type2);
|
||||
//
|
||||
// // 子命令类型
|
||||
// data.add(61);
|
||||
//
|
||||
// // keyID 40
|
||||
// int keyIDLength = utf8.encode(keyID!).length;
|
||||
// // print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
// subData.addAll(utf8.encode(keyID!));
|
||||
// subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
//
|
||||
// //userID 20
|
||||
// int userIDLength = utf8.encode(userID!).length;
|
||||
// // print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
// subData.addAll(utf8.encode(userID!));
|
||||
// subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
//
|
||||
// // icCardNo
|
||||
// subData.add(icCardNo!);
|
||||
//
|
||||
// // cardType
|
||||
// subData.add(cardType!);
|
||||
//
|
||||
// // UseCountLimit
|
||||
// subData.add(0xff);
|
||||
//
|
||||
// // token
|
||||
// subData.addAll(token!);
|
||||
//
|
||||
// // startTime 4
|
||||
// subData.add((startTime! & 0xff000000) >> 24);
|
||||
// subData.add((startTime! & 0xff0000) >> 16);
|
||||
// subData.add((startTime! & 0xff00) >> 8);
|
||||
// subData.add((startTime! & 0xff));
|
||||
//
|
||||
// // endTime 4
|
||||
// subData.add((endTime! & 0xff000000) >> 24);
|
||||
// subData.add((endTime! & 0xff0000) >> 16);
|
||||
// subData.add((endTime! & 0xff00) >> 8);
|
||||
// subData.add((endTime! & 0xff));
|
||||
//
|
||||
// if(needAuthor == 0){
|
||||
// //AuthCodeLen 1
|
||||
// subData.add(0);
|
||||
// } else {
|
||||
// List<int> authCodeData = [];
|
||||
//
|
||||
// //KeyID
|
||||
// authCodeData.addAll(utf8.encode(keyID!));
|
||||
//
|
||||
// //authUserID
|
||||
// authCodeData.addAll(utf8.encode(userID!));
|
||||
//
|
||||
// //token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||
// authCodeData.addAll(token!);
|
||||
//
|
||||
// authCodeData.addAll(signKey!);
|
||||
//
|
||||
// // 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
// var authCode = crypto.md5.convert(authCodeData);
|
||||
//
|
||||
// subData.add(authCode.bytes.length);
|
||||
// subData.addAll(authCode.bytes);
|
||||
// }
|
||||
//
|
||||
// data.add(subData.length);
|
||||
// data.addAll(subData);
|
||||
//
|
||||
// if ((data.length % 16) != 0) {
|
||||
// int add = (16 - data.length % 16);
|
||||
// for (int i = 0; i < add; i++) {
|
||||
// data.add(0);
|
||||
// }
|
||||
// }
|
||||
// print("${commandType!.typeName} SM4Data:$data");
|
||||
// // 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
// return ebcData;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class SenderAddStressICCardReply extends Reply {
|
||||
// SenderAddStressICCardReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
// : super.parseData(commandType, dataDetail) {
|
||||
// data = dataDetail;
|
||||
// }
|
||||
// }
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -106,8 +108,6 @@ class SenderAddStressPasswordCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -124,7 +124,8 @@ class SenderAddStressPasswordCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -135,5 +136,7 @@ class SenderAddStressPasswordReply extends Reply {
|
||||
SenderAddStressPasswordReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -136,8 +138,6 @@ class AddUserCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -151,7 +151,8 @@ class AddUserCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -162,5 +163,7 @@ class AddUserReply extends Reply {
|
||||
AddUserReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[46];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -8,74 +8,75 @@ import '../io_type.dart';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
//TODO:自动落锁开关
|
||||
class AutomaticPadlockCommand extends SenderProtocol {
|
||||
String? lockID;
|
||||
String? userID;
|
||||
int? autoLockFlag;
|
||||
List<int>? token;
|
||||
int? needAuthor;
|
||||
List<int>? signKey;
|
||||
List<int>? privateKey;
|
||||
AutomaticPadlockCommand({
|
||||
this.lockID,
|
||||
this.userID,
|
||||
this.autoLockFlag,
|
||||
this.token,
|
||||
this.needAuthor,
|
||||
this.signKey,
|
||||
this.privateKey
|
||||
}) : super(CommandType.generalExtendedCommond);
|
||||
|
||||
@override
|
||||
List<int> messageDetail() {
|
||||
List<int> data = [];
|
||||
List<int> subData = [];
|
||||
List<int> ebcData = [];
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
|
||||
// 子命令类型
|
||||
data.add(4);
|
||||
|
||||
//lockID 40
|
||||
int lockIDLength = utf8.encode(lockID!).length;
|
||||
subData.addAll(utf8.encode(lockID!));
|
||||
subData = getFixedLengthList(subData, 40 - lockIDLength);
|
||||
|
||||
//userID 要接受钥匙的用户的useid 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
print("openDoorUserId:${utf8.encode(userID!)} utf8.encode(userID!).length:${utf8.encode(userID!).length}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
// autoLockFlag 0:不自动落锁,1:自动落锁
|
||||
subData.add(autoLockFlag!);
|
||||
|
||||
data.add(subData.length);
|
||||
data.addAll(subData);
|
||||
|
||||
print("data:$data data.length:${data.length} (data.length % 16):${(data.length % 16)}");
|
||||
if ((data.length % 16) != 0) {
|
||||
int add = (16 - data.length % 16);
|
||||
for (int i = 0; i < add; i++) {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
}
|
||||
|
||||
class AutomaticPadlockReply extends Reply {
|
||||
AutomaticPadlockReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
}
|
||||
}
|
||||
/// 废弃
|
||||
// class AutomaticPadlockCommand extends SenderProtocol {
|
||||
// String? lockID;
|
||||
// String? userID;
|
||||
// int? autoLockFlag;
|
||||
// List<int>? token;
|
||||
// int? needAuthor;
|
||||
// List<int>? signKey;
|
||||
// List<int>? privateKey;
|
||||
// AutomaticPadlockCommand({
|
||||
// this.lockID,
|
||||
// this.userID,
|
||||
// this.autoLockFlag,
|
||||
// this.token,
|
||||
// this.needAuthor,
|
||||
// this.signKey,
|
||||
// this.privateKey
|
||||
// }) : super(CommandType.generalExtendedCommond);
|
||||
//
|
||||
// @override
|
||||
// List<int> messageDetail() {
|
||||
// List<int> data = [];
|
||||
// List<int> subData = [];
|
||||
// List<int> ebcData = [];
|
||||
//
|
||||
// // 指令类型
|
||||
// int type = commandType!.typeValue;
|
||||
// double typeDouble = type / 256;
|
||||
// int type1 = typeDouble.toInt();
|
||||
// int type2 = type % 256;
|
||||
// data.add(type1);
|
||||
// data.add(type2);
|
||||
//
|
||||
// // 子命令类型
|
||||
// data.add(4);
|
||||
//
|
||||
// //lockID 40
|
||||
// int lockIDLength = utf8.encode(lockID!).length;
|
||||
// subData.addAll(utf8.encode(lockID!));
|
||||
// subData = getFixedLengthList(subData, 40 - lockIDLength);
|
||||
//
|
||||
// //userID 要接受钥匙的用户的useid 20
|
||||
// int userIDLength = utf8.encode(userID!).length;
|
||||
// print("openDoorUserId:${utf8.encode(userID!)} utf8.encode(userID!).length:${utf8.encode(userID!).length}");
|
||||
// subData.addAll(utf8.encode(userID!));
|
||||
// subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
//
|
||||
// // autoLockFlag 0:不自动落锁,1:自动落锁
|
||||
// subData.add(autoLockFlag!);
|
||||
//
|
||||
// data.add(subData.length);
|
||||
// data.addAll(subData);
|
||||
//
|
||||
// print("data:$data data.length:${data.length} (data.length % 16):${(data.length % 16)}");
|
||||
// if ((data.length % 16) != 0) {
|
||||
// int add = (16 - data.length % 16);
|
||||
// for (int i = 0; i < add; i++) {
|
||||
// data.add(0);
|
||||
// }
|
||||
// }
|
||||
// print("${commandType!.typeName} SM4Data:$data");
|
||||
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
// return ebcData;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class AutomaticPadlockReply extends Reply {
|
||||
// AutomaticPadlockReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
// : super.parseData(commandType, dataDetail) {
|
||||
// data = dataDetail;
|
||||
// }
|
||||
// }
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -110,8 +112,6 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(signKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -128,7 +128,8 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -139,5 +140,7 @@ class ChangeAdministratorPasswordReply extends Reply {
|
||||
ChangeAdministratorPasswordReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,8 @@
|
||||
//TODO:查询指纹状态
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -86,8 +88,6 @@ class SenderCheckingCardStatusCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -104,7 +104,8 @@ class SenderCheckingCardStatusCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
//TODO:查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -87,8 +89,6 @@ class SenderCheckingUserInfoCountCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -105,7 +105,8 @@ class SenderCheckingUserInfoCountCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -116,5 +117,7 @@ class SenderCheckingUserInfoCountReply extends Reply {
|
||||
SenderCheckingUserInfoCountReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,8 @@
|
||||
//TODO:WIFI配网
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -112,8 +114,6 @@ class SenderConfiguringWifiCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -130,7 +130,8 @@ class SenderConfiguringWifiCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -141,5 +142,7 @@ class SenderConfiguringWifiReply extends Reply {
|
||||
SenderConfiguringWifiReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[5];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,8 @@
|
||||
//TODO:添加用户
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -88,8 +90,6 @@ class DeletUserCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
// print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -103,7 +103,8 @@ class DeletUserCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -113,7 +114,8 @@ class DeletUserCommand extends SenderProtocol {
|
||||
class DeletUserReply extends Reply {
|
||||
DeletUserReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
print("$commandType:$dataDetail");
|
||||
data = dataDetail;
|
||||
int status = data[6];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
//TODO:修改用户
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -136,8 +138,6 @@ class EditUserCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
// print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -151,7 +151,8 @@ class EditUserCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -162,5 +163,7 @@ class EditUserReply extends Reply {
|
||||
EditUserReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
// int status = data[6];
|
||||
// errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,8 @@
|
||||
//TODO:添加用户
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../tools/storage.dart';
|
||||
import '../blue_manage.dart';
|
||||
import '../io_tool/io_manager.dart';
|
||||
@ -75,8 +77,6 @@ class FactoryDataResetCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -90,7 +90,8 @@ class FactoryDataResetCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -101,5 +102,7 @@ class FactoryDataResetReply extends Reply {
|
||||
FactoryDataResetReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[6];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -1,134 +1,135 @@
|
||||
|
||||
//TODO:获取锁状态
|
||||
import 'dart:convert';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_type.dart';
|
||||
|
||||
class GetLockStatuCommand extends SenderProtocol {
|
||||
|
||||
String? lockID;
|
||||
String? userID;
|
||||
List<int>? privateKey;
|
||||
GetLockStatuCommand({
|
||||
this.lockID,
|
||||
this.userID,
|
||||
this.privateKey
|
||||
}) : super(CommandType.readLockStatusInfo);
|
||||
|
||||
@override
|
||||
List<int> messageDetail() {
|
||||
List<int> data = [];
|
||||
List<int> ebcData = [];
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
|
||||
// 锁id 40
|
||||
int lockIDLength = utf8.encode(lockID!).length;
|
||||
// print("addUserLockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
data.addAll(utf8.encode(lockID!));
|
||||
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||
|
||||
//userID 要接受钥匙的用户的useid 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("userIDLength:$userIDLength utf8.encode(userID!)${utf8.encode(userID!)}");
|
||||
data.addAll(utf8.encode(userID!));
|
||||
data = getFixedLengthList(data, 20 - userIDLength);
|
||||
|
||||
if ((data.length % 16) != 0) {
|
||||
int add = (16 - data.length % 16);
|
||||
for (int i = 0; i < add; i++) {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
}
|
||||
|
||||
class GetLockStatuReply extends Reply {
|
||||
GetLockStatuReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
|
||||
int status = data[2];
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${commandType.typeValue} 数据解析成功");
|
||||
var softVersion = data.sublist(3, 7);
|
||||
// print("softVersion:$softVersion");
|
||||
|
||||
var power = data[7];
|
||||
// print("power:$power");
|
||||
|
||||
// APP 用户数量
|
||||
var appUserCount = data.sublist(50, 53);
|
||||
// print("appUserCount:$appUserCount");
|
||||
|
||||
// 黑名单用户数量
|
||||
var blacklistCount = data[53];
|
||||
// print("blacklistCount:$blacklistCount");
|
||||
|
||||
// 蓝牙钥匙数量
|
||||
var bleKeyCount = data[54];
|
||||
// print("bleKeyCount:$bleKeyCount");
|
||||
|
||||
// 剩余可添加用户数量
|
||||
var remainCount = data.sublist(54, 56);
|
||||
// print("remainCount:$remainCount");
|
||||
|
||||
// 未上传开锁记录数量
|
||||
var notUploadCount = data.sublist(56, 58);
|
||||
// print("notUploadCount:$notUploadCount");
|
||||
|
||||
// 已设置开门密码数量
|
||||
var pwdCount = data[58];
|
||||
// print("pwdCount:$pwdCount");
|
||||
|
||||
// 已设置开门指纹数量
|
||||
var fingerprintCount = data[59];
|
||||
// print("fingerprintCount:$fingerprintCount");
|
||||
|
||||
// 锁当前时间
|
||||
var lockTime = data.sublist(60, 64);
|
||||
// print("lockTime:$lockTime");
|
||||
|
||||
// 硬件版本信息,为固件升级提供判断依据
|
||||
var hardVersion = data.sublist(64, 68);
|
||||
// print("hardVersion:$hardVersion");
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${commandType.typeValue} 需要鉴权");
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${commandType.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${commandType.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${commandType.typeValue} 领锁失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
///TODO:获取锁状态
|
||||
/// 弃用
|
||||
// import 'dart:convert';
|
||||
//
|
||||
// import '../io_tool/io_tool.dart';
|
||||
// import '../sm4Encipher/sm4.dart';
|
||||
// import '../io_reply.dart';
|
||||
// import '../io_sender.dart';
|
||||
// import '../io_type.dart';
|
||||
//
|
||||
// class GetLockStatuCommand extends SenderProtocol {
|
||||
//
|
||||
// String? lockID;
|
||||
// String? userID;
|
||||
// List<int>? privateKey;
|
||||
// GetLockStatuCommand({
|
||||
// this.lockID,
|
||||
// this.userID,
|
||||
// this.privateKey
|
||||
// }) : super(CommandType.readLockStatusInfo);
|
||||
//
|
||||
// @override
|
||||
// List<int> messageDetail() {
|
||||
// List<int> data = [];
|
||||
// List<int> ebcData = [];
|
||||
//
|
||||
// // 指令类型
|
||||
// int type = commandType!.typeValue;
|
||||
// double typeDouble = type / 256;
|
||||
// int type1 = typeDouble.toInt();
|
||||
// int type2 = type % 256;
|
||||
// data.add(type1);
|
||||
// data.add(type2);
|
||||
//
|
||||
// // 锁id 40
|
||||
// int lockIDLength = utf8.encode(lockID!).length;
|
||||
// // print("addUserLockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
// data.addAll(utf8.encode(lockID!));
|
||||
// data = getFixedLengthList(data, 40 - lockIDLength);
|
||||
//
|
||||
// //userID 要接受钥匙的用户的useid 20
|
||||
// int userIDLength = utf8.encode(userID!).length;
|
||||
// // print("userIDLength:$userIDLength utf8.encode(userID!)${utf8.encode(userID!)}");
|
||||
// data.addAll(utf8.encode(userID!));
|
||||
// data = getFixedLengthList(data, 20 - userIDLength);
|
||||
//
|
||||
// if ((data.length % 16) != 0) {
|
||||
// int add = (16 - data.length % 16);
|
||||
// for (int i = 0; i < add; i++) {
|
||||
// data.add(0);
|
||||
// }
|
||||
// }
|
||||
// print("${commandType!.typeName} SM4Data:$data");
|
||||
// // 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
// return ebcData;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class GetLockStatuReply extends Reply {
|
||||
// GetLockStatuReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
// : super.parseData(commandType, dataDetail) {
|
||||
// data = dataDetail;
|
||||
//
|
||||
// int status = data[2];
|
||||
// errorWithStstus(status);
|
||||
// switch(status){
|
||||
// case 0x00:
|
||||
// //成功
|
||||
// var softVersion = data.sublist(3, 7);
|
||||
// // print("softVersion:$softVersion");
|
||||
//
|
||||
// var power = data[7];
|
||||
// // print("power:$power");
|
||||
//
|
||||
// // APP 用户数量
|
||||
// var appUserCount = data.sublist(50, 53);
|
||||
// // print("appUserCount:$appUserCount");
|
||||
//
|
||||
// // 黑名单用户数量
|
||||
// var blacklistCount = data[53];
|
||||
// // print("blacklistCount:$blacklistCount");
|
||||
//
|
||||
// // 蓝牙钥匙数量
|
||||
// var bleKeyCount = data[54];
|
||||
// // print("bleKeyCount:$bleKeyCount");
|
||||
//
|
||||
// // 剩余可添加用户数量
|
||||
// var remainCount = data.sublist(54, 56);
|
||||
// // print("remainCount:$remainCount");
|
||||
//
|
||||
// // 未上传开锁记录数量
|
||||
// var notUploadCount = data.sublist(56, 58);
|
||||
// // print("notUploadCount:$notUploadCount");
|
||||
//
|
||||
// // 已设置开门密码数量
|
||||
// var pwdCount = data[58];
|
||||
// // print("pwdCount:$pwdCount");
|
||||
//
|
||||
// // 已设置开门指纹数量
|
||||
// var fingerprintCount = data[59];
|
||||
// // print("fingerprintCount:$fingerprintCount");
|
||||
//
|
||||
// // 锁当前时间
|
||||
// var lockTime = data.sublist(60, 64);
|
||||
// // print("lockTime:$lockTime");
|
||||
//
|
||||
// // 硬件版本信息,为固件升级提供判断依据
|
||||
// var hardVersion = data.sublist(64, 68);
|
||||
// // print("hardVersion:$hardVersion");
|
||||
// break;
|
||||
// case 0x06:
|
||||
// //无权限
|
||||
// print("${commandType.typeValue} 需要鉴权");
|
||||
//
|
||||
// break;
|
||||
// case 0x07:
|
||||
// //无权限
|
||||
// print("${commandType.typeValue} 用户无权限");
|
||||
//
|
||||
// break;
|
||||
// case 0x09:
|
||||
// // 权限校验错误
|
||||
// print("${commandType.typeValue} 权限校验错误");
|
||||
//
|
||||
// break;
|
||||
// default:
|
||||
// //失败
|
||||
// print("${commandType.typeValue} 领锁失败");
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@ -1,9 +1,10 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/blue_manage.dart';
|
||||
import 'package:star_lock/blue/sm4Encipher/sm4.dart';
|
||||
|
||||
import '../io_tool/io_manager.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
@ -106,7 +107,8 @@ class GetPrivateKeyCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: utf8.encode(BlueManage().connectDeviceName), mode: SM4CryptoMode.ECB);
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../tools/storage.dart';
|
||||
import '../io_tool/io_manager.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -30,11 +32,10 @@ class GetPublicKeyCommand extends SenderProtocol {
|
||||
// print("type1:$type1");
|
||||
// print("type2:$type2");
|
||||
|
||||
print("lockID:${lockID!} lockID.utf8.encode${utf8.encode(lockID!)}");
|
||||
Get.log("lockID:${lockID!} lockID.utf8.encode${utf8.encode(lockID!)}");
|
||||
int length = utf8.encode(lockID!).length;
|
||||
data.addAll(utf8.encode(lockID!));
|
||||
data = getFixedLengthList(data, 40 - length);
|
||||
// print("dataaaaaa:$data");
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -33,13 +35,11 @@ class GetStarLockStatuInfoCommand extends SenderProtocol {
|
||||
|
||||
// 锁id 40
|
||||
int lockIDLength = utf8.encode(lockID!).length;
|
||||
// print("addUserLockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
data.addAll(utf8.encode(lockID!));
|
||||
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||
|
||||
//userID 要接受钥匙的用户的useid 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("userIDLength:$userIDLength utf8.encode(userID!)${utf8.encode(userID!)}");
|
||||
data.addAll(utf8.encode(userID!));
|
||||
data = getFixedLengthList(data, 20 - userIDLength);
|
||||
|
||||
@ -49,7 +49,8 @@ class GetStarLockStatuInfoCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -62,84 +63,6 @@ class GetStarLockStatuInfoReply extends Reply {
|
||||
data = dataDetail;
|
||||
|
||||
int status = data[2];
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
// print("${commandType.typeValue} 数据解析成功");
|
||||
|
||||
// // 厂商名称
|
||||
// var vendor = data.sublist(3, 23);
|
||||
// // print("softVersion:$softVersion");
|
||||
//
|
||||
// // 锁设备类型
|
||||
// var product = data[23];
|
||||
// // print("product:product");
|
||||
//
|
||||
// // 产品名称
|
||||
// var model = data.sublist(24, 44);
|
||||
// // print("model:model");
|
||||
//
|
||||
// // 软件版本
|
||||
// var fwVersion = data.sublist(44, 64);
|
||||
// // print("fwVersion:fwVersion");
|
||||
//
|
||||
// // 硬件版本
|
||||
// var hwVersion = data.sublist(64, 84);
|
||||
// // print("hwVersion:hwVersion");
|
||||
//
|
||||
// // 厂商序列号
|
||||
// var serialNum0 = data.sublist(84, 100);
|
||||
// // print("serialNum0:serialNum0");
|
||||
//
|
||||
// // 成品商序列号
|
||||
// var serialNum1 = data.sublist(100, 116);
|
||||
// // print("serialNum1:serialNum1");
|
||||
//
|
||||
// // 蓝牙名称
|
||||
// var btDeviceName = data.sublist(116, 132);
|
||||
// // print("btDeviceName:btDeviceName");
|
||||
//
|
||||
// // 电池剩余电量
|
||||
// var battRemCap = data[132];
|
||||
// // print("battRemCap:battRemCap");
|
||||
//
|
||||
// // 重置次数
|
||||
// var restoreCounter = data.sublist(133, 134);
|
||||
// // print("restoreCounter:restoreCounter");
|
||||
//
|
||||
// // 重置时间
|
||||
// var restoreDate = data.sublist(134, 138);
|
||||
// // print("restoreDate:restoreDate");
|
||||
//
|
||||
// // 主控芯片型号
|
||||
// var icPartNo = data.sublist(138, 148);
|
||||
// // print("icPartNo:icPartNo");
|
||||
//
|
||||
// // 有效时间
|
||||
// var indate = data.sublist(148, 152);
|
||||
// // print("indate:indate");
|
||||
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${commandType.typeValue} 需要鉴权");
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${commandType.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${commandType.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${commandType.typeValue} 领锁失败");
|
||||
|
||||
break;
|
||||
}
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -74,8 +76,6 @@ class SenderGetWifiCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -92,7 +92,8 @@ class SenderGetWifiCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -103,6 +104,8 @@ class SenderGetWifiReply extends Reply {
|
||||
SenderGetWifiReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
|
||||
import 'dart:convert';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -50,7 +52,6 @@ class OpenLockCommand extends SenderProtocol {
|
||||
|
||||
//userID 要接受钥匙的用户的useid 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
print("openDoorUserId:${utf8.encode(userID!)} utf8.encode(userID!).length:${utf8.encode(userID!).length}");
|
||||
data.addAll(utf8.encode(userID!));
|
||||
data = getFixedLengthList(data, 20 - userIDLength);
|
||||
|
||||
@ -93,10 +94,8 @@ class OpenLockCommand extends SenderProtocol {
|
||||
}
|
||||
|
||||
//onlineToken 16
|
||||
print("onlineToken:$onlineToken");
|
||||
if(onlineToken!.isNotEmpty){
|
||||
int onlineTokenLength = utf8.encode(onlineToken!).length;
|
||||
print("openDoorOnlineToken:${utf8.encode(onlineToken!)} utf8.encode(onlineToken!).length:${utf8.encode(onlineToken!).length}");
|
||||
data.addAll(utf8.encode(onlineToken!));
|
||||
data = getFixedLengthList(data, 16 - onlineTokenLength);
|
||||
}
|
||||
@ -107,7 +106,8 @@ class OpenLockCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -118,5 +118,7 @@ class OpenDoorReply extends Reply {
|
||||
OpenDoorReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[6];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
//TODO:查询人脸状态
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -84,8 +86,6 @@ class SenderQueryingFaceStatusCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -102,8 +102,8 @@ class SenderQueryingFaceStatusCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
@ -114,5 +114,7 @@ class SenderQueryingFaceStatusReply extends Reply {
|
||||
CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
//TODO:查询指纹状态
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -86,8 +88,6 @@ class SenderQueryingFingerprintStatusCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -104,7 +104,8 @@ class SenderQueryingFingerprintStatusCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -115,5 +116,7 @@ class SenderQueryingFingerprintStatusReply extends Reply {
|
||||
SenderQueryingFingerprintStatusReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -88,8 +90,6 @@ class SenderReadAdminPasswordCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -106,7 +106,8 @@ class SenderReadAdminPasswordCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -117,5 +118,8 @@ class SenderReadAdminPasswordReply extends Reply {
|
||||
SenderReadAdminPasswordReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -79,8 +81,6 @@ class ReadSupportFunctionsNoParametersCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -97,7 +97,8 @@ class ReadSupportFunctionsNoParametersCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -108,5 +109,7 @@ class ReadSupportFunctionsNoParametersReply extends Reply {
|
||||
ReadSupportFunctionsNoParametersReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -79,8 +81,6 @@ class ReadSupportFunctionsWithParametersCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -97,7 +97,8 @@ class ReadSupportFunctionsWithParametersCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -108,5 +109,7 @@ class ReadSupportFunctionsWithParametersReply extends Reply {
|
||||
ReadSupportFunctionsWithParametersReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,8 @@
|
||||
//TODO:查询事件记录(序号、数量查询)
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -47,7 +49,6 @@ class SenderReferEventRecordNumberCommand extends SenderProtocol {
|
||||
|
||||
// 子命令类型
|
||||
data.add(40);
|
||||
print("timeType:${40}");
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
@ -85,8 +86,6 @@ class SenderReferEventRecordNumberCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -103,7 +102,8 @@ class SenderReferEventRecordNumberCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -114,5 +114,7 @@ class SenderReferEventRecordNumberReply extends Reply {
|
||||
SenderReferEventRecordNumberReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,8 @@
|
||||
//TODO:查询事件记录(时间查询)
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -47,7 +49,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
|
||||
|
||||
// 子命令类型
|
||||
data.add(41);
|
||||
print("timeType:${41}");
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
@ -87,8 +89,6 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -105,7 +105,8 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -116,5 +117,7 @@ class SenderReferEventRecordTimeReply extends Reply {
|
||||
SenderReferEventRecordTimeReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -46,8 +48,6 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
|
||||
List<int> subData = [];
|
||||
List<int> ebcData = [];
|
||||
|
||||
print("pwdNopwdNopwdNopwdNo:$pwdNo");
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
@ -115,8 +115,6 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(signKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -133,7 +131,8 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -144,5 +143,7 @@ class SenderCustomPasswordsReply extends Reply {
|
||||
SenderCustomPasswordsReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -84,8 +86,6 @@ class SetSupportFunctionsNoParametersCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -102,7 +102,8 @@ class SetSupportFunctionsNoParametersCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -113,5 +114,7 @@ class SetSupportFunctionsNoParametersReply extends Reply {
|
||||
SetSupportFunctionsNoParametersReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -89,8 +91,6 @@ class SetSupportFunctionsWithParametersCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -107,7 +107,8 @@ class SetSupportFunctionsWithParametersCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -118,5 +119,7 @@ class SetSupportFunctionsWithParametersReply extends Reply {
|
||||
SetSupportFunctionsWithParametersReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
|
||||
import 'dart:convert';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -46,13 +48,13 @@ class TimingCommand extends SenderProtocol {
|
||||
|
||||
//userID 要接受钥匙的用户的useid 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
print("openDoorUserId:${utf8.encode(userID!)} utf8.encode(userID!).length:${utf8.encode(userID!).length}");
|
||||
Get.log("openDoorUserId:${utf8.encode(userID!)} utf8.encode(userID!).length:${utf8.encode(userID!).length}");
|
||||
data.addAll(utf8.encode(userID!));
|
||||
data = getFixedLengthList(data, 20 - userIDLength);
|
||||
|
||||
// nowTime 4
|
||||
int? d1 = nowTime;
|
||||
print("timing d1:$d1");
|
||||
Get.log("timing d1:$d1");
|
||||
data.add((d1! & 0xff000000) >> 24);
|
||||
data.add((d1 & 0xff0000) >> 16);
|
||||
data.add((d1 & 0xff00) >> 8);
|
||||
@ -64,7 +66,8 @@ class TimingCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
@ -74,5 +77,7 @@ class TimingReply extends Reply {
|
||||
TimingReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -96,8 +98,6 @@ class TransferPermissionsCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -111,7 +111,8 @@ class TransferPermissionsCommand extends SenderProtocol {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'io_type.dart';
|
||||
|
||||
abstract class Reply{
|
||||
@ -10,4 +13,117 @@ abstract class Reply{
|
||||
List<int> data = [];
|
||||
Reply.parseData(this.commandType, List<int> dataDetail);
|
||||
|
||||
}
|
||||
void errorWithStstus(int status){
|
||||
Get.log("errorWithStstus status:$status commandType:$commandType");
|
||||
switch(status){
|
||||
case 0x00:
|
||||
// 成功
|
||||
Get.log("$commandType成功");
|
||||
break;
|
||||
case 0x01:
|
||||
// 包格式错误
|
||||
Get.log("${commandType!.typeName}包格式错误");
|
||||
showErrorMessage("包格式错误");
|
||||
break;
|
||||
case 0x02:
|
||||
// 密码错误
|
||||
Get.log("${commandType!.typeName}密码错误");
|
||||
showErrorMessage("密码错误");
|
||||
break;
|
||||
case 0x03:
|
||||
// 网络中断
|
||||
Get.log("${commandType!.typeName}网络中断");
|
||||
break;
|
||||
case 0x04:
|
||||
// 用户未登记
|
||||
Get.log("${commandType!.typeName}用户未登记");
|
||||
showErrorMessage("用户未登记");
|
||||
break;
|
||||
case 0x05:
|
||||
// 参数错误
|
||||
Get.log("${commandType!.typeName}参数错误");
|
||||
break;
|
||||
case 0x06:
|
||||
// 需要鉴权
|
||||
Get.log("${commandType!.typeName}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
// 无权限
|
||||
Get.log("${commandType!.typeName}无权限");
|
||||
break;
|
||||
case 0x08:
|
||||
// 应答超时
|
||||
Get.log("${commandType!.typeName}应答超时");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${commandType!.typeName}权限校验错误");
|
||||
break;
|
||||
case 0x0a:
|
||||
// 钥匙不存在
|
||||
// showErrorMessage("钥匙不存在");
|
||||
Get.log("${commandType!.typeName}钥匙不存在");
|
||||
break;
|
||||
case 0x0b:
|
||||
// 钥匙过期
|
||||
showErrorMessage("钥匙过期");
|
||||
Get.log("${commandType!.typeName}钥匙过期");
|
||||
break;
|
||||
case 0x0c:
|
||||
// 钥匙数量已到上限
|
||||
showErrorMessage("钥匙数量已到上限");
|
||||
Get.log("${commandType!.typeName}钥匙数量已到上限");
|
||||
break;
|
||||
case 0x0d:
|
||||
// 钥匙无效
|
||||
showErrorMessage("钥匙无效");
|
||||
Get.log("${commandType!.typeName}钥匙无效");
|
||||
break;
|
||||
case 0x0e:
|
||||
// 钥匙已存在
|
||||
showErrorMessage("钥匙已存在");
|
||||
Get.log("${commandType!.typeName}钥匙无效");
|
||||
break;
|
||||
case 0x0f:
|
||||
// 用户已存在
|
||||
Get.log("${commandType!.typeName}用户已存在");
|
||||
showErrorMessage("用户已存在");
|
||||
break;
|
||||
case 0x10:
|
||||
// 密码失效
|
||||
Get.log("${commandType!.typeName}密码失效");
|
||||
showErrorMessage("密码失效");
|
||||
break;
|
||||
case 0x11:
|
||||
// 无效指令
|
||||
Get.log("${commandType!.typeName}无效指令");
|
||||
break;
|
||||
case 0x12:
|
||||
// 门锁时间异常
|
||||
Get.log("${commandType!.typeName}门锁时间异常");
|
||||
break;
|
||||
case 0x15:
|
||||
// APP(手机)未联网
|
||||
Get.log("${commandType!.typeName}APP(手机)未联网");
|
||||
showErrorMessage("APP(手机)未联网");
|
||||
break;
|
||||
case 0x16:
|
||||
// 正在开锁中...
|
||||
Get.log("${commandType!.typeName}正在开锁中...");
|
||||
showErrorMessage("正在开锁中...");
|
||||
break;
|
||||
case 0xff:
|
||||
// 异常,未知错误
|
||||
Get.log("${commandType!.typeName} 0xff");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("蓝牙返回其他错误问题");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void showErrorMessage(String message){
|
||||
EasyLoading.showToast(message, duration: 2000.milliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,11 +9,36 @@ enum CommandType {
|
||||
readLockStatusInfo, //读取锁状态信息 = 0x300A
|
||||
transferPermissions, //转移权限 = 0x300B
|
||||
reportDoorOpenRecord, //开门记录上报 = 0x3020
|
||||
generalExtendedCommond, // 通用扩展指令 = 0x3030
|
||||
getLockPublicKey, // 获取锁公钥 = 0x3090
|
||||
getLockPrivateKey, // 获取锁私钥 = 0x3091
|
||||
calibrationTime, // 校时 = 0x30f0
|
||||
readStarLockStatusInfo, //读星锁状态信息 0x3040
|
||||
|
||||
generalExtendedCommond, // 通用扩展指令 = 0x3030
|
||||
gecChangeAdministratorPassword, // 通用扩展指令子命令-修改管理员密码 = 2
|
||||
gecSenderCustomPasswords, // 通用扩展指令子命令-设置开锁密码 = 3
|
||||
gecAutomaticPadlock, // 通用扩展指令子命令-自动落锁开关 = 4
|
||||
gecCheckingUserInfoCount, // 通用扩展指令子命令-查询用户、指纹、密码、卡片数量(用于判断是否同步) = 15
|
||||
gecCheckingCardStatus, // 通用扩展指令子命令-同步用户信息 = 20
|
||||
gecAddICCardConfirmation, // 通用扩展指令子命令-添加IC卡确认 = 22
|
||||
gecAddICCardWithTimeCycleCoercion, // 通用扩展指令子命令-添加IC卡开始 = 24
|
||||
gecQueryingFingerprintStatus, // 通用扩展指令子命令-查询指纹状态 = 30
|
||||
gecAddFingerprintConfirmation, // 通用扩展指令子命令-添加指纹确认 = 32
|
||||
gecAddFingerprintProcess, // 通用扩展指令子命令-注册指纹过程 = 33]
|
||||
gecAddFingerprintWithTimeCycleCoercion, // 通用扩展指令子命令-注册指纹开始(带限时、循环、胁迫...) = 36
|
||||
gecReferEventRecordNumber, // 通用扩展指令子命令-事件查询记录 = 40
|
||||
gecReferEventRecordTime, // 通用扩展指令子命令-时间条件查询事件记录 = 41
|
||||
gecConfiguringWifi, // 通用扩展指令子命令-wifi配网结果 = 51
|
||||
gecGetWifiList, // 通用扩展指令子命令-门锁搜索2.4G WIFI SSID 结果 = 54
|
||||
gecAddStressPassword, // 通用扩展指令子命令-添加胁迫密码 = 60
|
||||
gecSetSupportFunctionsNoParameters, // 通用扩展指令子命令-支持的功能(无参数) = 70
|
||||
gecReadSupportFunctionsNoParameters, // 通用扩展指令子命令-读取支持的功能(无参数) = 71
|
||||
gecSetSupportFunctionsWithParameters, // 通用扩展指令子命令-支持的功能(有参数) = 72
|
||||
gecReadSupportFunctionsWithParameters, // 通用扩展指令子命令-读取支持的功能(有参数) = 73
|
||||
gecSenderReadAdminPassword, // 通用扩展指令子命令-读取管理员密码 = 74
|
||||
gecQueryingFaceStatus, // 通用扩展指令子命令-查询人脸状态 = 80
|
||||
gecAddFace, // 通用扩展指令子命令-注册人脸开始 = 82
|
||||
gecAddFaceConfirmation, // 通用扩展指令子命令-添加人脸确认 = 84
|
||||
}
|
||||
|
||||
extension ExtensionCommandType on CommandType {
|
||||
|
||||
@ -158,11 +158,12 @@ class CommandReciverManager {
|
||||
reply = OpenDoorReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
case CommandType.readLockStatusInfo:
|
||||
{
|
||||
reply = GetLockStatuReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
// 弃用
|
||||
// case CommandType.readLockStatusInfo:
|
||||
// {
|
||||
// reply = GetLockStatuReply.parseData(commandType, data);
|
||||
// }
|
||||
// break;
|
||||
case CommandType.editUser:
|
||||
{
|
||||
reply = EditUserReply.parseData(commandType, data);
|
||||
@ -207,12 +208,12 @@ class CommandReciverManager {
|
||||
SenderCustomPasswordsReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
// 自动落锁开关
|
||||
reply = AutomaticPadlockReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
// case 4:
|
||||
// {
|
||||
// // 自动落锁开关
|
||||
// reply = AutomaticPadlockReply.parseData(commandType, data);
|
||||
// }
|
||||
// break;
|
||||
case 15:
|
||||
{
|
||||
// 查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
||||
@ -291,7 +292,7 @@ class CommandReciverManager {
|
||||
break;
|
||||
case 41:
|
||||
{
|
||||
// 事件查询记录
|
||||
// 时间条件查询事件记录
|
||||
reply = SenderReferEventRecordTimeReply.parseData(
|
||||
commandType, data);
|
||||
}
|
||||
@ -312,8 +313,7 @@ class CommandReciverManager {
|
||||
case 53:
|
||||
{
|
||||
// 获取wifilist
|
||||
reply =
|
||||
SenderGetWifiReply.parseData(commandType, data);
|
||||
reply = SenderGetWifiReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
case 54:
|
||||
@ -336,13 +336,13 @@ class CommandReciverManager {
|
||||
// SenderAddStressICCardReply.parseData(commandType, data);
|
||||
// }
|
||||
// break;
|
||||
case 62:
|
||||
{
|
||||
// 注册胁迫指纹
|
||||
reply = SenderAddStressFingerprintReply.parseData(
|
||||
commandType, data);
|
||||
}
|
||||
break;
|
||||
// case 62:
|
||||
// {
|
||||
// // 注册胁迫指纹
|
||||
// reply = SenderAddStressFingerprintReply.parseData(
|
||||
// commandType, data);
|
||||
// }
|
||||
// break;
|
||||
case 70:
|
||||
{
|
||||
// 设置支持功能(不带参数)启用/禁用
|
||||
|
||||
@ -188,20 +188,20 @@ class IoSenderManage {
|
||||
callBack: callBack);
|
||||
}
|
||||
|
||||
//todo:获取锁状态
|
||||
static void senderGetLockStatu(
|
||||
{String? lockID,
|
||||
String? userID,
|
||||
List<int>? privateKey,
|
||||
CommandSendCallBack? callBack}) {
|
||||
CommandSenderManager().managerSendData(
|
||||
command: GetLockStatuCommand(
|
||||
lockID: lockID,
|
||||
userID: userID,
|
||||
privateKey: privateKey,
|
||||
),
|
||||
callBack: callBack);
|
||||
}
|
||||
//todo:获取锁状态 弃用
|
||||
// static void senderGetLockStatu(
|
||||
// {String? lockID,
|
||||
// String? userID,
|
||||
// List<int>? privateKey,
|
||||
// CommandSendCallBack? callBack}) {
|
||||
// CommandSenderManager().managerSendData(
|
||||
// command: GetLockStatuCommand(
|
||||
// lockID: lockID,
|
||||
// userID: userID,
|
||||
// privateKey: privateKey,
|
||||
// ),
|
||||
// callBack: callBack);
|
||||
// }
|
||||
|
||||
//todo:获取星锁状态信息
|
||||
static void senderGetStarLockStatuInfo(
|
||||
@ -370,8 +370,8 @@ class IoSenderManage {
|
||||
required int? weekRound,
|
||||
required int? startDate,
|
||||
required int? endDate,
|
||||
required int? startTime,
|
||||
required int? endTime,
|
||||
required String? startTime,
|
||||
required String? endTime,
|
||||
required int? needAuthor,
|
||||
required List<int>? signKey,
|
||||
required List<int>? privateKey,
|
||||
@ -439,8 +439,8 @@ class IoSenderManage {
|
||||
required int? weekRound,
|
||||
required int? startDate,
|
||||
required int? endDate,
|
||||
required int? startTime,
|
||||
required int? endTime,
|
||||
required String? startTime,
|
||||
required String? endTime,
|
||||
required int? needAuthor,
|
||||
required List<int>? signKey,
|
||||
required List<int>? privateKey,
|
||||
@ -751,36 +751,36 @@ class IoSenderManage {
|
||||
}
|
||||
|
||||
//todo:添加胁迫指纹
|
||||
static void senderAddStressFingerprintCommand(
|
||||
{required String? keyID,
|
||||
required String? userID,
|
||||
required int? fingerNo,
|
||||
required int? fingerType,
|
||||
required int? useCountLimit,
|
||||
required List<int>? token,
|
||||
required int? startTime,
|
||||
required int? endTime,
|
||||
required int? needAuthor,
|
||||
required List<int>? publicKey,
|
||||
required List<int>? privateKey,
|
||||
required List<int>? signKey,
|
||||
CommandSendCallBack? callBack}) {
|
||||
CommandSenderManager().managerSendData(
|
||||
command: SenderAddStressFingerprintCommand(
|
||||
keyID: keyID,
|
||||
userID: userID,
|
||||
fingerNo: fingerNo,
|
||||
fingerType: fingerType,
|
||||
useCountLimit: useCountLimit,
|
||||
token: token,
|
||||
startTime: startTime,
|
||||
endTime: endTime,
|
||||
needAuthor: needAuthor,
|
||||
publicKey: publicKey,
|
||||
privateKey: privateKey,
|
||||
signKey: signKey),
|
||||
callBack: callBack);
|
||||
}
|
||||
// static void senderAddStressFingerprintCommand(
|
||||
// {required String? keyID,
|
||||
// required String? userID,
|
||||
// required int? fingerNo,
|
||||
// required int? fingerType,
|
||||
// required int? useCountLimit,
|
||||
// required List<int>? token,
|
||||
// required int? startTime,
|
||||
// required int? endTime,
|
||||
// required int? needAuthor,
|
||||
// required List<int>? publicKey,
|
||||
// required List<int>? privateKey,
|
||||
// required List<int>? signKey,
|
||||
// CommandSendCallBack? callBack}) {
|
||||
// CommandSenderManager().managerSendData(
|
||||
// command: SenderAddStressFingerprintCommand(
|
||||
// keyID: keyID,
|
||||
// userID: userID,
|
||||
// fingerNo: fingerNo,
|
||||
// fingerType: fingerType,
|
||||
// useCountLimit: useCountLimit,
|
||||
// token: token,
|
||||
// startTime: startTime,
|
||||
// endTime: endTime,
|
||||
// needAuthor: needAuthor,
|
||||
// publicKey: publicKey,
|
||||
// privateKey: privateKey,
|
||||
// signKey: signKey),
|
||||
// callBack: callBack);
|
||||
// }
|
||||
|
||||
//todo:添加胁迫卡片
|
||||
// static void senderAddStressICCardCommand(
|
||||
|
||||
@ -60,7 +60,7 @@ class AddCardTypeLogic extends BaseGetXController{
|
||||
fingerprintType = 4;
|
||||
}
|
||||
|
||||
var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1:非胁迫卡 2:胁迫卡
|
||||
// var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1:非胁迫卡 2:胁迫卡
|
||||
Get.toNamed(Routers.addICCardPage, arguments: {
|
||||
"lockId": state.lockId.value,
|
||||
"endDate": endDate,
|
||||
@ -68,7 +68,7 @@ class AddCardTypeLogic extends BaseGetXController{
|
||||
"cardName": state.nameController.text,
|
||||
"cardNumber": "123456",
|
||||
"cardType": fingerprintType.toString(),
|
||||
"isCoerced": isCoerced,
|
||||
"isCoerced": state.isStressFingerprint.value == false ? "1" : "2",
|
||||
"startDate": startDate,
|
||||
"weekDay": state.weekdaysList.value,
|
||||
"fromType": state.fromType.value,
|
||||
|
||||
@ -46,7 +46,9 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
}
|
||||
state.fromType.value = widget.fromType;
|
||||
|
||||
return indexChangeWidget();
|
||||
return SingleChildScrollView(
|
||||
child: indexChangeWidget()
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -14,6 +14,7 @@ import '../../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||
import '../../../../blue/sender_manage.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import 'addICCard_state.dart';
|
||||
@ -68,8 +69,10 @@ class AddICCardLogic extends BaseGetXController{
|
||||
int index = day % 7; // 将周日的索引转换为 0
|
||||
weekStr = '${weekStr.substring(0, index)}1${weekStr.substring(index + 1)}';
|
||||
}
|
||||
// print("weekStrweekStrweekStr:$weekStr");
|
||||
// 倒序 weekStr
|
||||
weekStr = weekStr.split('').reversed.join('');
|
||||
int weekRound = int.parse(weekStr, radix: 2);
|
||||
// print("weekStrweekStrweekStr:$weekStr weekRound:$weekRound");
|
||||
|
||||
var token = reply.data.sublist(5, 9);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
@ -85,22 +88,14 @@ class AddICCardLogic extends BaseGetXController{
|
||||
weekRound:weekRound, // 周循环
|
||||
startDate: int.parse(state.startDate.value)~/1000,
|
||||
endDate: int.parse(state.endDate.value)~/1000,
|
||||
startTime:int.parse(state.effectiveDateTime.value)~/1000,
|
||||
endTime:int.parse(state.failureDateTime.value)~/1000,
|
||||
startTime:DateTool().dateToHNString(state.effectiveDateTime.value),
|
||||
endTime:DateTool().dateToHNString(state.failureDateTime.value),
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: token,
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
@ -134,20 +129,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
// // 如果是胁迫指纹在 添加完之后以后再调用添加胁迫指纹的
|
||||
// addICCardData();
|
||||
// }
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
@ -225,12 +206,15 @@ class AddICCardLogic extends BaseGetXController{
|
||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var weekStr = "00000000";
|
||||
print("state.weekDay.value:${state.weekDay.value}");
|
||||
for (var day in state.weekDay.value) {
|
||||
int index = day % 7; // 将周日的索引转换为 0
|
||||
weekStr = '${weekStr.substring(0, index)}1${weekStr.substring(index + 1)}';
|
||||
}
|
||||
// print("weekStrweekStrweekStr:$weekStr");
|
||||
// 倒序 weekStr
|
||||
weekStr = weekStr.split('').reversed.join('');
|
||||
int weekRound = int.parse(weekStr, radix: 2);
|
||||
// print("weekStrweekStrweekStr:$weekStr weekRound:$weekRound");
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
@ -247,31 +231,18 @@ class AddICCardLogic extends BaseGetXController{
|
||||
userID:await Storage.getUid(),
|
||||
cardNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
useCountLimit:0xff,
|
||||
isForce:state.isCoerced.value == "1" ? 0 : 1, // 是否是胁迫
|
||||
isForce:state.isCoerced.value == "2" ? 1 : 0, // 是否是胁迫
|
||||
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
||||
weekRound:weekRound, // 周循环
|
||||
startDate: int.parse(state.startDate.value)~/1000,
|
||||
endDate: int.parse(state.endDate.value)~/1000,
|
||||
startTime:int.parse(state.effectiveDateTime.value)~/1000,
|
||||
endTime:int.parse(state.failureDateTime.value)~/1000,
|
||||
startTime:DateTool().dateToHNString(state.effectiveDateTime.value),
|
||||
endTime:DateTool().dateToHNString(state.failureDateTime.value),
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
);
|
||||
|
||||
// IoSenderManage.senderAddICCardCommand(
|
||||
// keyID:"1",
|
||||
// userID:await Storage.getUid(),
|
||||
// cardNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
// useCountLimit:0xff,
|
||||
// startTime:int.parse(state.startDate.value)~/1000,
|
||||
// endTime:int.parse(state.endDate.value)~/1000,
|
||||
// needAuthor:1,
|
||||
// signKey:signKeyDataList,
|
||||
// privateKey:getPrivateKeyList,
|
||||
// token: getTokenList,
|
||||
// );
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected){
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
showBlueConnetctToast();
|
||||
|
||||
@ -69,22 +69,14 @@ class CardDetailLogic extends BaseGetXController{
|
||||
weekRound:0, // 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
startTime:"0",
|
||||
endTime:"0",
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
@ -128,8 +120,8 @@ class CardDetailLogic extends BaseGetXController{
|
||||
weekRound:0, // 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
startTime:"0",
|
||||
endTime:"0",
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
|
||||
@ -46,7 +46,6 @@ class CardListLogic extends BaseGetXController {
|
||||
// 添加卡片开始(此处用作删除卡片)
|
||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
Get.log("_replyAddFingerprintStatus:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
@ -82,22 +81,14 @@ class CardListLogic extends BaseGetXController {
|
||||
weekRound:0, // 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
startTime:"0",
|
||||
endTime:"0",
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: token,
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
@ -186,17 +177,9 @@ class CardListLogic extends BaseGetXController {
|
||||
// _getLockStatus();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//需要鉴权
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
@ -289,8 +272,8 @@ class CardListLogic extends BaseGetXController {
|
||||
weekRound:0, // 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
startTime:"0",
|
||||
endTime:"0",
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
|
||||
@ -72,17 +72,17 @@ class KeyOperationRecordLogic extends BaseGetXController {
|
||||
int status = reply.data[2];
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType}数据解析成功");
|
||||
//成功
|
||||
Get.log("${reply.commandType}数据解析成功");
|
||||
if (reply.data[5] > 0) {
|
||||
reply.data.removeRange(0, 6);
|
||||
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||||
var getList = splitList(reply.data, 8);
|
||||
print("getList:$getList");
|
||||
// print("getList:$getList");
|
||||
var uploadList = [];
|
||||
for (int i = 0; i < getList.length; i++) {
|
||||
var indexList = getList[i];
|
||||
print("indexList:$indexList");
|
||||
// print("indexList:$indexList");
|
||||
var indexMap = {};
|
||||
indexMap["seq"] = indexList[0].toString();
|
||||
indexMap["user"] = indexList[3].toString();
|
||||
@ -105,24 +105,11 @@ class KeyOperationRecordLogic extends BaseGetXController {
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//无权限
|
||||
print("${reply.commandType}需要鉴权");
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType}用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType}权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType}失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -156,8 +143,7 @@ class KeyOperationRecordLogic extends BaseGetXController {
|
||||
|
||||
// 查询事件记录(时间查询)
|
||||
Future<void> senderReferEventRecordTime(int time) async {
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState state) async {
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async {
|
||||
if (state == BluetoothConnectionState.connected) {
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -5,6 +5,7 @@ import 'dart:async';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
import '../../../../../blue/blue_manage.dart';
|
||||
// import '../../../../../blue/io_protocol/io_addFingerprint.dart';
|
||||
@ -43,15 +44,15 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 添加胁迫指纹
|
||||
if(reply is SenderAddStressFingerprintReply) {
|
||||
_replyAddStressFingerprint(reply);
|
||||
}
|
||||
// if(reply is SenderAddStressFingerprintReply) {
|
||||
// _replyAddStressFingerprint(reply);
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
Get.log("status:$status");
|
||||
// Get.log("status:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
@ -77,7 +78,6 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
var token = reply.data.sublist(5, 9);
|
||||
print("tokentokentokentoken:$token");
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
@ -86,7 +86,8 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
int index = day % 7; // 将周日的索引转换为 0
|
||||
weekStr = '${weekStr.substring(0, index)}1${weekStr.substring(index + 1)}';
|
||||
}
|
||||
// print("weekStrweekStrweekStr:$weekStr");
|
||||
// 倒序 weekStr
|
||||
weekStr = weekStr.split('').reversed.join('');
|
||||
int weekRound = int.parse(weekStr, radix: 2);
|
||||
|
||||
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||
@ -99,8 +100,8 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
weekRound:weekRound, // 周循环
|
||||
startDate: int.parse(state.startDate.value)~/1000,
|
||||
endDate: int.parse(state.endDate.value)~/1000,
|
||||
startTime:int.parse(state.effectiveDateTime.value)~/1000,
|
||||
endTime:int.parse(state.failureDateTime.value)~/1000,
|
||||
startTime:DateTool().dateToHNString(state.effectiveDateTime.value),
|
||||
endTime:DateTool().dateToHNString(state.failureDateTime.value),
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
@ -154,14 +155,6 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
case 0x06:
|
||||
//需要权限
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
@ -193,14 +186,6 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
case 0x06:
|
||||
//需要权限
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
@ -208,61 +193,61 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _replyAddStressFingerprint(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
Get.log("status:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
// print("添加指纹确认成功,调用添加指纹接口");
|
||||
addFingerprintsData();
|
||||
break;
|
||||
case 0x06:
|
||||
//需要权限
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> getSignKeyList = changeStringListToIntList(signKey!);
|
||||
|
||||
var token = reply.data.sublist(5, 9);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
IoSenderManage.senderAddStressFingerprintCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
fingerNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
fingerType:1,
|
||||
useCountLimit:1,
|
||||
startTime:int.parse(state.startDate.value)~/1000,
|
||||
endTime:int.parse(state.endDate.value)~/1000,
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: token,
|
||||
signKey: getSignKeyList
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Future<void> _replyAddStressFingerprint(Reply reply) async {
|
||||
// int status = reply.data[2];
|
||||
// Get.log("status:$status");
|
||||
//
|
||||
// switch(status){
|
||||
// case 0x00:
|
||||
// //成功
|
||||
// Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
// // print("添加指纹确认成功,调用添加指纹接口");
|
||||
// addFingerprintsData();
|
||||
// break;
|
||||
// case 0x06:
|
||||
// //需要权限
|
||||
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
//
|
||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
//
|
||||
// var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
// List<int> getSignKeyList = changeStringListToIntList(signKey!);
|
||||
//
|
||||
// var token = reply.data.sublist(5, 9);
|
||||
// var saveStrList = changeIntListToStringList(token);
|
||||
// Storage.setStringList(saveBlueToken, saveStrList);
|
||||
//
|
||||
// IoSenderManage.senderAddStressFingerprintCommand(
|
||||
// keyID:"1",
|
||||
// userID:await Storage.getUid(),
|
||||
// fingerNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
// fingerType:1,
|
||||
// useCountLimit:1,
|
||||
// startTime:int.parse(state.startDate.value)~/1000,
|
||||
// endTime:int.parse(state.endDate.value)~/1000,
|
||||
// needAuthor:1,
|
||||
// publicKey:publicKeyDataList,
|
||||
// privateKey:getPrivateKeyList,
|
||||
// token: token,
|
||||
// signKey: getSignKeyList
|
||||
// );
|
||||
// break;
|
||||
// case 0x07:
|
||||
// //无权限
|
||||
// Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
// break;
|
||||
// case 0x09:
|
||||
// // 权限校验错误
|
||||
// Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
// break;
|
||||
// default:
|
||||
// //失败
|
||||
// Get.log("${reply.commandType!.typeValue} 失败");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// 添加指纹开始
|
||||
Future<void> senderAddFingerprint() async {
|
||||
@ -280,8 +265,10 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
int index = day % 7; // 将周日的索引转换为 0
|
||||
weekStr = '${weekStr.substring(0, index)}1${weekStr.substring(index + 1)}';
|
||||
}
|
||||
// print("weekStrweekStrweekStr:$weekStr");
|
||||
// 倒序 weekStr
|
||||
weekStr = weekStr.split('').reversed.join('');
|
||||
int weekRound = int.parse(weekStr, radix: 2);
|
||||
// Get.log("weekStrweekStrweekStr:$weekStr weekRound:$weekRound");
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
@ -292,19 +279,19 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
Get.log("state.isAdministrator.value:${state.isAdministrator.value}");
|
||||
Get.log("state.isCoerced.value:${state.isCoerced.value}");
|
||||
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
fingerNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
useCountLimit:0xff,
|
||||
isForce:state.isCoerced.value == "1" ? 0 : 1, // 是否是胁迫
|
||||
isForce:state.isCoerced.value == "2" ? 1 : 0, // 是否是胁迫
|
||||
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
||||
weekRound:weekRound, // 周循环
|
||||
startDate: int.parse(state.startDate.value)~/1000,
|
||||
endDate: int.parse(state.endDate.value)~/1000,
|
||||
startTime:int.parse(state.effectiveDateTime.value)~/1000,
|
||||
endTime:int.parse(state.failureDateTime.value)~/1000,
|
||||
startTime:DateTool().dateToHNString(state.effectiveDateTime.value),
|
||||
endTime:DateTool().dateToHNString(state.failureDateTime.value),
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
@ -360,38 +347,38 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 添加胁迫指纹
|
||||
Future<void> senderAddStressFingerprint() async {
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> getSignKeyList = changeStringListToIntList(signKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
IoSenderManage.senderAddStressFingerprintCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
fingerNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
fingerType:1,
|
||||
useCountLimit:1,
|
||||
startTime:int.parse(state.startDate.value)~/1000,
|
||||
endTime:int.parse(state.endDate.value)~/1000,
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
signKey: getSignKeyList
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
// Future<void> senderAddStressFingerprint() async {
|
||||
// BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||
// if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
//
|
||||
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
//
|
||||
// var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
// List<int> getSignKeyList = changeStringListToIntList(signKey!);
|
||||
//
|
||||
// var token = await Storage.getStringList(saveBlueToken);
|
||||
// List<int> getTokenList = changeStringListToIntList(token!);
|
||||
//
|
||||
// IoSenderManage.senderAddStressFingerprintCommand(
|
||||
// keyID:"1",
|
||||
// userID:await Storage.getUid(),
|
||||
// fingerNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
// fingerType:1,
|
||||
// useCountLimit:1,
|
||||
// startTime:int.parse(state.startDate.value)~/1000,
|
||||
// endTime:int.parse(state.endDate.value)~/1000,
|
||||
// needAuthor:1,
|
||||
// publicKey:publicKeyDataList,
|
||||
// privateKey:getPrivateKeyList,
|
||||
// token: getTokenList,
|
||||
// signKey: getSignKeyList
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// 添加指纹
|
||||
void addFingerprintsData() async{
|
||||
|
||||
@ -40,7 +40,9 @@ class AddFingerprintState{
|
||||
weekDay.value = map["weekDay"];
|
||||
fromType.value = map["fromType"];
|
||||
effectiveDateTime.value = map["effectiveTime"];
|
||||
Get.log("effectiveDateTime.value:${effectiveDateTime.value}");
|
||||
failureDateTime.value = map["failureTime"];
|
||||
Get.log("failureDateTime.value:${failureDateTime.value}");
|
||||
selectType.value = map["selectType"];
|
||||
}
|
||||
}
|
||||
@ -59,8 +59,8 @@ class AddFingerprintTypeLogic extends BaseGetXController{
|
||||
fingerprintType = 4;
|
||||
}
|
||||
|
||||
var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1:非胁迫指纹 2:胁迫指纹
|
||||
Get.log("addOtherType startDate:$startDate endDate:$endDate isCoerced:$isCoerced");
|
||||
// var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1:非胁迫指纹 2:胁迫指纹
|
||||
// Get.log("addOtherType startDate:$startDate endDate:$endDate isCoerced:$isCoerced");
|
||||
|
||||
// 指纹
|
||||
Get.toNamed(Routers.addFingerprintPage, arguments: {
|
||||
@ -70,7 +70,7 @@ class AddFingerprintTypeLogic extends BaseGetXController{
|
||||
"fingerprintName": state.nameController.text,
|
||||
"fingerprintNumber": "123456",
|
||||
"fingerprintType": fingerprintType.toString(),
|
||||
"isCoerced": isCoerced, // 1:非胁迫指纹 2:胁迫指纹
|
||||
"isCoerced": state.isStressFingerprint.value == false ? "1" : "2", // 1:非胁迫指纹 2:胁迫指纹
|
||||
"startDate": startDate,
|
||||
"weekDay": state.weekdaysList.value,
|
||||
"fromType": state.fromType.value,
|
||||
|
||||
@ -62,7 +62,9 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
||||
}
|
||||
state.fromType.value = widget.fromType;
|
||||
|
||||
return indexChangeWidget();
|
||||
return SingleChildScrollView(
|
||||
child: indexChangeWidget()
|
||||
);
|
||||
}
|
||||
|
||||
Widget indexChangeWidget() {
|
||||
@ -415,6 +417,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
||||
value: state.isStressFingerprint.value,
|
||||
onChanged: (value) {
|
||||
state.isStressFingerprint.value = value;
|
||||
// Get.log("state.isStressFingerprint.value:${state.isStressFingerprint.value}");
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ class FingerprintDetailLogic extends BaseGetXController{
|
||||
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||
|
||||
int status = reply.data[2];
|
||||
Get.log("status:$status");
|
||||
// Get.log("status:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
@ -71,22 +71,14 @@ class FingerprintDetailLogic extends BaseGetXController{
|
||||
weekRound:0, // 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
startTime:"0",
|
||||
endTime:"0",
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
@ -130,8 +122,8 @@ class FingerprintDetailLogic extends BaseGetXController{
|
||||
weekRound:0, // 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
startTime:"0",
|
||||
endTime:"0",
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
|
||||
@ -46,7 +46,7 @@ class FingerprintListLogic extends BaseGetXController{
|
||||
// 添加指纹开始---这里用作删除指纹
|
||||
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
Get.log("status:$status");
|
||||
// Get.log("status:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
@ -95,23 +95,13 @@ class FingerprintListLogic extends BaseGetXController{
|
||||
weekRound:0, // 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
startTime:"0",
|
||||
endTime:"0",
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
@ -124,32 +114,19 @@ class FingerprintListLogic extends BaseGetXController{
|
||||
// 获取指纹状态
|
||||
Future<void> _replyQueryingFingerprintStatus(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
//成功
|
||||
Get.log("${reply.commandType}数据解析成功");
|
||||
// _getLockStatus();
|
||||
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//需要鉴权
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType}失败");
|
||||
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -242,14 +219,6 @@ class FingerprintListLogic extends BaseGetXController{
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
@ -341,8 +310,8 @@ class FingerprintListLogic extends BaseGetXController{
|
||||
weekRound:0, // 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
startTime:"0",
|
||||
endTime:"0",
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
|
||||
@ -219,19 +219,9 @@ class IrisListLogic extends BaseGetXController {
|
||||
// _getLockStatus();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//需要鉴权
|
||||
print("${reply.commandType}需要鉴权");
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType}用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType}权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
|
||||
@ -66,7 +66,6 @@ class LockDetailLogic extends BaseGetXController {
|
||||
// 开门数据解析
|
||||
Future<void> _replyOpenLock(Reply reply) async {
|
||||
int status = reply.data[6];
|
||||
Get.log("replyOpenLock status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
@ -353,16 +352,6 @@ class LockDetailLogic extends BaseGetXController {
|
||||
privateKey: getPrivateKeyList,
|
||||
token: token);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("添加用户权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("领锁失败");
|
||||
@ -378,6 +367,21 @@ class LockDetailLogic extends BaseGetXController {
|
||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||
});
|
||||
|
||||
// var listData = AddUserCommand(
|
||||
// lockID: BlueManage().connectDeviceName,
|
||||
// authUserID: state.senderUserId.toString(),
|
||||
// keyID: state.keyInfos.value.keyId.toString(),
|
||||
// userID: await Storage.getUid(),
|
||||
// openMode: 1,
|
||||
// keyType: 0,
|
||||
// startDate: state.keyInfos.value.startDate!~/10000,
|
||||
// expireDate: state.keyInfos.value.endDate!~/10000,
|
||||
// role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
|
||||
// password: "123456",
|
||||
// needAuthor: 1,
|
||||
// publicKey: publicKeyDataList,
|
||||
// privateKey: getPrivateKeyList,
|
||||
// token: getTokenList).packageData();
|
||||
BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
// 私钥
|
||||
@ -409,8 +413,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: getTokenList);
|
||||
} else if (deviceConnectionState ==
|
||||
BluetoothConnectionState.disconnected) {
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
cancelBlueConnetctToastTimer();
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
@ -438,19 +441,6 @@ class LockDetailLogic extends BaseGetXController {
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
// print("调用了开锁事件 openDoorTokenPubToken:$getTokenList getPrivateKeyList:$getPrivateKeyList");
|
||||
// List<int>listData = await IoSenderManage.senderOpenLock(
|
||||
// keyID: BlueManage().connectDeviceName,
|
||||
// userID: await Storage.getUid(),
|
||||
// openMode: openMode,
|
||||
// openTime: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||
// onlineToken: state.lockNetToken,
|
||||
// token: getTokenList,
|
||||
// needAuthor: 1,
|
||||
// signKey: signKeyDataList,
|
||||
// privateKey: getPrivateKeyList,
|
||||
// );
|
||||
|
||||
Get.log("openMode:${state.openDoorModel}");
|
||||
BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
|
||||
@ -113,19 +113,8 @@ class AutomaticBlockingLogic extends BaseGetXController{
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,20 +76,8 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
privateKey: getPrivateKeyList,
|
||||
token: token);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
//失败
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -152,17 +140,8 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
privateKey: getPrivateKeyList
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,6 +143,19 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
});
|
||||
}),
|
||||
)),
|
||||
Obx(() => Visibility(
|
||||
visible: state.lockBasicInfo.value.lockName!.contains("T9A"),
|
||||
child: CommonItem(
|
||||
leftTitel: "当前网络",
|
||||
rightTitle: state.lockBasicInfo.value.lockName ?? "",
|
||||
allHeight: 70.h,
|
||||
isHaveLine: true),
|
||||
)),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "位置信息",
|
||||
rightTitle: state.lockBasicInfo.value.lockName ?? "",
|
||||
allHeight: 70.h,
|
||||
isHaveLine: true)),
|
||||
/* 2024-01-12 会议确定去掉“微信二维码” by DaisyWu
|
||||
CommonItem(
|
||||
leftTitel:
|
||||
|
||||
@ -106,14 +106,14 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
IoSenderManage.senderGetStarLockStatuInfo(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
|
||||
@ -96,17 +96,7 @@ class BurglarAlarmLogic extends BaseGetXController{
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -154,32 +144,6 @@ class BurglarAlarmLogic extends BaseGetXController{
|
||||
});
|
||||
}
|
||||
|
||||
// Timer? _timer;
|
||||
// // CancelableOperation? _operation;
|
||||
// void showBlueConnetctToastTimer({bool isShowBlueConnetctToast = true, Function? action}) {
|
||||
// if (_timer != null && _timer!.isActive) {
|
||||
// _timer!.cancel();
|
||||
// _timer = null;
|
||||
// }
|
||||
// _timer = Timer.periodic(15.seconds, (timer) {
|
||||
// if (action != null) {
|
||||
// action();
|
||||
// }
|
||||
// cancelBlueConnetctToastTimer();
|
||||
// if (isShowBlueConnetctToast == true) {
|
||||
// showBlueConnetctToast();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// void cancelBlueConnetctToastTimer() {
|
||||
// Get.log('cancelBlueConnetctToastTimer');
|
||||
// if (_timer != null && _timer!.isActive) {
|
||||
// _timer!.cancel();
|
||||
// _timer = null;
|
||||
// }
|
||||
// }
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
|
||||
@ -117,14 +117,6 @@ class ConfiguringWifiLogic extends BaseGetXController{
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}校验错误");
|
||||
break;
|
||||
case 0xff:
|
||||
//成功
|
||||
|
||||
@ -46,16 +46,26 @@ class WifiListLogic extends BaseGetXController {
|
||||
});
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
// 需要鉴权
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
|
||||
// var token = await Storage.getStringList(saveBlueToken);
|
||||
// List<int> getTokenList = changeStringListToIntList(token!);
|
||||
//
|
||||
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
//
|
||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
//
|
||||
// IoSenderManage.getWifiListCommand(
|
||||
// keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
|
||||
// userID: await Storage.getUid(),
|
||||
// token: getTokenList,
|
||||
// needAuthor: 1,
|
||||
// publicKey: publicKeyDataList,
|
||||
// privateKey: getPrivateKeyList,
|
||||
// );
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
@ -95,18 +105,6 @@ class WifiListLogic extends BaseGetXController {
|
||||
// print("reply.data:${reply.data} getList:$getList}");
|
||||
}
|
||||
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
|
||||
@ -120,8 +120,6 @@ class LockSetLogic extends BaseGetXController {
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[6];
|
||||
Get.log("status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
@ -239,23 +237,8 @@ class LockSetLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,19 +101,8 @@ class LockSoundSetLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,16 +58,16 @@ class LockTimeLogic extends BaseGetXController{
|
||||
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//需要鉴权
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
IoSenderManage.senderGetStarLockStatuInfo(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
@ -82,8 +82,6 @@ class LockTimeLogic extends BaseGetXController{
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType}数据解析成功");
|
||||
|
||||
String dataEime = DateTool().dateToYMDHNString("${state.dateTimestamp.value}");
|
||||
state.dateTime.value = dataEime;
|
||||
|
||||
@ -94,19 +92,8 @@ class LockTimeLogic extends BaseGetXController{
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,24 +84,13 @@ class MotorPowerLogic extends BaseGetXController {
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType}数据解析成功");
|
||||
_setLockSetGeneralSetting();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,19 +119,8 @@ class NormallyOpenModeLogic extends BaseGetXController{
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -164,6 +153,8 @@ class NormallyOpenModeLogic extends BaseGetXController{
|
||||
int index = day % 7; // 将周日的索引转换为 0
|
||||
weekStr = '${weekStr.substring(0, index)}1${weekStr.substring(index + 1)}';
|
||||
}
|
||||
// 倒序 weekStr
|
||||
weekStr = weekStr.split('').reversed.join('');
|
||||
int number = int.parse(weekStr, radix: 2);
|
||||
|
||||
List<int> list = [];
|
||||
|
||||
@ -84,24 +84,12 @@ class OpenDoorDirectionLogic extends BaseGetXController {
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType}数据解析成功");
|
||||
_setLockSetGeneralSetting();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,19 +100,9 @@ class RemoteUnlockingLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,19 +93,8 @@ class ResetButtonLogic extends BaseGetXController{
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,16 +200,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
if (reply is SenderCustomPasswordsReply) {
|
||||
var token = reply.data.sublist(5, 9);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
print("_replyFactoryDataResetKeyToken:$token");
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
state.sureBtnState.value = 0;
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
@ -217,7 +213,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -239,17 +235,14 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
cancelBlueConnetctToastTimer();
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
cancelBlueConnetctToastTimer();
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
cancelBlueConnetctToastTimer();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -143,8 +143,8 @@ class NearbyLockLogic extends BaseGetXController {
|
||||
// 厂商名称
|
||||
var vendor = reply.data.sublist(3, 23);
|
||||
var vendorStr = utf8String(vendor);
|
||||
state.lockInfo["vendor"] = vendorStr;
|
||||
// state.lockInfo["vendor"] = "XL";
|
||||
// state.lockInfo["vendor"] = vendorStr;
|
||||
state.lockInfo["vendor"] = "XL";
|
||||
Get.log("vendor:$vendor vendorStr:$vendorStr reply.data:${reply.data}");
|
||||
|
||||
// 锁设备类型
|
||||
@ -286,14 +286,20 @@ class NearbyLockLogic extends BaseGetXController {
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
// IoSenderManage.senderGetLockStatu(
|
||||
// lockID:BlueManage().connectDeviceName,
|
||||
// userID:await Storage.getUid(),
|
||||
// privateKey:getPrivateKeyList,
|
||||
// );
|
||||
IoSenderManage.senderGetStarLockStatuInfo(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
|
||||
@ -47,7 +47,7 @@ class SaveLockLogic extends BaseGetXController {
|
||||
|
||||
// 添加用户
|
||||
Future<void> _replyAddUserKey(Reply reply) async {
|
||||
var lockId = reply.data.sublist(2, 42);
|
||||
// var lockId = reply.data.sublist(2, 42);
|
||||
|
||||
var token = reply.data.sublist(42, 46);
|
||||
List<String> strTokenList = changeIntListToStringList(token);
|
||||
@ -144,17 +144,7 @@ class SaveLockLogic extends BaseGetXController {
|
||||
privateKey: getPrivateKeyList,
|
||||
token: token);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -198,14 +188,6 @@ class SaveLockLogic extends BaseGetXController {
|
||||
privateKey: getPrivateKeyList,
|
||||
token: token);
|
||||
break;
|
||||
case 0x07:
|
||||
// 无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
break;
|
||||
default:
|
||||
// 失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
@ -35,7 +35,6 @@ class ExpireCardLogic extends BaseGetXController {
|
||||
// 添加卡片开始(此处用作删除卡片)
|
||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
print("_replyAddFingerprintStatus:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
@ -70,8 +69,8 @@ class ExpireCardLogic extends BaseGetXController {
|
||||
weekRound:0, // 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
startTime:"0",
|
||||
endTime:"0",
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
@ -133,8 +132,8 @@ class ExpireCardLogic extends BaseGetXController {
|
||||
weekRound:0, // 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
startTime:"0",
|
||||
endTime:"0",
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
|
||||
@ -34,9 +34,8 @@ class ExpireFingerprintLogic extends BaseGetXController {
|
||||
|
||||
// 添加指纹开始
|
||||
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
// print("status:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
@ -72,28 +71,17 @@ class ExpireFingerprintLogic extends BaseGetXController {
|
||||
weekRound:0, // 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
startTime:"0",
|
||||
endTime:"0",
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -136,8 +124,8 @@ class ExpireFingerprintLogic extends BaseGetXController {
|
||||
weekRound:0, // 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
startTime:"0",
|
||||
endTime:"0",
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
|
||||
31
star_lock/lib/tools/commonDataManage.dart
Normal file
31
star_lock/lib/tools/commonDataManage.dart
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
// 实现一个CommonDataManage的单例,用来管理项目中使用的一些公共数据
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class CommonDataManage {
|
||||
static CommonDataManage? _manager;
|
||||
CommonDataManage._init();
|
||||
|
||||
static CommonDataManage? shareManager() {
|
||||
_manager ??= CommonDataManage._init();
|
||||
// _manager!._initBlue();
|
||||
return _manager;
|
||||
}
|
||||
|
||||
factory CommonDataManage() => shareManager()!;
|
||||
CommonDataManage? get manager => shareManager();
|
||||
|
||||
// 首页列表锁长度
|
||||
final _mainLockCount = 0.obs;
|
||||
set setMainLockCount(int v) => _mainLockCount.value = v;
|
||||
get getMainLockCount => _mainLockCount;
|
||||
|
||||
// 当前锁的用户编号
|
||||
int currentLockUserNo = 0;
|
||||
// set setCurrentLockUserNo(int v) => _currentLockUserNo = v;
|
||||
// get getCurrentLockUserNo => _currentLockUserNo;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user