完善录制指纹协议,添加校时协议
This commit is contained in:
parent
b3b711020c
commit
4e57f36f2b
BIN
star_lock/images/main/icon_addFingerprintTip.png
Normal file
BIN
star_lock/images/main/icon_addFingerprintTip.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
star_lock/images/main/icon_addFingerprint_fingerprint_four.png
Normal file
BIN
star_lock/images/main/icon_addFingerprint_fingerprint_four.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 108 KiB |
BIN
star_lock/images/main/icon_addFingerprint_fingerprint_one.png
Normal file
BIN
star_lock/images/main/icon_addFingerprint_fingerprint_one.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
BIN
star_lock/images/main/icon_addFingerprint_fingerprint_three.png
Normal file
BIN
star_lock/images/main/icon_addFingerprint_fingerprint_three.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 102 KiB |
BIN
star_lock/images/main/icon_addFingerprint_fingerprint_two.png
Normal file
BIN
star_lock/images/main/icon_addFingerprint_fingerprint_two.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 93 KiB |
BIN
star_lock/images/main/icon_main_unHaveLockData.png
Normal file
BIN
star_lock/images/main/icon_main_unHaveLockData.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
@ -55,6 +55,8 @@ import 'main/lockDetail/lcokSet/wirelessKeyboard/addWirelessKeyboard/addWireless
|
||||
import 'main/lockDetail/lcokSet/wirelessKeyboard/addWirelessKeyboardScreenNotLightOn/addWirelessKeyboardScreenNotLightOn_page.dart';
|
||||
import 'main/lockDetail/lcokSet/wirelessKeyboard/seletWirelessKeyboard/seletWirelessKeyboard_page.dart';
|
||||
import 'main/lockDetail/lcokSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart';
|
||||
import 'main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_page.dart';
|
||||
import 'main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerprintTip_page.dart';
|
||||
import 'mine/about/about_page.dart';
|
||||
import 'mine/addLock/addLock/addLock_page.dart';
|
||||
import 'main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdminManage/authorizedAdminManage_page.dart';
|
||||
@ -149,6 +151,12 @@ abstract class Routers {
|
||||
'/OtherTypeKeyDetailPage'; // 卡、指纹、遥控钥匙详情
|
||||
static const otherTypeKeyManagePage =
|
||||
'/OtherTypeKeyManagePage'; // 卡、指纹、遥控钥匙添加
|
||||
|
||||
static const addFingerprintTipPage =
|
||||
'/AddFingerprintTipPage'; // 添加指纹提示
|
||||
static const addFingerprintPage =
|
||||
'/AddFingerprintPage'; // 添加指纹
|
||||
|
||||
static const authorizedAdminListPage = '/AuthorizedAdminListPage'; // 授权管理员列表
|
||||
static const authorizedAdminDetailPage =
|
||||
'/AuthorizedAdminDetailPage'; // 授权管理员详情
|
||||
@ -722,5 +730,9 @@ abstract class AppRouters {
|
||||
GetPage(
|
||||
name: Routers.authorityManagementPage,
|
||||
page: () => const AuthorityManagementPage()),
|
||||
GetPage(name: Routers.addFingerprintTipPage, page: () => const AddFingerprintTipPage()),
|
||||
GetPage(
|
||||
name: Routers.addFingerprintPage,
|
||||
page: () => const AddFingerprintPage()),
|
||||
];
|
||||
}
|
||||
|
||||
153
star_lock/lib/blue/io_protocol/io_addFingerprint.dart
Normal file
153
star_lock/lib/blue/io_protocol/io_addFingerprint.dart
Normal file
@ -0,0 +1,153 @@
|
||||
|
||||
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';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
//TODO:设置自定义密码
|
||||
/*
|
||||
备注:
|
||||
删除单个指纹规则:UseCountLimit 设置为 0。删除全部指纹规则: UseCountLimit 设置为 0,FingerNo 设置为 255,userId 设置为“Delete All !@#”,只有门锁管理员才有权限
|
||||
**/
|
||||
class SenderAddFingerprintCommand extends SenderProtocol {
|
||||
|
||||
String? keyID;
|
||||
String? userID;
|
||||
int? fingerNo;
|
||||
int? useCountLimit;
|
||||
List<int>? token;
|
||||
int? startTime;
|
||||
int? endTime;
|
||||
int? needAuthor;
|
||||
List<int>? publicKey;
|
||||
List<int>? privateKey;
|
||||
|
||||
SenderAddFingerprintCommand({
|
||||
this.keyID,
|
||||
this.userID,
|
||||
this.fingerNo,
|
||||
this.useCountLimit,
|
||||
this.token,
|
||||
this.startTime,
|
||||
this.endTime,
|
||||
this.needAuthor,
|
||||
this.publicKey,
|
||||
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(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(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 = [];
|
||||
|
||||
//authUserID
|
||||
authCodeData.addAll(utf8.encode(userID!));
|
||||
|
||||
//KeyID
|
||||
authCodeData.addAll(utf8.encode(keyID!));
|
||||
|
||||
//token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||
authCodeData.addAll(token!);
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
subData.add(authCode.bytes.length);
|
||||
subData.addAll(authCode.bytes);
|
||||
}
|
||||
|
||||
data.add(subData.length);
|
||||
data.addAll(subData);
|
||||
|
||||
if ((data.length % 16) != 0) {
|
||||
int add = (16 - data.length % 16);
|
||||
for (int i = 0; i < add; i++) {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
}
|
||||
|
||||
class SenderAddFingerprintReply extends Reply {
|
||||
SenderAddFingerprintReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
}
|
||||
}
|
||||
|
||||
class SenderAddFingerprintProcessReply extends Reply {
|
||||
SenderAddFingerprintProcessReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
}
|
||||
}
|
||||
|
||||
class SenderAddFingerprintConfirmationReply extends Reply {
|
||||
SenderAddFingerprintConfirmationReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
}
|
||||
}
|
||||
@ -3,9 +3,9 @@ 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';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_type.dart';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
//TODO:添加用户
|
||||
|
||||
@ -5,9 +5,9 @@ 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';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_type.dart';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
class DeletUserCommand extends SenderProtocol {
|
||||
|
||||
@ -5,9 +5,9 @@ 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';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_type.dart';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
class EditUserCommand extends SenderProtocol {
|
||||
|
||||
@ -8,9 +8,9 @@ import '../io_tool/io_manager.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sender_manage.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import 'io_reply.dart';
|
||||
import 'io_sender.dart';
|
||||
import 'io_type.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_type.dart';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
class FactoryDataResetCommand extends SenderProtocol {
|
||||
|
||||
@ -4,9 +4,9 @@ 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';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_type.dart';
|
||||
|
||||
class GetLockStatuCommand extends SenderProtocol {
|
||||
|
||||
|
||||
@ -5,9 +5,9 @@ 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';
|
||||
import 'io_type.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_type.dart';
|
||||
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
|
||||
@ -5,9 +5,9 @@ import '../../tools/storage.dart';
|
||||
import '../io_tool/io_manager.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sender_manage.dart';
|
||||
import 'io_reply.dart';
|
||||
import 'io_sender.dart';
|
||||
import 'io_type.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_type.dart';
|
||||
|
||||
class GetPublicKeyCommand extends SenderProtocol {
|
||||
String? lockID;
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
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';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_type.dart';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
//TODO:开门
|
||||
|
||||
@ -3,9 +3,9 @@ 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';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_type.dart';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
//TODO:设置自定义密码
|
||||
|
||||
77
star_lock/lib/blue/io_protocol/io_timing.dart
Normal file
77
star_lock/lib/blue/io_protocol/io_timing.dart
Normal file
@ -0,0 +1,77 @@
|
||||
|
||||
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';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
//TODO:校时
|
||||
class TimingCommand extends SenderProtocol {
|
||||
String? lockID;
|
||||
String? userID;
|
||||
int? nowTime;
|
||||
List<int>? token;
|
||||
int? needAuthor;
|
||||
List<int>? signKey;
|
||||
List<int>? privateKey;
|
||||
TimingCommand({
|
||||
this.lockID,
|
||||
this.userID,
|
||||
this.nowTime,
|
||||
this.token,
|
||||
this.needAuthor,
|
||||
this.signKey,
|
||||
this.privateKey
|
||||
}) : super(CommandType.openLock);
|
||||
|
||||
@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);
|
||||
|
||||
//lockID 40
|
||||
int lockIDLength = utf8.encode(lockID!).length;
|
||||
data.addAll(utf8.encode(lockID!));
|
||||
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||
|
||||
//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);
|
||||
|
||||
// nowTime 4
|
||||
int? d1 = nowTime;
|
||||
data.add((d1! & 0xff000000) >> 24);
|
||||
data.add((d1 & 0xff0000) >> 16);
|
||||
data.add((d1 & 0xff00) >> 8);
|
||||
data.add((d1 & 0xff));
|
||||
|
||||
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 TimingReply extends Reply {
|
||||
TimingReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
}
|
||||
}
|
||||
@ -3,9 +3,9 @@ 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';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_type.dart';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
//TODO:转移权限
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import '../io_tool/io_manager.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import 'io_tool/io_manager.dart';
|
||||
import 'io_tool/io_tool.dart';
|
||||
import 'io_type.dart';
|
||||
|
||||
abstract class IOData {
|
||||
@ -8,16 +8,18 @@ import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_editUser.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_factoryDataReset.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_getLockStatu.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_timing.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_transferPermissions.dart';
|
||||
|
||||
import '../tools/storage.dart';
|
||||
import 'io_protocol/io_addFingerprint.dart';
|
||||
import 'io_protocol/io_addUser.dart';
|
||||
import 'io_protocol/io_getPrivateKey.dart';
|
||||
import 'io_protocol/io_getPublicKey.dart';
|
||||
import 'io_protocol/io_openLock.dart';
|
||||
import 'io_protocol/io_reply.dart';
|
||||
import 'io_reply.dart';
|
||||
import 'io_protocol/io_senderCustomPasswords.dart';
|
||||
import 'io_protocol/io_type.dart';
|
||||
import 'io_type.dart';
|
||||
import 'io_tool/io_manager.dart';
|
||||
import 'io_tool/io_tool.dart';
|
||||
import 'io_tool/manager_event_bus.dart';
|
||||
@ -35,8 +37,8 @@ class CommandReciverManager {
|
||||
if(data_size < 13){
|
||||
return;
|
||||
}
|
||||
// print("appDataReceiveData:$data");
|
||||
if((data[0] == 0xEF)&&(data[1] == 0x01)&&(data[2] == 0xEE)&&(data[3] == 0x02)&&(data[4] == 0x11)){
|
||||
// print("appDataReceiveData:$data"); // &&(data[4] == 0x11)
|
||||
if((data[0] == 0xEF)&&(data[1] == 0x01)&&(data[2] == 0xEE)&&(data[3] == 0x02)){
|
||||
var tmpType = (data[7] & 0x0f);// 包标识
|
||||
print("temType:$tmpType");
|
||||
var dataLen = data[8] * 256 + data[9];// 高16位用来指示后面数据块内容的长度
|
||||
@ -144,6 +146,11 @@ class CommandReciverManager {
|
||||
reply = FactoryDataResetReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
case CommandType.calibrationTime:
|
||||
{
|
||||
reply = TimingReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
case CommandType.generalExtendedCommond:
|
||||
{
|
||||
// 子命令类型
|
||||
@ -155,6 +162,24 @@ class CommandReciverManager {
|
||||
reply = SenderCustomPasswordsReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
case 31:
|
||||
{
|
||||
// 注册指纹开始
|
||||
reply = SenderAddFingerprintReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
{
|
||||
// 注册指纹确认
|
||||
reply = SenderAddFingerprintConfirmationReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
case 33:
|
||||
{
|
||||
// 注册指纹过程
|
||||
reply = SenderAddFingerprintProcessReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -163,17 +188,4 @@ class CommandReciverManager {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<Reply?> replySubCommand(CommandType commandType, List<int> data){
|
||||
int subType = data[3];
|
||||
var reply;
|
||||
switch(subType){
|
||||
case 3:
|
||||
{
|
||||
// 设置开锁密码
|
||||
reply = SenderCustomPasswordsReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
import '../app_settings/app_settings.dart';
|
||||
import 'io_protocol/io_sender.dart';
|
||||
import 'io_protocol/io_type.dart';
|
||||
import 'io_sender.dart';
|
||||
import 'io_type.dart';
|
||||
import 'io_tool/io_model.dart';
|
||||
import 'io_tool/manager_event_bus.dart';
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_getLockStatu.dart';
|
||||
|
||||
import 'io_protocol/io_addFingerprint.dart';
|
||||
import 'io_protocol/io_addUser.dart';
|
||||
import 'io_protocol/io_editUser.dart';
|
||||
import 'io_protocol/io_factoryDataReset.dart';
|
||||
@ -251,4 +252,32 @@ class IoSenderManage {
|
||||
privateKey: privateKey,
|
||||
), callBack:callBack);
|
||||
}
|
||||
|
||||
//todo:添加指纹开始
|
||||
static void senderAddFingerprintCommand({
|
||||
required String? keyID,
|
||||
required String? userID,
|
||||
required int? fingerNo,
|
||||
required int? useCountLimit,
|
||||
required List<int>? token,
|
||||
required int? startTime,
|
||||
required int? endTime,
|
||||
required int? needAuthor,
|
||||
required List<int>? publicKey,
|
||||
required List<int>? privateKey,
|
||||
CommandSendCallBack? callBack}) {
|
||||
CommandSenderManager().managerSendData(
|
||||
command: SenderAddFingerprintCommand(
|
||||
keyID: keyID,
|
||||
userID: userID,
|
||||
fingerNo: fingerNo,
|
||||
useCountLimit: useCountLimit,
|
||||
token: token,
|
||||
startTime: startTime,
|
||||
endTime: endTime,
|
||||
needAuthor: needAuthor,
|
||||
publicKey: publicKey,
|
||||
privateKey: privateKey,
|
||||
), callBack:callBack);
|
||||
}
|
||||
}
|
||||
@ -2,10 +2,10 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_type.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_protocol/io_reply.dart';
|
||||
import '../../../../blue/io_reply.dart';
|
||||
import '../../../../blue/io_protocol/io_transferPermissions.dart';
|
||||
import '../../../../blue/io_tool/io_manager.dart';
|
||||
import '../../../../blue/io_tool/io_tool.dart';
|
||||
@ -52,7 +52,7 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
|
||||
IoSenderManage.senderFactoryDataReset(
|
||||
lockID:BlueManage().connectDeviceName,
|
||||
userID:await Storage.getUserId(),
|
||||
userID:await Storage.getUid(),
|
||||
keyID:"1",
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
@ -96,9 +96,9 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
|
||||
IoSenderManage.senderTransferPermissions(
|
||||
lockID:BlueManage().connectDeviceName,
|
||||
authUserID:await Storage.getUserId(),
|
||||
authUserID:await Storage.getUid(),
|
||||
keyID:"1",
|
||||
oldUserID:await Storage.getUserId(),
|
||||
oldUserID:await Storage.getUid(),
|
||||
newUserID:"100002",
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
|
||||
@ -7,7 +7,7 @@ import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_protocol/io_reply.dart';
|
||||
import '../../../../blue/io_reply.dart';
|
||||
import '../../../../blue/io_tool/io_manager.dart';
|
||||
import '../../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||
@ -58,9 +58,9 @@ class LockSetLogic extends BaseGetXController{
|
||||
|
||||
IoSenderManage.deletUser(
|
||||
lockID:state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
|
||||
authUserID:await Storage.getUserId(),
|
||||
authUserID:await Storage.getUid(),
|
||||
keyID:"1",
|
||||
delUserID:await Storage.getUserId(),
|
||||
delUserID:await Storage.getUid(),
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
|
||||
@ -6,11 +6,11 @@ import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_editUser.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_factoryDataReset.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_getLockStatu.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_type.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
|
||||
import '../../../blue/blue_manage.dart';
|
||||
import '../../../blue/io_protocol/io_openLock.dart';
|
||||
import '../../../blue/io_protocol/io_reply.dart';
|
||||
import '../../../blue/io_reply.dart';
|
||||
import '../../../blue/io_tool/io_manager.dart';
|
||||
import '../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../blue/io_tool/manager_event_bus.dart';
|
||||
@ -87,7 +87,7 @@ class LockDetailLogic extends BaseGetXController{
|
||||
|
||||
IoSenderManage.senderOpenLock(
|
||||
keyID: "1",
|
||||
userID: await Storage.getUserId(),
|
||||
userID: await Storage.getUid(),
|
||||
openMode: 1,
|
||||
openTime: DateTime.now().millisecondsSinceEpoch,
|
||||
token: tokenData,
|
||||
@ -215,9 +215,9 @@ class LockDetailLogic extends BaseGetXController{
|
||||
|
||||
IoSenderManage.senderEditUser(
|
||||
lockID:BlueManage().connectDeviceName,
|
||||
authUserID:await Storage.getUserId(),
|
||||
authUserID:await Storage.getUid(),
|
||||
keyID:"1",
|
||||
userID:await Storage.getUserId(),
|
||||
userID:await Storage.getUid(),
|
||||
openMode:1,
|
||||
keyType:1,
|
||||
startDate:0x11223344,
|
||||
@ -278,7 +278,7 @@ class LockDetailLogic extends BaseGetXController{
|
||||
|
||||
IoSenderManage.senderFactoryDataReset(
|
||||
lockID:BlueManage().connectDeviceName,
|
||||
userID:await Storage.getUserId(),
|
||||
userID:await Storage.getUid(),
|
||||
keyID:"1",
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
@ -326,7 +326,7 @@ class LockDetailLogic extends BaseGetXController{
|
||||
// print("userId:$userId");
|
||||
IoSenderManage.senderOpenLock(
|
||||
keyID: "1",
|
||||
userID: await Storage.getUserId(),
|
||||
userID: await Storage.getUid(),
|
||||
openMode: 1,
|
||||
openTime: DateTime.now().millisecondsSinceEpoch,
|
||||
token: getTokenList,
|
||||
@ -355,9 +355,9 @@ class LockDetailLogic extends BaseGetXController{
|
||||
print("publicKey:$publicKey publicKeyDataList:$publicKeyDataList privateKey:$privateKey getPrivateKeyList:$getPrivateKeyList token:$token getTokenList:$getTokenList");
|
||||
IoSenderManage.senderEditUser(
|
||||
lockID:BlueManage().connectDeviceName,
|
||||
authUserID:await Storage.getUserId(),
|
||||
authUserID:await Storage.getUid(),
|
||||
keyID:"1",
|
||||
userID:await Storage.getUserId(),
|
||||
userID:await Storage.getUid(),
|
||||
openMode:1,
|
||||
keyType:1,
|
||||
startDate:0x11223344,
|
||||
@ -388,7 +388,7 @@ class LockDetailLogic extends BaseGetXController{
|
||||
|
||||
IoSenderManage.senderFactoryDataReset(
|
||||
lockID:BlueManage().connectDeviceName,
|
||||
userID:await Storage.getUserId(),
|
||||
userID:await Storage.getUid(),
|
||||
keyID:"1",
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
@ -408,7 +408,7 @@ class LockDetailLogic extends BaseGetXController{
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
IoSenderManage.senderGetLockStatu(
|
||||
lockID:BlueManage().connectDeviceName,
|
||||
userID:await Storage.getUserId(),
|
||||
userID:await Storage.getUid(),
|
||||
privateKey:getPrivateKeyList,
|
||||
);
|
||||
}
|
||||
@ -433,12 +433,6 @@ class LockDetailLogic extends BaseGetXController{
|
||||
super.onInit();
|
||||
print("lockDetail_onInit()");
|
||||
|
||||
// BlueManage().connectDeviceName = "TMH_c3570480da8d";
|
||||
// BlueManage().connectDeviceMacAddress = "AD01447A-30B5-A780-E778-DED3BDCB613E";
|
||||
|
||||
// BlueManage().connectDeviceName = state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
||||
// BlueManage().connectDeviceMacAddress = state.keyInfos.value.bluetooth!.bluetoothDeviceId!;
|
||||
|
||||
// 进来获取锁状态
|
||||
// connectBlue();
|
||||
}
|
||||
|
||||
@ -45,6 +45,11 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
||||
List<int> privateKeyData = state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
|
||||
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
|
||||
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
||||
|
||||
// signKey
|
||||
List<int> signKeyData = state.keyInfos.value.bluetooth!.signKey!.cast<int>();
|
||||
var saveSignKeyList = changeIntListToStringList(signKeyData);
|
||||
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
||||
// print("publicKeyData:$publicKeyData saveStrList:$saveStrList privateKeyData:$privateKeyData savePrivateKeyList:$savePrivateKeyList");
|
||||
|
||||
// logic.connectBlue();
|
||||
|
||||
@ -0,0 +1,226 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
|
||||
import '../../../../../blue/blue_manage.dart';
|
||||
import '../../../../../blue/io_protocol/io_addFingerprint.dart';
|
||||
import '../../../../../blue/io_reply.dart';
|
||||
import '../../../../../blue/io_tool/io_manager.dart';
|
||||
import '../../../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../../../blue/io_tool/manager_event_bus.dart';
|
||||
import '../../../../../blue/sender_manage.dart';
|
||||
import '../../../../../tools/baseGetXController.dart';
|
||||
import '../../../../../tools/storage.dart';
|
||||
import 'addFingerprint_state.dart';
|
||||
|
||||
class AddFingerprintLogic extends BaseGetXController {
|
||||
final AddFingerprintState state = AddFingerprintState();
|
||||
|
||||
// 监听设备返回的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
// 添加指纹开始
|
||||
if(reply is SenderAddFingerprintReply) {
|
||||
_replyAddFingerprintBegin(reply);
|
||||
}
|
||||
|
||||
// 添加指纹过程
|
||||
if(reply is SenderAddFingerprintProcessReply) {
|
||||
_replyAddFingerprintProcess(reply);
|
||||
}
|
||||
|
||||
// 添加指纹确认
|
||||
if(reply is SenderAddFingerprintConfirmationReply) {
|
||||
_replyAddFingerprintConfirmation(reply);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||
var token = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
print("_replyAddFingerprintReplyToken:$token");
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
state.ifConnectScuess.value = true;
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
IoSenderManage.senderAddFingerprintCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
fingerNo:1,
|
||||
useCountLimit:0xff,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _replyAddFingerprintProcess(Reply reply) async {
|
||||
var token = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
print("_replyAddFingerprintReplyToken:$token");
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[2];
|
||||
print("33 status:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
state.addFingerprintProcessNumber.value++;
|
||||
print("state.addFingerprintProcessNumber.value:${state.addFingerprintProcessNumber.value}");
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _replyAddFingerprintConfirmation(Reply reply) async {
|
||||
var token = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
print("_replyAddFingerprintReplyToken:$token");
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
print("添加指纹确认成功,调用添加指纹接口");
|
||||
Get.close(3);
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加指纹开始
|
||||
Future<void> senderAddFingerprint() async {
|
||||
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
||||
if (state == DeviceConnectionState.connected){
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
print("openDoorTokenPubToken:$getTokenList");
|
||||
|
||||
IoSenderManage.senderAddFingerprintCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
fingerNo:1,
|
||||
useCountLimit:1,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
_initReplySubscription();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
|
||||
senderAddFingerprint();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
_replySubscription.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,138 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/submitBtn.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import 'addFingerprint_logic.dart';
|
||||
|
||||
class AddFingerprintPage extends StatefulWidget {
|
||||
const AddFingerprintPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddFingerprintPage> createState() => _AddFingerprintPageState();
|
||||
}
|
||||
|
||||
class _AddFingerprintPageState extends State<AddFingerprintPage> {
|
||||
final logic = Get.put(AddFingerprintLogic());
|
||||
final state = Get.find<AddFingerprintLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.addLock!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: ListView(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 50.h,
|
||||
),
|
||||
Obx(() => Visibility(
|
||||
visible:logic.state.ifConnectScuess.value,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"请将您的手指按下",
|
||||
// TranslationLoader.lanKeys!.lightTouchScreenTip!.tr,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines:null,
|
||||
style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
Text(
|
||||
"(${state.addFingerprintProcessNumber.value}/4)",
|
||||
// TranslationLoader.lanKeys!.lightTouchScreenTip!.tr,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines:null,
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
Obx(() => Visibility(
|
||||
visible:!logic.state.ifConnectScuess.value,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"尝试连接设备......",
|
||||
// TranslationLoader.lanKeys!.lightTouchScreenTip!.tr,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines:null,
|
||||
style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
SizedBox(
|
||||
height: 50.h,
|
||||
),
|
||||
Obx(() => Image.asset(
|
||||
getIconNumber(state.addFingerprintProcessNumber.value),
|
||||
width: 270.w,
|
||||
height: 457.h,
|
||||
),),
|
||||
SizedBox(
|
||||
height: 120.h,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"根据提示,抬起手指后再进行下一次指纹采集,共3次",
|
||||
// TranslationLoader.lanKeys!.lightTouchScreenTip!.tr,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines:null,
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String getIconNumber(int number){
|
||||
switch(number){
|
||||
case 1:
|
||||
return 'images/main/icon_addFingerprint_fingerprint_two.png';
|
||||
break;
|
||||
case 2:
|
||||
return 'images/main/icon_addFingerprint_fingerprint_three.png';
|
||||
break;
|
||||
case 3:
|
||||
return 'images/main/icon_addFingerprint_fingerprint_four.png';
|
||||
break;
|
||||
// case 4:
|
||||
// return 'images/main/icon_addFingerprint_fingerprint_four.png';
|
||||
// break;
|
||||
default:
|
||||
return 'images/main/icon_addFingerprint_fingerprint_one.png';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class AddFingerprintState{
|
||||
var ifConnectScuess = false.obs;
|
||||
var addFingerprintProcessNumber = 0.obs;
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/submitBtn.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
|
||||
class AddFingerprintTipPage extends StatefulWidget {
|
||||
const AddFingerprintTipPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddFingerprintTipPage> createState() => _AddFingerprintTipPageState();
|
||||
}
|
||||
|
||||
class _AddFingerprintTipPageState extends State<AddFingerprintTipPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.addLock!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: ListView(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 50.h,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"添加过程中,请根据提示,在指纹采集器上进行多次的抬起按压",
|
||||
// TranslationLoader.lanKeys!.lightTouchScreenTip!.tr,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines:null,
|
||||
style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 60.h,
|
||||
),
|
||||
Image.asset(
|
||||
'images/main/icon_addFingerprintTip.png',
|
||||
width: 270.w,
|
||||
height: 457.h,
|
||||
),
|
||||
SizedBox(
|
||||
height: 120.h,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||
child: SubmitBtn(
|
||||
btnName: "开始添加",//TranslationLoader.lanKeys!.next!.tr,
|
||||
borderRadius: 20.w,
|
||||
onClick: () {
|
||||
Get.toNamed(Routers.addFingerprintPage);
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_addFingerprint.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_reply.dart';
|
||||
import '../../../../blue/io_protocol/io_senderCustomPasswords.dart';
|
||||
import '../../../../blue/io_tool/io_manager.dart';
|
||||
import '../../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||
import '../../../../blue/sender_manage.dart';
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
|
||||
class OtherTypeAddKeyLogic extends BaseGetXController {
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
@ -9,10 +10,9 @@ import '../../../../translations/trans_lib.dart';
|
||||
|
||||
class OtherTypeAddKeyPage extends StatefulWidget {
|
||||
final String seletType;
|
||||
final int lockType;
|
||||
final int lockType; // 0卡 1指纹 2钥匙
|
||||
const OtherTypeAddKeyPage(
|
||||
{Key? key, required this.seletType, required this.lockType})
|
||||
: super(key: key);
|
||||
{Key? key, required this.seletType, required this.lockType}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<OtherTypeAddKeyPage> createState() => _OtherTypeAddKeyPageState();
|
||||
@ -127,16 +127,11 @@ class _OtherTypeAddKeyPageState extends State<OtherTypeAddKeyPage> {
|
||||
Widget keyBottomWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
// Container(
|
||||
// padding: EdgeInsets.all(20.w),
|
||||
// child: Row(
|
||||
// // crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Expanded(child: Text(tipStr, textAlign: TextAlign.start,)),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
SubmitBtn(btnName: TranslationLoader.lanKeys!.next!.tr, onClick: () {}),
|
||||
SubmitBtn(btnName: TranslationLoader.lanKeys!.next!.tr, onClick: () {
|
||||
if(widget.lockType == 1){
|
||||
Get.toNamed(Routers.addFingerprintTipPage);
|
||||
}
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ class _OtherTypeKeyManagePageState extends State<OtherTypeKeyManagePage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 0卡 1指纹 2钥匙
|
||||
var lockType = ModalRoute.of(context)?.settings.arguments as int;
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_type.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_protocol/io_reply.dart';
|
||||
import '../../../../blue/io_reply.dart';
|
||||
import '../../../../blue/io_protocol/io_senderCustomPasswords.dart';
|
||||
import '../../../../blue/io_tool/io_manager.dart';
|
||||
import '../../../../blue/io_tool/io_tool.dart';
|
||||
@ -46,7 +46,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
|
||||
IoSenderManage.senderCustomPasswordsCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUserId(),
|
||||
userID:await Storage.getUid(),
|
||||
pwdNo:1,
|
||||
pwd: "123456",
|
||||
useCountLimit:0xff,
|
||||
@ -94,7 +94,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
|
||||
IoSenderManage.senderCustomPasswordsCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUserId(),
|
||||
userID:await Storage.getUid(),
|
||||
pwdNo:1,
|
||||
pwd: "123456",
|
||||
useCountLimit:0xff,
|
||||
|
||||
@ -102,17 +102,17 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 220.w,
|
||||
height: 220.w,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(width: 4.w, color: AppColors.mainColor),
|
||||
borderRadius: BorderRadius.circular(110.w),
|
||||
),
|
||||
width: 330.w,
|
||||
height: 330.w,
|
||||
// decoration: BoxDecoration(
|
||||
// border: Border.all(width: 4.w, color: AppColors.mainColor),
|
||||
// borderRadius: BorderRadius.circular(110.w),
|
||||
// ),
|
||||
child: InkWell(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(30.0),
|
||||
child: Image.asset(
|
||||
'images/main/icon_main_addLock.png',
|
||||
'images/main/icon_main_unHaveLockData.png',
|
||||
width: 150.w,
|
||||
height: 150.w,
|
||||
),
|
||||
@ -140,8 +140,8 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
.lanKeys!.whenAddingLockThePhoneMustBeNextToTheLock!.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.sp,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: AppColors.mainColor),
|
||||
// fontWeight: FontWeight.w800,
|
||||
color: Colors.black),
|
||||
))
|
||||
],
|
||||
);
|
||||
|
||||
@ -12,7 +12,7 @@ import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../blue/blue_manage.dart';
|
||||
import '../../../blue/io_protocol/io_addUser.dart';
|
||||
import '../../../blue/io_protocol/io_reply.dart';
|
||||
import '../../../blue/io_reply.dart';
|
||||
import '../../../blue/io_tool/io_manager.dart';
|
||||
import '../../../blue/io_tool/io_model.dart';
|
||||
import '../../../blue/io_tool/io_tool.dart';
|
||||
|
||||
@ -10,7 +10,7 @@ import '../../../appRouters.dart';
|
||||
import '../../../blue/blue_manage.dart';
|
||||
import '../../../blue/io_protocol/io_addUser.dart';
|
||||
import '../../../blue/io_protocol/io_getLockStatu.dart';
|
||||
import '../../../blue/io_protocol/io_reply.dart';
|
||||
import '../../../blue/io_reply.dart';
|
||||
import '../../../blue/io_tool/io_manager.dart';
|
||||
import '../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../blue/io_tool/manager_event_bus.dart';
|
||||
@ -23,6 +23,7 @@ import 'saveLock_state.dart';
|
||||
class SaveLockLogic extends BaseGetXController {
|
||||
|
||||
final SaveLockState state = SaveLockState();
|
||||
int userNo = 0;
|
||||
|
||||
// 获取解析后的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
@ -51,6 +52,8 @@ class SaveLockLogic extends BaseGetXController {
|
||||
int status = reply.data[46];
|
||||
print("status:$status");
|
||||
|
||||
userNo = reply.data[47];
|
||||
print("status:$status");
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
@ -68,9 +71,9 @@ class SaveLockLogic extends BaseGetXController {
|
||||
|
||||
IoSenderManage.senderAddUser(
|
||||
lockID:BlueManage().connectDeviceName,
|
||||
authUserID:await Storage.getUserId(),
|
||||
authUserID:await Storage.getUid(),
|
||||
keyID:"1",
|
||||
userID:await Storage.getUserId(),
|
||||
userID:await Storage.getUid(),
|
||||
openMode:1,
|
||||
keyType:1,
|
||||
startDate:0x11223344,
|
||||
@ -199,9 +202,9 @@ class SaveLockLogic extends BaseGetXController {
|
||||
|
||||
IoSenderManage.senderAddUser(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
authUserID:await Storage.getUserId(),
|
||||
authUserID:await Storage.getUid(),
|
||||
keyID:"1",
|
||||
userID:await Storage.getUserId(),
|
||||
userID:await Storage.getUid(),
|
||||
openMode:1,
|
||||
keyType:1,
|
||||
startDate:DateTime.now().millisecondsSinceEpoch,
|
||||
@ -258,7 +261,8 @@ class SaveLockLogic extends BaseGetXController {
|
||||
nbInitSuccess:"0",
|
||||
position:positionMap,
|
||||
bluetooth:bluetooth,
|
||||
deviceNo:"123456"
|
||||
deviceNo:"123456",
|
||||
lockUserNo:userNo.toString()
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
EventBusManager().eventBusFir(RefreshLockListInfoDataEvent);
|
||||
@ -275,7 +279,7 @@ class SaveLockLogic extends BaseGetXController {
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
IoSenderManage.senderGetLockStatu(
|
||||
lockID:BlueManage().connectDeviceName,
|
||||
userID:await Storage.getUserId(),
|
||||
userID:await Storage.getUid(),
|
||||
privateKey:getPrivateKeyList,
|
||||
);
|
||||
}
|
||||
|
||||
@ -235,7 +235,8 @@ class ApiProvider extends BaseProvider {
|
||||
String nbInitSuccess,
|
||||
Map position,
|
||||
Map bluetooth,
|
||||
String deviceNo) =>
|
||||
String deviceNo,
|
||||
String lockUserNo) =>
|
||||
post(
|
||||
bindingBlueAdminURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -246,7 +247,8 @@ class ApiProvider extends BaseProvider {
|
||||
"nbInitSuccess": nbInitSuccess,
|
||||
'position': position,
|
||||
'bluetooth': bluetooth,
|
||||
'deviceNo': deviceNo
|
||||
'deviceNo': deviceNo,
|
||||
'lockUserNo': lockUserNo,
|
||||
}));
|
||||
|
||||
// 获取锁信息
|
||||
|
||||
@ -185,9 +185,10 @@ class ApiRepository {
|
||||
required String nbInitSuccess,
|
||||
required Map position,
|
||||
required Map bluetooth,
|
||||
required String deviceNo}) async {
|
||||
required String deviceNo,
|
||||
required String lockUserNo}) async {
|
||||
final res = await apiProvider.bindingBlueAdmin(bindingDate, hotelMode,
|
||||
lockAlias, lockData, nbInitSuccess, position, bluetooth, deviceNo);
|
||||
lockAlias, lockData, nbInitSuccess, position, bluetooth, deviceNo, lockUserNo);
|
||||
return SaveLockEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ class Storage {
|
||||
sp.clear();
|
||||
}
|
||||
|
||||
static Future<String?> getUserId() async {
|
||||
static Future<String?> getUid() async {
|
||||
String? userId = '';
|
||||
final data = await Storage.getString('userLoginData');
|
||||
if (data != null && data.isNotEmpty) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user