fix:代码合并

This commit is contained in:
liyi 2024-12-10 09:45:50 +08:00
parent b723d127f4
commit 14eb5c448e
30 changed files with 288 additions and 1649 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 KiB

View File

@ -74,6 +74,8 @@ PODS:
- SDWebImage
- SwiftyGif
- EMASRest (11.1.1.2)
- fast_rsa (0.6.0):
- Flutter
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- Flutter
@ -176,6 +178,7 @@ DEPENDENCIES:
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- fast_rsa (from `.symlinks/plugins/fast_rsa/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- Flutter (from `Flutter`)
- flutter_blue_plus (from `.symlinks/plugins/flutter_blue_plus/ios`)
@ -256,6 +259,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/connectivity_plus/darwin"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
fast_rsa:
:path: ".symlinks/plugins/fast_rsa/ios"
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
Flutter:
@ -335,6 +340,7 @@ SPEC CHECKSUMS:
DKImagePickerController: 0a24ebfe7b48beeb74c27531540aaa2cc1dac6cf
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
EMASRest: 8df6f87836767a9415ad5cc4af739bc9d215b475
fast_rsa: a1fed69b074093d2e2e3fefae6b821a071649d4c
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_blue_plus: 4837da7d00cf5d441fdd6635b3a57f936778ea96
@ -375,4 +381,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: a4d4747e9f246a7c5b9d643d5efa33799112963a
COCOAPODS: 1.14.3
COCOAPODS: 1.16.2

View File

@ -622,9 +622,9 @@
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
04139B652D068B83005296D1 /* Debug-pre-sky */ = {
04139B652D068B83005296D1 /* Debug-sky */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = E0A496CE2CA30CEF00E376BB /* skyPreviewRelease.xcconfig */;
baseConfigurationReference = 7579B06AEF5FEA95042D8474 /* skyDebug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
@ -683,7 +683,7 @@
"$(PROJECT_DIR)/Flutter",
);
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.skychip.lock.pre;
PRODUCT_BUNDLE_IDENTIFIER = com.starlock.lock.local;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -691,14 +691,14 @@
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = "Debug-pre-sky";
name = "Debug-sky";
};
04139B662D068B83005296D1 /* Debug-pre-sky */ = {
04139B662D068B83005296D1 /* Debug-sky */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 2DE29642D6CB826BF1547F1F /* Pods-Runner.debug-pre-sky.xcconfig */;
baseConfigurationReference = 4A63B2C308CB401731950EC8 /* Pods-Runner.debug-sky.xcconfig */;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerRelease-sky.entitlements";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = NAQ5PL2DYC;
@ -708,20 +708,20 @@
/usr/lib/swift,
"$(inherited)",
);
PRODUCT_BUNDLE_IDENTIFIER = com.skychip.lock.pre;
PRODUCT_BUNDLE_IDENTIFIER = com.starlock.lock.local;
PRODUCT_NAME = Runner;
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = Adhoc_com.skychip.lock.pre.mobileprovision;
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = Debug_com.starlock.lock.local.mobileprovision;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
TARGETED_DEVICE_FAMILY = 1;
};
name = "Debug-pre-sky";
name = "Debug-sky";
};
04139B672D068BA8005296D1 /* Debug-pre-xhj */ = {
04139B672D068BA8005296D1 /* Debug-xhj */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = E0A496CA2CA30C7400E376BB /* xhjPreviewRelease.xcconfig */;
baseConfigurationReference = 853610C00A55CC450C2FF839 /* xhjDebug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
@ -780,7 +780,7 @@
"$(PROJECT_DIR)/Flutter",
);
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.xhjcn.lock.pre;
PRODUCT_BUNDLE_IDENTIFIER = com.starlock.lock.local;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -788,33 +788,33 @@
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = "Debug-pre-xhj";
name = "Debug-xhj";
};
04139B682D068BA8005296D1 /* Debug-pre-xhj */ = {
04139B682D068BA8005296D1 /* Debug-xhj */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = A728CF82D2CACE8B399AACAB /* Pods-Runner.debug-pre-xhj.xcconfig */;
baseConfigurationReference = 22D858E988707FF26E068457 /* Pods-Runner.debug-xhj.xcconfig */;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerRelease-xhj.entitlements";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = P8997RW3V8;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = NAQ5PL2DYC;
INFOPLIST_FILE = Runner/info_xhj.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
/usr/lib/swift,
"$(inherited)",
);
PRODUCT_BUNDLE_IDENTIFIER = com.xhjcn.lock.pre;
PRODUCT_BUNDLE_IDENTIFIER = com.starlock.lock.local;
PRODUCT_NAME = Runner;
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = Adhoc_com.xhjcn.lock.pre.mobileprovision;
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = Debug_com.starlock.lock.local.mobileprovision;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
TARGETED_DEVICE_FAMILY = 1;
};
name = "Debug-pre-xhj";
name = "Debug-xhj";
};
04ED96322B688AB00046472A /* Release-sky */ = {
isa = XCBuildConfiguration;
@ -1073,7 +1073,7 @@
);
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.starlock.lock.dev;
PRODUCT_BUNDLE_IDENTIFIER = com.starlock.lock.local;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -1267,7 +1267,7 @@
"$(PROJECT_DIR)/Flutter",
);
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.skychip.lock;
PRODUCT_BUNDLE_IDENTIFIER = com.skychip.lock.dev;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -1461,7 +1461,7 @@
"$(PROJECT_DIR)/Flutter",
);
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.xhjcn.lock;
PRODUCT_BUNDLE_IDENTIFIER = com.xhjcn.lock.dev;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -1506,11 +1506,11 @@
E0A496C62CA309AD00E376BB /* Debug-local */,
5028C464A6FD115380ECE6A0 /* Release-sky */,
E0A496D02CA30D2800E376BB /* Pre-release-sky */,
04139B652D068B83005296D1 /* Debug-pre-sky */,
04139B652D068B83005296D1 /* Debug-sky */,
E0A496D22CA30D5A00E376BB /* Dev-release-sky */,
9073AF548DAA546CE84A8D2F /* Release-xhj */,
E0A496D42CA30D7400E376BB /* Pre-release-xhj */,
04139B672D068BA8005296D1 /* Debug-pre-xhj */,
04139B672D068BA8005296D1 /* Debug-xhj */,
E0A496D62CA30D8400E376BB /* Dev-release-xhj */,
);
defaultConfigurationIsVisible = 0;
@ -1522,11 +1522,11 @@
E0A496C72CA309AD00E376BB /* Debug-local */,
04ED96322B688AB00046472A /* Release-sky */,
E0A496D12CA30D2800E376BB /* Pre-release-sky */,
04139B662D068B83005296D1 /* Debug-pre-sky */,
04139B662D068B83005296D1 /* Debug-sky */,
E0A496D32CA30D5A00E376BB /* Dev-release-sky */,
04ED96352B688AB00046472A /* Release-xhj */,
E0A496D52CA30D7400E376BB /* Pre-release-xhj */,
04139B682D068BA8005296D1 /* Debug-pre-xhj */,
04139B682D068BA8005296D1 /* Debug-xhj */,
E0A496D72CA30D8400E376BB /* Dev-release-xhj */,
);
defaultConfigurationIsVisible = 0;

View File

@ -1108,6 +1108,9 @@
"密码需至少包含数字/字母/字符中的2种组合": "The password must contain at least 2 of the following: numbers, letters, and special characters",
"已开锁": "Unlocked",
"已闭锁": "Locked",
"两次密码不一致哦": "The passwords are inconsistent"
"两次密码不一致哦": "The passwords are inconsistent",
"中功率": "Medium power",
"常规使用": "Regular use",
}

View File

@ -1104,9 +1104,11 @@
"支持的语言": "支持的语言",
"英语": "英语",
"Google Home操作流程的值": "1.用智能锁APP添加锁和网关\n\n2.在APP里开启锁的远程开锁功能这个功能默认是关闭的。如果没有这个选项则锁不支持Google Home \n\n3.安装Google Home APP点击左上角的“+”按钮\n\n4.在设置页面选择“与Google协同工作”\n\n5.搜索“ScienerSmart”并用智能锁APP的账号和密码进行授权\n\n",
"密码需至少包含数字/字母/字符中的2种组合": "密码需至少包含数字/字母/字符中的2种组合",
"已开锁": "已开锁",
"已闭锁": "已闭锁",
"两次密码不一致哦": "两次密码不一致哦"
"两次密码不一致哦": "两次密码不一致哦",
"中功率": "中功率",
"常规使用": "常规使用"
}

View File

@ -1104,9 +1104,12 @@
"支持的语言": "支持的语言",
"英语": "英语",
"Google Home操作流程的值": "1.用智能锁APP添加锁和网关\n\n2.在APP里开启锁的远程开锁功能这个功能默认是关闭的。如果没有这个选项则锁不支持Google Home \n\n3.安装Google Home APP点击左上角的“+”按钮\n\n4.在设置页面选择“与Google协同工作”\n\n5.搜索“ScienerSmart”并用智能锁APP的账号和密码进行授权\n\n",
"密码需至少包含数字/字母/字符中的2种组合": "密码需至少包含数字/字母/字符中的2种组合",
"已开锁": "已开锁",
"已闭锁": "已闭锁",
"两次密码不一致哦": "两次密码不一致哦"
"两次密码不一致哦": "两次密码不一致哦",
"中功率": "中功率",
"常规使用": "常规使用"
}

View File

@ -11,6 +11,7 @@ import 'package:star_lock/tools/commonDataManage.dart';
import 'io_tool/io_model.dart';
import 'io_tool/io_tool.dart';
import 'io_tool/manager_event_bus.dart';
import 'io_type.dart';
import 'reciver_data.dart';
//
@ -241,7 +242,8 @@ class BlueManage {
}
///
Future<void> startScan(int timeout, ScanDevicesCallBack scanDevicesCallBack,
Future<void> startScan(int timeout, DeviceType deviceType,
ScanDevicesCallBack scanDevicesCallBack,
{List<Guid>? idList}) async {
FlutterBluePlus.isSupported.then((bool isAvailable) async {
if (isAvailable) {
@ -259,7 +261,7 @@ class BlueManage {
? scanResult.advertisementData.serviceUuids[0]
: '')
.toString()
.contains('758824')) &&
.contains(getDeviceType(deviceType))) &&
(scanResult.rssi >= -100)) {
// id相同的元素
final int knownDeviceIndex = scanDevices.indexWhere(

View File

@ -1,134 +0,0 @@
/// 使SenderAddICCardWithTimeCycleCoercionCommand 2024.4.16 addby
///
///
// /*
//
// 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 = [];
//
// //
// 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;
// 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);
//
// // 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);
// }
// }
// // 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,4 +1,3 @@
import 'dart:convert';
import 'package:star_lock/tools/dateTool.dart';
@ -16,7 +15,6 @@ import 'package:crypto/crypto.dart' as crypto;
UseCountLimit 0 UseCountLimit 0FingerNo 255userId Delete All !@#
**/
class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
SenderAddICCardWithTimeCycleCoercionCommand({
this.keyID,
this.userID,
@ -55,7 +53,6 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {
return 'SenderAddICCardWithTimeCycleCoercionCommand{keyID: $keyID, '
@ -131,8 +128,8 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
subData.add(endDate! & 0xff);
// startTime 4
final List<int> startTimeList = <int>[0,0,0,0];
if(startTime!.contains(':')){
final List<int> startTimeList = <int>[0, 0, 0, 0];
if (startTime!.contains(':')) {
final List<String> getStartTimeList = startTime!.split(':');
startTimeList[2] = int.parse(getStartTimeList[0]);
startTimeList[3] = int.parse(getStartTimeList[1]);
@ -140,15 +137,15 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
subData.addAll(startTimeList);
// endTime 4
final List<int> endTimeList = <int>[0,0,0,0];
if(endTime!.contains(':')){
final List<int> endTimeList = <int>[0, 0, 0, 0];
if (endTime!.contains(':')) {
final List<String> getendTimeList = endTime!.split(':');
endTimeList[2] = int.parse(getendTimeList[0]);
endTimeList[3] = int.parse(getendTimeList[1]);
}
subData.addAll(endTimeList);
if(needAuthor == 0){
if (needAuthor == 0) {
//AuthCodeLen 1
subData.add(0);
} else {
@ -189,7 +186,8 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
}
class SenderAddICCardWithTimeCycleCoercionReply extends Reply {
SenderAddICCardWithTimeCycleCoercionReply.parseData(CommandType commandType, List<int> dataDetail)
SenderAddICCardWithTimeCycleCoercionReply.parseData(
CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
final int status = data[2];
@ -198,7 +196,8 @@ class SenderAddICCardWithTimeCycleCoercionReply extends Reply {
}
class SenderAddICCardConfirmationReply extends Reply {
SenderAddICCardConfirmationReply.parseData(CommandType commandType, List<int> dataDetail)
SenderAddICCardConfirmationReply.parseData(
CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
final int status = data[2];

View File

@ -1,152 +0,0 @@
import 'dart:convert';
import 'package:crypto/crypto.dart' as crypto;
import 'package:star_lock/tools/dateTool.dart';
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
///
/*
UseCountLimit 0 UseCountLimit 0FingerNo 255userId Delete All !@#
**/
class SenderAddStressPasswordCommand extends SenderProtocol {
SenderAddStressPasswordCommand({
this.keyID,
this.userID,
this.passwordNo,
this.useCountLimit,
this.token,
this.startTime,
this.endTime,
this.needAuthor,
this.publicKey,
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? passwordNo;
int? useCountLimit;
List<int>? token;
int? startTime;
int? endTime;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
@override
String toString() {
return 'SenderAddStressPasswordCommand{keyID: $keyID, userID: $userID, '
'passwordNo: $passwordNo, useCountLimit: $useCountLimit, '
'token: $token, '
'startTime: ${DateTool().dateIntToYMDHNString(startTime)}, '
'endTime: ${DateTool().dateIntToYMDHNString(endTime)}, '
'needAuthor: $needAuthor, publicKey: $publicKey, '
'privateKey: $privateKey}';
}
@override
List<int> messageDetail() {
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
final int type = commandType!.typeValue;
final double typeDouble = type / 256;
final int type1 = typeDouble.toInt();
final int type2 = type % 256;
data.add(type1);
data.add(type2);
//
data.add(60);
// keyID 40
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
// PwdNo
subData.add(passwordNo!);
// 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 {
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
//token 4 Token 0
authCodeData.addAll(token!);
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
final crypto.Digest 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) {
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
}
printLog(data);
// LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
return ebcData;
}
}
class SenderAddStressPasswordReply extends Reply {
SenderAddStressPasswordReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,126 +0,0 @@
//
import 'dart:convert';
import '../../app_settings/app_settings.dart';
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
import 'package:crypto/crypto.dart' as crypto;
class SenderCheckingCardStatusCommand extends SenderProtocol {
SenderCheckingCardStatusCommand({
this.keyID,
this.userID,
this.role,
this.cardCount,
this.cardNo,
this.token,
this.needAuthor,
this.publicKey,
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? role;
int? cardCount;
int? cardNo;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
@override
String toString() {
return 'SenderCheckingCardStatusCommand{keyID: $keyID, userID: $userID, '
'role: $role, cardCount: $cardCount, cardNo: $cardNo, token: $token, '
'needAuthor: $needAuthor, publicKey: $publicKey, privateKey: $privateKey}';
}
@override
List<int> messageDetail() {
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
final int type = commandType!.typeValue;
final double typeDouble = type / 256;
final int type1 = typeDouble.toInt();
final int type2 = type % 256;
data.add(type1);
data.add(type2);
//
data.add(20);
// keyID 40
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
// role
subData.add(role!);
// CardCount
subData.add(cardCount!);
// CardNo
subData.add(cardNo!);
if(needAuthor == 0){
//AuthCodeLen 1
subData.add(0);
} else {
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
//token 4 Token 0
authCodeData.addAll(token!);
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
final crypto.Digest 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) {
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
}
printLog(data);
// LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
return ebcData;
}
}
class SenderCheckingCardStatusReply extends Reply {
SenderCheckingCardStatusReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
}
}

View File

@ -1,130 +0,0 @@
// ()
import 'dart:convert';
import 'package:crypto/crypto.dart' as crypto;
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
class SenderCheckingUserInfoCountCommand extends SenderProtocol {
SenderCheckingUserInfoCountCommand({
this.keyID,
this.userID,
this.role,
this.nowTime,
this.token,
this.needAuthor,
this.publicKey,
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? role;
int? nowTime;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
@override
String toString() {
return 'SenderCheckingUserInfoCountCommand{keyID: $keyID, userID: $userID,'
' role: $role, nowTime: $nowTime, token: $token, '
'needAuthor: $needAuthor, publicKey: $publicKey, privateKey: $privateKey}';
}
@override
List<int> messageDetail() {
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
final int type = commandType!.typeValue;
final double typeDouble = type / 256;
final int type1 = typeDouble.toInt();
final int type2 = type % 256;
data.add(type1);
data.add(type2);
//
data.add(15);
// keyID 40
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
// Role
subData.add(role!);
// time
subData.add((nowTime! & 0xff000000) >> 24);
subData.add((nowTime! & 0xff0000) >> 16);
subData.add((nowTime! & 0xff00) >> 8);
subData.add(nowTime! & 0xff);
// token
// subData.addAll(token!);
if(needAuthor == 0){
//AuthCodeLen 1
subData.add(0);
} else {
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
//token 4 Token 0
authCodeData.addAll(token!);
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
final crypto.Digest 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) {
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
}
printLog(data);
// LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
return ebcData;
}
}
class SenderCheckingUserInfoCountReply extends Reply {
SenderCheckingUserInfoCountReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,128 +0,0 @@
//
import 'dart:convert';
import 'package:crypto/crypto.dart' as crypto;
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
class SenderQueryingFaceStatusCommand extends SenderProtocol {
SenderQueryingFaceStatusCommand({
this.keyID,
this.userID,
this.role,
this.faceCount,
this.faceNo,
this.token,
this.needAuthor,
this.publicKey,
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? role;
int? faceCount;
int? faceNo;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
@override
String toString() {
return 'SenderQueryingFaceStatusCommand{keyID: $keyID, userID: $userID, '
'role: $role, faceCount: $faceCount, faceNo: $faceNo, token: $token, '
'needAuthor: $needAuthor, publicKey: $publicKey, privateKey: $privateKey}';
}
@override
List<int> messageDetail() {
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
final int type = commandType!.typeValue;
final double typeDouble = type / 256;
final int type1 = typeDouble.toInt();
final int type2 = type % 256;
data.add(type1);
data.add(type2);
// --
data.add(80);
// keyID 40
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
// role
subData.add(role!);
// fingerCount
subData.add(faceCount!);
// FingerNo
subData.add(faceNo!);
if (needAuthor == 0) {
//AuthCodeLen 1
subData.add(0);
} else {
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
//token 4 Token 0
authCodeData.addAll(token!);
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
final crypto.Digest 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) {
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
}
printLog(data);
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
return ebcData;
}
}
class SenderQueryingFaceStatusReply extends Reply {
SenderQueryingFaceStatusReply.parseData(
CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,129 +0,0 @@
//
import 'dart:convert';
import 'package:crypto/crypto.dart' as crypto;
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
class SenderQueryingFingerprintStatusCommand extends SenderProtocol {
SenderQueryingFingerprintStatusCommand({
this.keyID,
this.userID,
this.role,
this.fingerCount,
this.fingerNo,
this.token,
this.needAuthor,
this.publicKey,
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? role;
int? fingerCount;
int? fingerNo;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
@override
String toString() {
return 'SenderQueryingFingerprintStatusCommand{keyID: $keyID, '
'userID: $userID, role: $role, fingerCount: $fingerCount, '
'fingerNo: $fingerNo, token: $token, needAuthor: $needAuthor, '
'publicKey: $publicKey, privateKey: $privateKey}';
}
@override
List<int> messageDetail() {
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
final int type = commandType!.typeValue;
final double typeDouble = type / 256;
final int type1 = typeDouble.toInt();
final int type2 = type % 256;
data.add(type1);
data.add(type2);
//
data.add(30);
// keyID 40
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
// role
subData.add(role!);
// fingerCount
subData.add(fingerCount!);
// FingerNo
subData.add(fingerNo!);
if(needAuthor == 0){
//AuthCodeLen 1
subData.add(0);
} else {
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
//token 4 Token 0
authCodeData.addAll(token!);
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
final crypto.Digest 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) {
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
}
printLog(data);
// LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
return ebcData;
}
}
class SenderQueryingFingerprintStatusReply extends Reply {
SenderQueryingFingerprintStatusReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,127 +0,0 @@
// ()
import 'dart:convert';
import 'package:crypto/crypto.dart' as crypto;
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
class SenderReferEventRecordNumberCommand extends SenderProtocol {
SenderReferEventRecordNumberCommand({
this.keyID,
this.userID,
this.logsCount,
this.logsNo,
this.token,
this.needAuthor,
this.publicKey,
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? logsCount;
int? logsNo;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
@override
String toString() {
return 'SenderReferEventRecordNumberCommand{keyID: $keyID, '
'userID: $userID, logsCount: $logsCount, logsNo: $logsNo, '
'token: $token, needAuthor: $needAuthor, publicKey: $publicKey, '
'privateKey: $privateKey}';
}
@override
List<int> messageDetail() {
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
final int type = commandType!.typeValue;
final double typeDouble = type / 256;
final int type1 = typeDouble.toInt();
final int type2 = type % 256;
data.add(type1);
data.add(type2);
//
data.add(40);
// keyID 40
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
// logsCount
subData.add(logsCount!);
// logsNo
subData.add(logsNo!);
// token
// subData.addAll(token!);
if(needAuthor == 0){
//AuthCodeLen 1
subData.add(0);
} else {
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
//token 4 Token 0
authCodeData.addAll(token!);
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
final crypto.Digest 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) {
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
}
printLog(data);
// LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
return ebcData;
}
}
class SenderReferEventRecordNumberReply extends Reply {
SenderReferEventRecordNumberReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,128 +0,0 @@
import 'dart:convert';
import 'package:crypto/crypto.dart' as crypto;
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
//
class TransferPermissionsCommand extends SenderProtocol {
TransferPermissionsCommand({
this.lockID,
this.authUserID,
this.keyID,
this.oldUserID,
this.newUserID,
this.needAuthor,
this.publicKey,
this.privateKey,
this.token
}) : super(CommandType.transferPermissions);
String? lockID;
String? authUserID;
String? keyID;
String? oldUserID;
String? newUserID;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
List<int>? token;
@override
String toString() {
return 'TransferPermissionsCommand{lockID: $lockID, '
'authUserID: $authUserID, keyID: $keyID, oldUserID: $oldUserID, '
'newUserID: $newUserID, needAuthor: $needAuthor, '
'publicKey: $publicKey, privateKey: $privateKey, token: $token}';
}
@override
List<int> messageDetail() {
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
final int type = commandType!.typeValue;
final double typeDouble = type / 256;
final int type1 = typeDouble.toInt();
final int type2 = type % 256;
data.add(type1);
data.add(type2);
// id 40
final int lockIDLength = utf8.encode(lockID!).length;
data.addAll(utf8.encode(lockID!));
data = getFixedLengthList(data, 40 - lockIDLength);
//authUserID 20
final int authUserIDLength = utf8.encode(authUserID!).length;
data.addAll(utf8.encode(authUserID!));
data = getFixedLengthList(data, 20 - authUserIDLength);
//KeyID 40
final int keyIDLength = utf8.encode(keyID!).length;
data.addAll(utf8.encode(keyID!));
data = getFixedLengthList(data, 40 - keyIDLength);
//oldUserID 20
final int oldUserIDLength = utf8.encode(oldUserID!).length;
data.addAll(utf8.encode(oldUserID!));
data = getFixedLengthList(data, 20 - oldUserIDLength);
//newUserID 20
final int newUserIDLength = utf8.encode(newUserID!).length;
data.addAll(utf8.encode(newUserID!));
data = getFixedLengthList(data, 20 - newUserIDLength);
// token 4 Token 0 token失效或者第一次发送的时候token为0
data.addAll(token!);
if(needAuthor == 0){
//AuthCodeLen 1
data.add(0);
} else {
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(authUserID!));
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
//token 4 Token 0
authCodeData.addAll(token!);
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);
}
if ((data.length % 16) != 0) {
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
}
printLog(data);
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
return ebcData;
}
}
class TransferPermissionsReply extends Reply {
TransferPermissionsReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
}
}

View File

@ -1,20 +1,37 @@
//
enum DeviceType {
blue, // 758824
gateway // 758825
}
String getDeviceType(DeviceType deviceType) {
String t = '758824';
switch (deviceType) {
case DeviceType.blue:
t = '758824';
break;
case DeviceType.gateway:
t = '758825';
break;
}
return t;
}
//
enum CommandType {
addUser, // = 0x3001
deletUser, // = 0x3002
editUser, // = 0x3003
transferSmartLock, // = 0x300D
factoryDataReset, // = 0x3004
openLock, // = 0x3005
readLockStatusInfo, // = 0x300A
transferPermissions, // = 0x300B
cleanUpUsers, // = 0x300C
reportDoorOpenRecord, // = 0x3020
transferSmartLock, // = 0x300D
updataLockPasswordList, //- 0x3021
updataLockCardList, //- 0x3022
updataLockFingerprintList, //- 0x3023
updataLockFaceList, //- 0x3024
updataLockPalmVeinList, //- 0x3025
updataLockFaceList, //- 0x3024
updataLockPalmVeinList, //- 0x3025
updataLockRemoteControlList, //- 0x3026
updataLockSet, //- 0x302A
getLockPublicKey, // = 0x3090
@ -22,13 +39,14 @@ enum CommandType {
calibrationTime, // = 0x30f0
readStarLockStatusInfo, // 0x3040
startOATUpgrade, //OTA升级开始 0x30E0
confirmationOTAUpgrade, //OTA升级开始 0x30E2
processOTAUpgrade, //OTA升级过程 0x30E1
gatewayGetStatus,// 0x30F8
gatewayConfiguringWifi,// 0x30F4
gatewayConfiguringWifiResult,// 0x30F5
gatewayGetWifiList,//wifi列表 0x30F6
gatewayGetWifiListResult,//wifi列表结果 0x30F7
confirmationOTAUpgrade, //OTA升级确认 0x30E2
gatewayConfiguringWifi, // 0x30F4
gatewayConfiguringWifiResult, // 0x30F5
gatewayGetWifiList, //wifi列表 0x30F6
gatewayGetWifiListResult, //wifi列表结果 0x30F7
gatewayGetStatus, // 0x30F8
generalExtendedCommond, // = 0x3030
gecChangeAdministratorPassword, // - = 2
@ -59,7 +77,7 @@ enum CommandType {
extension ExtensionCommandType on CommandType {
static CommandType getCommandType(int value) {
CommandType type = CommandType.readLockStatusInfo;
CommandType type = CommandType.readStarLockStatusInfo;
switch (value) {
case 0x3001:
{
@ -96,21 +114,6 @@ extension ExtensionCommandType on CommandType {
type = CommandType.transferSmartLock;
}
break;
case 0x300A:
{
type = CommandType.readLockStatusInfo;
}
break;
case 0x300B:
{
type = CommandType.transferPermissions;
}
break;
case 0x3020:
{
type = CommandType.reportDoorOpenRecord;
}
break;
case 0x3021:
{
type = CommandType.updataLockPasswordList;
@ -213,7 +216,7 @@ extension ExtensionCommandType on CommandType {
break;
default:
{
type = CommandType.readLockStatusInfo;
type = CommandType.readStarLockStatusInfo;
}
break;
}
@ -244,15 +247,6 @@ extension ExtensionCommandType on CommandType {
case CommandType.transferSmartLock:
type = 0x300D;
break;
case CommandType.readLockStatusInfo:
type = 0x300A;
break;
case CommandType.transferPermissions:
type = 0x300B;
break;
case CommandType.reportDoorOpenRecord:
type = 0x3020;
break;
case CommandType.updataLockPasswordList:
type = 0x3021;
break;
@ -374,9 +368,6 @@ extension ExtensionCommandType on CommandType {
case 0x300B:
t = '转移权限';
break;
case 0x3020:
t = '开门记录上报';
break;
case 0x3021:
t = '上传数据获取锁密码列表';
break;
@ -410,18 +401,6 @@ extension ExtensionCommandType on CommandType {
case 0x30f0:
t = '校时';
break;
case 0x30f1:
t = '同步位置信息';
break;
case 0x30f2:
t = '运维开锁';
break;
case 0x3016:
t = '写酒店信息';
break;
case 0x3017:
t = '读酒店信息';
break;
case 0x3040:
t = '读星锁状态信息';
break;

View File

@ -3,6 +3,8 @@ import 'dart:convert';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/blue/blue_manage.dart';
import 'package:star_lock/blue/io_gateway/io_gateway_configuringWifi.dart';
import 'package:star_lock/blue/io_gateway/io_gateway_getWifiList.dart';
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
import 'package:star_lock/blue/io_protocol/io_addPalmWithTimeCycleCoercion.dart';
import 'package:star_lock/blue/io_protocol/io_changeAdministratorPassword.dart';
@ -10,11 +12,8 @@ import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart';
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_gateway/io_gateway_configuringWifi.dart';
import 'package:star_lock/blue/io_gateway/io_gateway_getWifiList.dart';
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
import 'package:star_lock/blue/io_protocol/io_queryingFaceStatus.dart';
import 'package:star_lock/blue/io_protocol/io_readAdminPassword.dart';
import 'package:star_lock/blue/io_protocol/io_readSupportFunctionsNoParameters.dart';
import 'package:star_lock/blue/io_protocol/io_readSupportFunctionsWithParameters.dart';
@ -22,25 +21,19 @@ import 'package:star_lock/blue/io_protocol/io_referEventRecordTime.dart';
import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsNoParameters.dart';
import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsWithParameters.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_gateway/io_gateway_getStatus.dart';
import 'io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';
import 'io_protocol/io_addICCardWithTimeCycleCoercion.dart';
import 'io_protocol/io_addRemoteControlWithTimeCycleCoercion.dart';
import 'io_protocol/io_addStressPassword.dart';
import 'io_protocol/io_addUser.dart';
import 'io_protocol/io_checkingCardStatus.dart';
import 'io_protocol/io_checkingUserInfoCount.dart';
import 'io_protocol/io_configuringWifi.dart';
import 'io_gateway/io_gateway_getStatus.dart';
import 'io_protocol/io_getPrivateKey.dart';
import 'io_protocol/io_getPublicKey.dart';
import 'io_protocol/io_getStarLockStatusInfo.dart';
import 'io_protocol/io_getWifiList.dart';
import 'io_protocol/io_openLock.dart';
import 'io_protocol/io_queryingFingerprintStatus.dart';
import 'io_protocol/io_referEventRecordNumber.dart';
import 'io_protocol/io_senderCustomPasswords.dart';
import 'io_protocol/io_senderResetPasswords.dart';
import 'io_protocol/io_transferSmartLock.dart';
@ -174,11 +167,6 @@ class CommandReciverManager {
reply = EditUserReply.parseData(commandType, data);
}
break;
case CommandType.transferPermissions:
{
reply = TransferPermissionsReply.parseData(commandType, data);
}
break;
case CommandType.transferSmartLock:
{
reply = TransferSmartLockReply.parseData(commandType, data);
@ -306,13 +294,6 @@ class CommandReciverManager {
// reply = AutomaticPadlockReply.parseData(commandType, data);
// }
// break;
case 15:
{
// ()
reply = SenderCheckingUserInfoCountReply.parseData(
commandType, data);
}
break;
case 19:
{
//
@ -320,13 +301,6 @@ class CommandReciverManager {
SenderResetPasswordsReply.parseData(commandType, data);
}
break;
case 20:
{
//
reply = SenderCheckingCardStatusReply.parseData(
commandType, data);
}
break;
// case 21:
// {
// //
@ -361,20 +335,6 @@ class CommandReciverManager {
commandType, data);
}
break;
case 30:
{
//
reply = SenderQueryingFingerprintStatusReply.parseData(
commandType, data);
}
break;
// case 31:
// {
// //
// reply =
// SenderAddFingerprintReply.parseData(commandType, data);
// }
// break;
case 32:
{
//
@ -397,13 +357,6 @@ class CommandReciverManager {
commandType, data);
}
break;
case 40:
{
//
reply = SenderReferEventRecordNumberReply.parseData(
commandType, data);
}
break;
case 41:
{
//
@ -450,27 +403,6 @@ class CommandReciverManager {
reply = SenderGetWifiListReply.parseData(commandType, data);
}
break;
case 60:
{
//
reply =
SenderAddStressPasswordReply.parseData(commandType, data);
}
break;
// case 61:
// {
// //
// reply =
// SenderAddStressICCardReply.parseData(commandType, data);
// }
// break;
// case 62:
// {
// //
// reply = SenderAddStressFingerprintReply.parseData(
// commandType, data);
// }
// break;
case 70:
{
// ()/
@ -506,13 +438,6 @@ class CommandReciverManager {
SenderReadAdminPasswordReply.parseData(commandType, data);
}
break;
case 80:
{
//
reply = SenderQueryingFaceStatusReply.parseData(
commandType, data);
}
break;
case 81:
{
//

View File

@ -1,14 +1,14 @@
import 'package:star_lock/blue/io_gateway/io_gateway_getWifiList.dart';
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
import 'package:star_lock/blue/io_protocol/io_changeAdministratorPassword.dart';
import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart';
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
import 'package:star_lock/blue/io_gateway/io_gateway_getWifiList.dart';
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
import 'package:star_lock/blue/io_protocol/io_queryingFaceStatus.dart';
import 'package:star_lock/blue/io_protocol/io_readAdminPassword.dart';
import 'io_gateway/io_gateway_configuringWifi.dart';
import 'io_gateway/io_gateway_getStatus.dart';
import 'io_protocol/io_addCardCancel.dart';
import 'io_protocol/io_addFaceCancel.dart';
import 'io_protocol/io_addFingerprintCancel.dart';
@ -18,31 +18,23 @@ import 'io_protocol/io_addPalmCancel.dart';
import 'io_protocol/io_addPalmWithTimeCycleCoercion.dart';
import 'io_protocol/io_addRemoteControlCancel.dart';
import 'io_protocol/io_addRemoteControlWithTimeCycleCoercion.dart';
import 'io_protocol/io_addStressPassword.dart';
import 'io_protocol/io_addUser.dart';
import 'io_protocol/io_checkingCardStatus.dart';
import 'io_protocol/io_checkingUserInfoCount.dart';
import 'io_protocol/io_configuringWifi.dart';
import 'io_protocol/io_editUser.dart';
import 'io_protocol/io_factoryDataReset.dart';
import 'io_gateway/io_gateway_configuringWifi.dart';
import 'io_gateway/io_gateway_getStatus.dart';
import 'io_protocol/io_getPrivateKey.dart';
import 'io_protocol/io_getPublicKey.dart';
import 'io_protocol/io_getStarLockStatusInfo.dart';
import 'io_protocol/io_getWifiList.dart';
import 'io_protocol/io_openLock.dart';
import 'io_protocol/io_queryingFingerprintStatus.dart';
import 'io_protocol/io_readSupportFunctionsNoParameters.dart';
import 'io_protocol/io_readSupportFunctionsWithParameters.dart';
import 'io_protocol/io_referEventRecordNumber.dart';
import 'io_protocol/io_referEventRecordTime.dart';
import 'io_protocol/io_senderCustomPasswords.dart';
import 'io_protocol/io_senderResetPasswords.dart';
import 'io_protocol/io_setSupportFunctionsNoParameters.dart';
import 'io_protocol/io_setSupportFunctionsWithParameters.dart';
import 'io_protocol/io_timing.dart';
import 'io_protocol/io_transferPermissions.dart';
import 'io_protocol/io_updataLockCardList.dart';
import 'io_protocol/io_updataLockFaceList.dart';
import 'io_protocol/io_updataLockFingerprintList.dart';
@ -260,32 +252,6 @@ class IoSenderManage {
callBack: callBack);
}
//
static void senderTransferPermissions(
{required String? lockID,
required String? authUserID,
required String? keyID,
required String? oldUserID,
required String? newUserID,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
required List<int>? token,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: TransferPermissionsCommand(
lockID: lockID,
authUserID: authUserID,
keyID: keyID,
oldUserID: oldUserID,
newUserID: newUserID,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
token: token),
callBack: callBack);
}
//
static void sendTransferSmartLockCommand(
{required String? lockID,
@ -834,53 +800,6 @@ class IoSenderManage {
callBack: callBack);
}
// -
// static void senderAutomaticPadlockCommand({
// required String? lockID,
// required String? userID,
// required int? autoLockFlag,
// required List<int>? token,
// required int? needAuthor,
// required List<int>? signKey,
// required List<int>? privateKey,
// CommandSendCallBack? callBack}) {
// CommandSenderManager().managerSendData(
// command: AutomaticPadlockCommand(
// lockID: lockID,
// userID: userID,
// autoLockFlag: autoLockFlag,
// token: token,
// needAuthor: needAuthor,
// signKey: signKey,
// privateKey: privateKey,
// ), callBack:callBack);
// }
// ()
static void senderReferEventRecordNumberCommand(
{required String? keyID,
required String? userID,
required int? logsCount,
required int? logsNo,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderReferEventRecordNumberCommand(
keyID: keyID,
userID: userID,
logsCount: logsCount,
logsNo: logsNo,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
),
callBack: callBack);
}
// ()
static void senderReferEventRecordTimeCommand(
{required String? keyID,
@ -908,112 +827,6 @@ class IoSenderManage {
callBack: callBack);
}
//
static void senderQueryingFingerprintStatusCommand(
{required String? keyID,
required String? userID,
required int? role,
required int? fingerCount,
required int? fingerNo,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderQueryingFingerprintStatusCommand(
keyID: keyID,
userID: userID,
role: role,
fingerCount: fingerCount,
fingerNo: fingerNo,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
),
callBack: callBack);
}
//
static void senderCheckingCardStatusCommand(
{required String? keyID,
required String? userID,
required int? role,
required int? cardCount,
required int? cardNo,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderCheckingCardStatusCommand(
keyID: keyID,
userID: userID,
role: role,
cardCount: cardCount,
cardNo: cardNo,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
),
callBack: callBack);
}
//
static void senderQueryingFaceStatusCommand(
{required String? keyID,
required String? userID,
required int? role,
required int? faceCount,
required int? faceNo,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderQueryingFaceStatusCommand(
keyID: keyID,
userID: userID,
role: role,
faceCount: faceCount,
faceNo: faceNo,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
),
callBack: callBack);
}
// ()
static void senderCheckingUserInfoCountCommand(
{required String? keyID,
required String? userID,
required int? role,
required int? nowTime,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderCheckingUserInfoCountCommand(
keyID: keyID,
userID: userID,
role: role,
nowTime: nowTime,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
),
callBack: callBack);
}
// wifi列表
static void getWifiListCommand(
{required String? keyID,
@ -1132,35 +945,6 @@ class IoSenderManage {
// callBack: callBack);
// }
//
static void senderAddStressPasswordCommand(
{required String? keyID,
required String? userID,
required int? passwordNo,
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: SenderAddStressPasswordCommand(
keyID: keyID,
userID: userID,
passwordNo: passwordNo,
useCountLimit: useCountLimit,
token: token,
startTime: startTime,
endTime: endTime,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
),
callBack: callBack);
}
// ()/
static void readSupportFunctionsNoParametersCommand(
{required String? keyID,

View File

@ -1,4 +1,3 @@
import 'dart:async';
import 'package:flutter/material.dart';
@ -16,7 +15,6 @@ import 'package:star_lock/tools/showCupertinoAlertView.dart';
import 'package:umeng_common_sdk/umeng_common_sdk.dart';
import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_transferPermissions.dart';
import '../../../../blue/io_reply.dart';
import '../../../../blue/io_tool/io_tool.dart';
import '../../../../blue/io_tool/manager_event_bus.dart';
@ -225,10 +223,11 @@ class AuthorizedAdminLogic extends BaseGetXController {
final String getMobile = (await Storage.getMobile())!;
if (entity.errorCode!.codeIsSuccessful) {
UmengCommonSdk.onEvent('add_authorizedAdmin', {
'lock_name':BlueManage().connectDeviceName,
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
'date':DateTool().getNowDateWithType(1),
'add_password_result':'添加授权管理员成功',
'lock_name': BlueManage().connectDeviceName,
'account':
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
'date': DateTool().getNowDateWithType(1),
'add_password_result': '添加授权管理员成功',
});
state.createUser.value = 0;
@ -245,12 +244,13 @@ class AuthorizedAdminLogic extends BaseGetXController {
state.createUser.value = 1;
sendElectronicKeyRequest();
});
}else{
} else {
UmengCommonSdk.onEvent('add_authorizedAdmin', {
'lock_name':BlueManage().connectDeviceName,
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
'date':DateTool().getNowDateWithType(1),
'add_password_result':'添加授权管理员失败:${entity.errorMsg}',
'lock_name': BlueManage().connectDeviceName,
'account':
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
'date': DateTool().getNowDateWithType(1),
'add_password_result': '添加授权管理员失败:${entity.errorMsg}',
});
}
}

View File

@ -1,15 +1,12 @@
import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
import 'package:star_lock/blue/io_protocol/io_queryingFaceStatus.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
import 'package:star_lock/main/lockDetail/iris/irisList/irisList_state.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_checkingUserInfoCount.dart';
import '../../../../blue/io_reply.dart';
import '../../../../blue/io_tool/io_tool.dart';
import '../../../../blue/io_tool/manager_event_bus.dart';
@ -29,15 +26,6 @@ class IrisListLogic extends BaseGetXController {
if ((reply is SenderAddFaceReply) && (state.isDeletFaceData == true)) {
_replyAddFaceBegin(reply);
}
if (reply is SenderQueryingFaceStatusReply) {
//
_replyQueryingFaceStatus(reply);
}
if (reply is SenderCheckingUserInfoCountReply) {
_replyCheckingUserInfoCount(reply);
}
});
}
@ -59,10 +47,13 @@ class IrisListLogic extends BaseGetXController {
break;
case 0x06:
//
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
final List<String>? signKey =
await Storage.getStringList(saveBlueSignKey);
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
@ -92,26 +83,6 @@ class IrisListLogic extends BaseGetXController {
}
}
//
Future<void> _replyQueryingFaceStatus(Reply reply) async {
final int status = reply.data[2];
switch (status) {
case 0x00:
//
// _getLockStatus();
break;
case 0x06:
//
break;
default:
//
break;
}
}
//
Future<void> _replyReferEventRecordNumber(Reply reply) async {
final int status = reply.data[2];
@ -130,77 +101,23 @@ class IrisListLogic extends BaseGetXController {
}
}
// ()
Future<void> _replyCheckingUserInfoCount(Reply reply) async {
final int status = reply.data[2];
//
final int userNum = reply.data[5];
//
final int fingerNum = reply.data[6];
//
final int pwdNum = reply.data[7];
//
final int cardNum = reply.data[8];
//
final int logsNum = reply.data[9];
//
final int verNo = reply.data[10];
//
final int maxAdminFingerNum = reply.data[11];
//
final int maxUserFingerNum = reply.data[12];
//
final int maxAdminPassNum = reply.data[13];
//
final int maxUserPassNum = reply.data[14];
//
final int maxAdminCardNum = reply.data[15];
//
final int maxUserCardNum = reply.data[16];
//
final List<int> serialNo = reply.data.sublist(17, 21);
switch (status) {
case 0x00:
//
// _getLockStatus();
break;
case 0x06:
//
break;
default:
//
break;
}
}
//
Future<void> senderQueryingFaceStatus() async {
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState state) async {
if (state == BluetoothConnectionState.connected) {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
final List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList =
changeStringListToIntList(publicKey!);
// IoSenderManage.senderQueryingFaceStatusCommand(
// keyID: BlueManage().connectDeviceName,
@ -222,14 +139,18 @@ class IrisListLogic extends BaseGetXController {
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState state) async {
if (state == BluetoothConnectionState.connected) {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
final List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList =
changeStringListToIntList(publicKey!);
// IoSenderManage.senderCheckingUserInfoCountCommand(
// keyID: BlueManage().connectDeviceName,
@ -254,11 +175,14 @@ class IrisListLogic extends BaseGetXController {
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
final List<String>? signKey =
await Storage.getStringList(saveBlueSignKey);
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
@ -293,7 +217,8 @@ class IrisListLogic extends BaseGetXController {
//
Future<void> getIrisListData() async {
final FingerprintListDataEntity entity = await ApiRepository.to.getFaceListData(
final FingerprintListDataEntity entity =
await ApiRepository.to.getFaceListData(
lockId: state.lockId.value.toString(),
pageNo: '1',
pageSize: '20',
@ -344,7 +269,9 @@ class IrisListLogic extends BaseGetXController {
//
late StreamSubscription _teamEvent;
void _initRefreshAction() {
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((OtherTypeRefreshListEvent event) {
_teamEvent = eventBus
.on<OtherTypeRefreshListEvent>()
.listen((OtherTypeRefreshListEvent event) {
getIrisListData();
});
}

View File

@ -1,4 +1,3 @@
import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
@ -20,16 +19,17 @@ import 'motorPower_state.dart';
class MotorPowerLogic extends BaseGetXController {
final MotorPowerState state = MotorPowerState();
// ->
Future<void> _setLockSetGeneralSetting() async{
final LoginEntity entity = await ApiRepository.to.setOpenDoorDirectionData(
// ->
Future<void> _setLockSetGeneralSetting() async {
final LoginEntity entity = await ApiRepository.to.setMotorTorqueData(
lockId: state.lockSetInfoData.value.lockId!,
openDirectionValue:state.motorTorsion.value, // 1-2-;
motorTorsion: state.motorTorsion.value, // // 123
);
if(entity.errorCode!.codeIsSuccessful){
state.lockSetInfoData.value.lockSettingInfo!.openDirectionValue = state.motorTorsion.value;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
if (entity.errorCode!.codeIsSuccessful) {
state.lockSetInfoData.value.lockSettingInfo!.openDirectionValue =
state.motorTorsion.value;
eventBus
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
showToast('操作成功'.tr);
}
}
@ -37,8 +37,9 @@ class MotorPowerLogic extends BaseGetXController {
//
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if(reply is SetSupportFunctionsNoParametersReply) {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if (reply is SetSupportFunctionsNoParametersReply) {
_replySetSupportFunctionsWithParameters(reply);
}
@ -69,7 +70,7 @@ class MotorPowerLogic extends BaseGetXController {
//
Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async {
final int status = reply.data[2];
switch(status){
switch (status) {
case 0x00:
//
_setLockSetGeneralSetting();
@ -85,16 +86,21 @@ class MotorPowerLogic extends BaseGetXController {
// -
Future<void> _readSupportFunctionsNoParameters() async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
final List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList =
changeStringListToIntList(publicKey!);
IoSenderManage.readSupportFunctionsNoParametersCommand(
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
@ -103,24 +109,28 @@ class MotorPowerLogic extends BaseGetXController {
token: getTokenList,
needAuthor: 1,
publicKey: getPublicKeyList,
privateKey: getPrivateKeyList
);
privateKey: getPrivateKeyList);
}
});
}
// ()
Future<void> sendOpenDoorDirection() async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
final List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList =
changeStringListToIntList(publicKey!);
IoSenderManage.setSupportFunctionsWithParametersCommand(
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
@ -155,5 +165,4 @@ class MotorPowerLogic extends BaseGetXController {
super.onClose();
_replySubscription.cancel();
}
}

View File

@ -4,6 +4,8 @@ import 'package:get/get.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart';
import 'motorPower_logic.dart';
import 'motorPower_state.dart';
class MotorPowerPage extends StatefulWidget {
const MotorPowerPage({Key? key}) : super(key: key);
@ -13,7 +15,8 @@ class MotorPowerPage extends StatefulWidget {
}
class _MotorPowerPageState extends State<MotorPowerPage> {
bool isCheck = false;
final MotorPowerLogic logic = Get.put(MotorPowerLogic());
final MotorPowerState state = Get.find<MotorPowerLogic>().state;
@override
Widget build(BuildContext context) {
@ -42,23 +45,39 @@ class _MotorPowerPageState extends State<MotorPowerPage> {
SizedBox(
height: 40.h,
),
_buildTipsView('${'小功率:'.tr}\n', '耗电少'.tr, isCheck),
_buildTipsView(
'${'小功率:'.tr}\n', '耗电少'.tr, state.motorTorsion.value == 1, () {
state.motorTorsion.value = 1;
logic.sendOpenDoorDirection();
}),
SizedBox(
height: 20.h,
),
_buildTipsView('${'大功率'.tr}\n',
'大功率提示'.tr, !isCheck)
_buildTipsView(
'${'中功率'.tr}\n', '常规使用'.tr, state.motorTorsion.value == 2, () {
state.motorTorsion.value = 2;
logic.sendOpenDoorDirection();
}),
SizedBox(
height: 20.h,
),
_buildTipsView(
'${'大功率'.tr}\n', '大功率提示'.tr, state.motorTorsion.value == 3, () {
state.motorTorsion.value = 3;
logic.sendOpenDoorDirection();
}),
],
));
}
Widget _buildTipsView(String titleStr, String subTitle, bool isClick) {
Widget _buildTipsView(
String titleStr, String subTitle, bool isClick, Function() action) {
return GestureDetector(
child: Container(
width: ScreenUtil().screenWidth - 40.w,
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
padding: EdgeInsets.only(
left: 20.w, top: 30.h, bottom: 30.h, right: 15.w),
padding:
EdgeInsets.only(left: 20.w, top: 30.h, bottom: 30.h, right: 15.w),
decoration: BoxDecoration(
color: isClick
? AppColors.blueViewBgColor
@ -67,27 +86,25 @@ class _MotorPowerPageState extends State<MotorPowerPage> {
),
child: Row(
children: [
if (isClick) Image.asset(
'images/mine/icon_mine_blueSelect.png',
width: 20.w,
height: 14.w,
) else SizedBox(
width: 20.w,
height: 14.w,
),
if (isClick)
Image.asset(
'images/mine/icon_mine_blueSelect.png',
width: 20.w,
height: 14.w,
)
else
SizedBox(
width: 20.w,
height: 14.w,
),
SizedBox(width: 20.w),
SizedBox(
width: ScreenUtil().screenWidth - 40.w - 20.w*4,
child: _buildRichText(titleStr, subTitle, isClick)
),
width: ScreenUtil().screenWidth - 40.w - 20.w * 4,
child: _buildRichText(titleStr, subTitle, isClick)),
],
),
),
onTap: () {
setState(() {
isCheck = !isCheck;
});
},
onTap: action,
);
}

View File

@ -1,19 +1,15 @@
import 'package:get/get.dart';
import '../lockSet/lockSetInfo_entity.dart';
class MotorPowerState {
var lockSetInfoData = LockSetInfoData().obs;
var motorTorsion = 1.obs;
MotorPowerState() {
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
final map = Get.arguments;
lockSetInfoData.value = map['lockSetInfoData'];
motorTorsion.value = lockSetInfoData.value.lockSettingInfo!.motorTorsion!;
}
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
RxInt motorTorsion = 1.obs; // 123
}

View File

@ -13,6 +13,7 @@ import 'package:star_lock/blue/io_protocol/io_getPrivateKey.dart';
import 'package:star_lock/blue/io_protocol/io_getPublicKey.dart';
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
import 'package:star_lock/blue/io_type.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
import 'package:star_lock/mine/addLock/nearbyLock/nearbyLock_page.dart';
import 'package:star_lock/tools/baseGetXController.dart';
@ -235,7 +236,8 @@ class NearbyLockLogic extends BaseGetXController {
//
final List<int> restoreCounter = reply.data.sublist(index, index + 2);
state.lockInfo['restoreCount'] = restoreCounter[0] * 256 + restoreCounter[1];
state.lockInfo['restoreCount'] =
restoreCounter[0] * 256 + restoreCounter[1];
index = index + 2;
// AppLog.log('重置次数 restoreCounter:${restoreCounter[0] * 256 + restoreCounter[1]}');
@ -276,7 +278,8 @@ class NearbyLockLogic extends BaseGetXController {
// AppLog.log('mac地址 macAddressStr:$macAddressStr');
//
state.lockInfo['timezoneOffset'] = DateTime.now().timeZoneOffset.inSeconds;
state.lockInfo['timezoneOffset'] =
DateTime.now().timeZoneOffset.inSeconds;
//
final int featureValueLength = reply.data[index];
@ -389,7 +392,7 @@ class NearbyLockLogic extends BaseGetXController {
}
void startScanBlueList() {
BlueManage().startScan(2000, (List<ScanResult> list) {
BlueManage().startScan(2000, DeviceType.blue, (List<ScanResult> list) {
state.devices.clear();
for (int i = 0; i < list.length; i++) {
final ScanResult device = list[i];
@ -497,7 +500,8 @@ class NearbyLockLogic extends BaseGetXController {
final int now = DateTime.now().millisecondsSinceEpoch;
// final String msg = '传输完成 时间:${now - startSecond}秒 otaCount:$otaCount otaIndex:$otaIndex ';
closeOTADAta();
AppLog.log('传输完成 时间:${now - startSecond}秒 otaCount:$otaCount otaIndex:$otaIndex ');
AppLog.log(
'传输完成 时间:${now - startSecond}秒 otaCount:$otaCount otaIndex:$otaIndex ');
// showToast(msg);
return;
}
@ -670,7 +674,8 @@ class NearbyLockLogic extends BaseGetXController {
// AppLog.log('bluetoothRequest:$e');
// }
final bool bluetoothRequest = await PermissionDialog.requestBluetooth();
final bool locationRequest = await PermissionDialog.request(Permission.location);
final bool locationRequest =
await PermissionDialog.request(Permission.location);
AppLog.log('locationRequest:$locationRequest');
if (!bluetoothRequest || !locationRequest) {
return;
@ -680,5 +685,4 @@ class NearbyLockLogic extends BaseGetXController {
state.ifCurrentScreen.value = true;
startScanBlueList();
}
}

View File

@ -13,6 +13,7 @@ import '../../../../blue/io_gateway/io_gateway_getStatus.dart';
import '../../../../blue/io_reply.dart';
import '../../../../blue/io_tool/io_tool.dart';
import '../../../../blue/io_tool/manager_event_bus.dart';
import '../../../../blue/io_type.dart';
import '../../../../blue/sender_manage.dart';
import '../../../../tools/storage.dart';
import '../../../../widget/permission/permission_dialog.dart';
@ -93,7 +94,7 @@ class SelectGatewayListLogic extends BaseGetXController {
}
void startScanBlueList() {
BlueManage().startScan(2000, (List<ScanResult> list) {
BlueManage().startScan(2000, DeviceType.gateway, (List<ScanResult> list) {
state.devices.clear();
for (int i = 0; i < list.length; i++) {
final ScanResult device = list[i];

View File

@ -19,6 +19,7 @@ import '../../../tools/showTipView.dart';
import '../../../tools/submitBtn.dart';
import '../../../tools/titleAppBar.dart';
import '../../../tools/wechat/wechatManageTool.dart';
import '../../../tools/wechat/wx_push_miniProgram/wx_push_miniProgram.dart';
import '../../../translations/trans_lib.dart';
class MineSetPage extends StatefulWidget {
@ -60,26 +61,43 @@ class _MineSetPageState extends State<MineSetPage>
_checkNotificationPermission();
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: widget.showAppBar
? F.sw(
skyCall: () => TitleAppBar(
barTitle: '更多设置'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
backgroundColor: AppColors.mainBackgroundColor,
appBar: widget.showAppBar
? F.sw(
skyCall: () => TitleAppBar(
barTitle: '更多设置'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
xhjCall: () => TitleAppBar(
barTitle: '更多设置'.tr,
haveBack: true,
backgroundColor: Colors.white,
iconColor: AppColors.blackColor,
titleColor: AppColors.blackColor,
))
: null,
body: SingleChildScrollView(
child: styleHierarchy(),
),
floatingActionButton: widget.showAppBar
? null
: GestureDetector(
onTap: () {
WechatManageTool.getAppInfo(() {
WxPushWeChatMiniProgramTool.pushWeChatMiniProgram(
'wxbe340095d2b8fd51');
});
},
child: ClipRRect(
borderRadius: BorderRadius.circular(40.r),
child: Image.asset(
'images/mine/icon_mine_wan_wanshifu.png',
width: 80.w,
height: 80.w,
),
xhjCall: () => TitleAppBar(
barTitle: '更多设置'.tr,
haveBack: true,
backgroundColor: Colors.white,
iconColor: AppColors.blackColor,
titleColor: AppColors.blackColor,
))
: null,
body: SingleChildScrollView(
child: styleHierarchy(),
),
);
),
));
}
//

View File

@ -800,6 +800,15 @@ class ApiProvider extends BaseProvider {
'openDirectionValue': openDirectionValue,
}));
//
Future<Response> setMotorPowerData(int lockId, int motorTorsion) =>
post(
updateLockSettingUrl.toUrl,
jsonEncode({
'lockId': lockId,
'motorTorsion': motorTorsion,
}));
//
Future<Response> remoteUnlockingOpenOrCloseLoadData(
int lockId, int remoteUnlock) =>

View File

@ -874,6 +874,15 @@ class ApiRepository {
return LoginEntity.fromJson(res.body);
}
//
Future<LoginEntity> setMotorTorqueData({
required int lockId,
required int motorTorsion,
}) async {
final res = await apiProvider.setMotorPowerData(lockId, motorTorsion);
return LoginEntity.fromJson(res.body);
}
//
Future<LoginEntity> setRoomStatusData({
required int lockId,