app-starlock/lib/blue/io_protocol/io_addFaceWithTimeCycleCoercion.dart
2024-05-18 09:37:50 +08:00

186 lines
5.5 KiB
Dart
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import '../io_sender.dart';
import '../io_type.dart';
///TODO:添加人脸
/*
备注:
删除单个指纹规则UseCountLimit 设置为 0。删除全部指纹规则 UseCountLimit 设置为 0FingerNo 设置为 255userId 设置为“Delete All !@#”,只有门锁管理员才有权限
**/
// class SenderAddFaceWithTimeCycleCoercionCommand extends SenderProtocol {
//
// String? keyID;
// String? userID;
// int? fingerNo;
// int? useCountLimit;
// int? isForce;
// List<int>? token;
// int? isRound;
// int? weekRound;
// int? startDate;
// int? endDate;
// String? startTime;
// String? endTime;
// int? needAuthor;
// List<int>? signKey;
// List<int>? privateKey;
//
// SenderAddFaceWithTimeCycleCoercionCommand({
// this.keyID,
// this.userID,
// this.fingerNo,
// this.useCountLimit,
// this.isForce,
// this.token,
// this.isRound,
// this.weekRound,
// this.startDate,
// this.endDate,
// 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 = [];
//
// // 指令类型
// int type = commandType!.typeValue;
// double typeDouble = type / 256;
// int type1 = typeDouble.toInt();
// int type2 = type % 256;
// data.add(type1);
// data.add(type2);
//
// // 子命令类型
// data.add(36);
//
// // keyID 40
// int keyIDLength = utf8.encode(keyID!).length;
// subData.addAll(utf8.encode(keyID!));
// subData = getFixedLengthList(subData, 40 - keyIDLength);
//
// //userID 20
// int userIDLength = utf8.encode(userID!).length;
// subData.addAll(utf8.encode(userID!));
// subData = getFixedLengthList(subData, 20 - userIDLength);
//
// // fingerNo
// subData.add(fingerNo!);
//
// // UseCountLimit
// subData.add(useCountLimit!);
//
// // isForce
// subData.add(isForce!);
//
// // token
// subData.addAll(token!);
//
// // isRound
// subData.add(isRound!);
//
// // weekRound
// subData.add(weekRound!);
//
// // startDate 4
// subData.add((startDate! & 0xff000000) >> 24);
// subData.add((startDate! & 0xff0000) >> 16);
// subData.add((startDate! & 0xff00) >> 8);
// subData.add((startDate! & 0xff));
//
// // endDate 4
// subData.add((endDate! & 0xff000000) >> 24);
// subData.add((endDate! & 0xff0000) >> 16);
// subData.add((endDate! & 0xff00) >> 8);
// subData.add((endDate! & 0xff));
//
// // startTime 4
// 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
// 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
// subData.add(0);
// } else {
// List<int> authCodeData = [];
// //KeyID
// authCodeData.addAll(utf8.encode(keyID!));
//
// //authUserID
// authCodeData.addAll(utf8.encode(userID!));
//
// //token 4 首次请求 Token 填 0如果锁需要鉴权操作者身份则会分配动态口令并在应答消息中返回二次请求时带上。
// authCodeData.addAll(token!);
//
// authCodeData.addAll(signKey!);
//
// // 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
// var authCode = crypto.md5.convert(authCodeData);
//
// subData.add(authCode.bytes.length);
// subData.addAll(authCode.bytes);
// }
//
// data.add(subData.length);
// data.addAll(subData);
//
// if ((data.length % 16) != 0) {
// int add = (16 - data.length % 16);
// for (int i = 0; i < add; i++) {
// data.add(0);
// }
// }
//
// Get.log("${commandType!.typeName} SM4Data:$data");
// // 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
// return ebcData;
// }
// }
//
// class SenderAddFingerprintWithTimeCycleCoercionReply extends Reply {
// SenderAddFingerprintWithTimeCycleCoercionReply.parseData(CommandType commandType, List<int> dataDetail)
// : super.parseData(commandType, dataDetail) {
// data = dataDetail;
// int status = data[2];
// errorWithStstus(status);
// }
// }
//
// class SenderAddFingerprintProcessReply extends Reply {
// SenderAddFingerprintProcessReply.parseData(CommandType commandType, List<int> dataDetail)
// : super.parseData(commandType, dataDetail) {
// data = dataDetail;
// int status = data[2];
// errorWithStstus(status);
// }
// }
//
// class SenderAddFingerprintConfirmationReply extends Reply {
// SenderAddFingerprintConfirmationReply.parseData(CommandType commandType, List<int> dataDetail)
// : super.parseData(commandType, dataDetail) {
// data = dataDetail;
// int status = data[2];
// errorWithStstus(status);
// }
// }