1、修复卡指纹常开模式循环日期问题。2、添加与蓝牙交互时,统一管理协议返回的错误码。3、添加部分国际化

This commit is contained in:
魏少阳 2024-04-19 18:13:34 +08:00
parent 04c5b703e5
commit cda022c112
79 changed files with 1448 additions and 1597 deletions

View File

@ -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",

View File

@ -699,6 +699,8 @@
"重命名": "重命名",
"分组下的锁将被移到未分组里": "分组下的锁将被移到未分组里",
"编辑成功": "编辑成功",
"当前网络": "当前网络",
"位置信息": "位置信息",
"相机": "相机",
"相册": "相册",

View File

@ -701,6 +701,8 @@
"重命名": "重命名",
"分组下的锁将被移到未分组里": "分组下的锁将被移到未分组里",
"编辑成功": "编辑成功",
"当前网络": "当前网络",
"位置信息": "位置信息",
"相机": "相机",
"相册": "相册",

View File

@ -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 {

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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;

View File

@ -9,146 +9,145 @@ import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
///TODO:
/// 使SenderAddFingerprintWithTimeCycleCoercionCommand 2024.4.16 addby
/*
UseCountLimit 0 UseCountLimit 0FingerNo 255userId 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");
// KeyIDauthUserIDmd5加密之后就是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!);
//
// // KeyIDauthUserIDmd5加密之后就是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;
// }
// }

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -11,139 +11,137 @@ import '../sm4Encipher/sm4.dart';
///TODO: 使SenderAddICCardWithTimeCycleCoercionCommand 2024.4.16 addby
///
///TODO:
/*
UseCountLimit 0 UseCountLimit 0FingerNo 255userId 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");
// KeyIDauthUserIDmd5加密之后就是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 0FingerNo 255userId 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!);
//
// // KeyIDauthUserIDmd5加密之后就是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;
// }
// }

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -13,133 +13,131 @@ import 'package:crypto/crypto.dart' as crypto;
UseCountLimit 0 UseCountLimit 0FingerNo 255userId 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");
// KeyIDauthUserIDmd5加密之后就是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!);
//
// // KeyIDauthUserIDmd5加密之后就是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;
// }
// }

View File

@ -15,134 +15,132 @@ import 'package:crypto/crypto.dart' as crypto;
UseCountLimit 0 UseCountLimit 0FingerNo 255userId 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");
// KeyIDauthUserIDmd5加密之后就是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!);
//
// // KeyIDauthUserIDmd5加密之后就是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;
// }
// }

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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 01
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 01
// 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;
// }
// }

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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;

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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;
// }
// }
// }

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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);
}
}

View File

@ -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);
}
}

View File

@ -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");
// KeyIDauthUserIDmd5加密之后就是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;
}

View File

@ -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);
}
}

View File

@ -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 {

View File

@ -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:
{
// ()/

View File

@ -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(

View File

@ -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,

View File

@ -46,7 +46,9 @@ class _AddCardPageState extends State<AddCardPage> {
}
state.fromType.value = widget.fromType;
return indexChangeWidget();
return SingleChildScrollView(
child: indexChangeWidget()
);
}
@override

View File

@ -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();

View File

@ -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,

View File

@ -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,

View File

@ -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!);

View File

@ -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{

View File

@ -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"];
}
}

View File

@ -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,

View File

@ -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}");
},
);
}

View File

@ -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,

View File

@ -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,

View File

@ -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:
//

View File

@ -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) {

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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:

View File

@ -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:
//

View File

@ -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

View File

@ -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:
//

View File

@ -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:
//

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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 = [];

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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:
//

View File

@ -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} 失败");

View File

@ -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,

View File

@ -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,

View 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;
}