1、完成网关模块国际化

2、删除蓝牙协议模块不用的蓝牙协议文件
This commit is contained in:
魏少阳 2024-10-15 14:24:35 +08:00
parent 427503c10b
commit 2368bb631c
89 changed files with 1490 additions and 2111 deletions

View File

@ -1082,5 +1082,7 @@
"印度尼西亚语": "Indonesian",
"芬兰语": "Finnish",
"丹麦语": "Danish",
"重置后,该锁的掌静脉都将被删除哦,确认要重置吗?": "After reset, the metacarpal veins of the lock will be deleted. Are you sure you want to reset?"
"重置后,该锁的掌静脉都将被删除哦,确认要重置吗?": "After reset, the metacarpal veins of the lock will be deleted. Are you sure you want to reset?",
"在线": "Online",
"离线": "Offline"
}

View File

@ -1082,5 +1082,7 @@
"印度尼西亚语": "印度尼西亚语",
"芬兰语": "芬兰语",
"丹麦语": "丹麦语",
"重置后,该锁的掌静脉都将被删除哦,确认要重置吗?": "重置后,该锁的掌静脉都将被删除哦,确认要重置吗?"
"重置后,该锁的掌静脉都将被删除哦,确认要重置吗?": "重置后,该锁的掌静脉都将被删除哦,确认要重置吗?",
"在线": "在线",
"离线": "离线"
}

View File

@ -1082,5 +1082,7 @@
"印度尼西亚语": "印度尼西亚语",
"芬兰语": "芬兰语",
"丹麦语": "丹麦语",
"重置后,该锁的掌静脉都将被删除哦,确认要重置吗?": "重置后,该锁的掌静脉都将被删除哦,确认要重置吗?"
"重置后,该锁的掌静脉都将被删除哦,确认要重置吗?": "重置后,该锁的掌静脉都将被删除哦,确认要重置吗?",
"在线": "在线",
"离线": "离线"
}

View File

@ -25,140 +25,186 @@ class AppStyle {
///textButtonStyle
static ButtonStyle get textButtonStyle => ButtonStyle(
minimumSize: MaterialStateProperty.resolveWith((states) => btnMinSize),
shape: MaterialStateProperty.resolveWith((states) => buttonShape_16),
backgroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableColor;
minimumSize: MaterialStateProperty.resolveWith((Set<MaterialState> states) => btnMinSize),
shape: MaterialStateProperty.resolveWith((Set<MaterialState> states) => buttonShape_16),
backgroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableColor;
}
return AppColors.buttonEnableColor;
}),
foregroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableTextColor;
foregroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableTextColor;
}
return AppColors.buttonEnableTextColor;
}),
textStyle: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return textStyle(textColor: AppColors.buttonDisableColor);
textStyle: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return textStyle(textColor: AppColors.buttonDisableColor);
}
return textStyle();
})
);
///textButtonDeleteStyle
static ButtonStyle get textButtonDeleteStyle => ButtonStyle(
minimumSize: MaterialStateProperty.resolveWith((states) => btnMinSize),
shape: MaterialStateProperty.resolveWith((states) => buttonShape_16),
backgroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableColor;
minimumSize: MaterialStateProperty.resolveWith((Set<MaterialState> states) => btnMinSize),
shape: MaterialStateProperty.resolveWith((Set<MaterialState> states) => buttonShape_16),
backgroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableColor;
}
return AppColors.deleteBtnBgColor;
}),
foregroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableTextColor;
foregroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableTextColor;
}
return AppColors.buttonEnableTextColor;
}),
textStyle: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return textStyle(textColor: AppColors.buttonDisableColor);
textStyle: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return textStyle(textColor: AppColors.buttonDisableColor);
}
return textStyle();
})
);
//textButtonStyle2
static ButtonStyle get textButtonStyle2 => ButtonStyle(
minimumSize: MaterialStateProperty.resolveWith((states) => btnMinSize2),
shape: MaterialStateProperty.resolveWith((states) => buttonShape_11),
backgroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableColor;
minimumSize: MaterialStateProperty.resolveWith((Set<MaterialState> states) => btnMinSize2),
shape: MaterialStateProperty.resolveWith((Set<MaterialState> states) => buttonShape_11),
backgroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableColor;
}
return AppColors.buttonEnableColor;
}),
foregroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableTextColor;
foregroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableTextColor;
}
return AppColors.buttonEnableTextColor;
}),
textStyle: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return textStyle(textColor: AppColors.buttonDisableColor,fontSize: 11.sp);
textStyle: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return textStyle(textColor: AppColors.buttonDisableColor,fontSize: 11.sp);
}
return textStyle(fontSize: 11.sp);
})
);
static ButtonStyle get textButtonStyleOthers => ButtonStyle(
minimumSize: MaterialStateProperty.resolveWith((states) => btnMinSize),
shape: MaterialStateProperty.resolveWith((states) => buttonShape_16),
backgroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableTextColor;
minimumSize: MaterialStateProperty.resolveWith((Set<MaterialState> states) => btnMinSize),
shape: MaterialStateProperty.resolveWith((Set<MaterialState> states) => buttonShape_16),
backgroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableTextColor;
}
return AppColors.buttonEnableTextColor;
}),
foregroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableColor;
foregroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableColor;
}
return AppColors.buttonEnableColor;
}),
textStyle: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return textStyle(textColor: AppColors.buttonDisableColor);
textStyle: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return textStyle(textColor: AppColors.buttonDisableColor);
}
return textStyle(textColor: AppColors.buttonEnableColor);
})
);
static ButtonStyle get specialButtonStyle => ButtonStyle(
minimumSize: MaterialStateProperty.resolveWith((states) => btnMinSize3),
shape: MaterialStateProperty.resolveWith((states) => buttonShape_16),
backgroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableTextColor;
minimumSize: MaterialStateProperty.resolveWith((Set<MaterialState> states) => btnMinSize3),
shape: MaterialStateProperty.resolveWith((Set<MaterialState> states) => buttonShape_16),
backgroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableTextColor;
}
return AppColors.deleteBtnBgColor;
}),
foregroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableColor;
foregroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableColor;
}
return AppColors.buttonEnableTextColor;
}),
textStyle: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return textStyle(textColor: AppColors.buttonDisableColor);
textStyle: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return textStyle(textColor: AppColors.buttonDisableColor);
}
return textStyle(textColor: AppColors.buttonEnableColor);
})
);
static ButtonStyle clearTextButtonStyle({Color? textColor, Color? bgColor, double? fontSize, FontWeight? fontWeight}) => ButtonStyle(
minimumSize: MaterialStateProperty.resolveWith((states) => btnMinSize),
shape: MaterialStateProperty.resolveWith((states) => buttonShape_16),
backgroundColor: MaterialStateProperty.resolveWith((states){
minimumSize: MaterialStateProperty.resolveWith((Set<MaterialState> states) => btnMinSize),
shape: MaterialStateProperty.resolveWith((Set<MaterialState> states) => buttonShape_16),
backgroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
bgColor ??= AppColors.normalTextColor;
if(states.contains(MaterialState.disabled)) return bgColor?.withOpacity(0.6);
if(states.contains(MaterialState.disabled)) {
return bgColor?.withOpacity(0.6);
}
return bgColor;
}),
overlayColor: MaterialStateProperty.resolveWith((states){
overlayColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
textColor ??= AppColors.buttonEnableColor;
if(states.contains(MaterialState.pressed)) return textColor?.withOpacity(0.1);
if(states.contains(MaterialState.pressed)) {
return textColor?.withOpacity(0.1);
}
return textColor?.withOpacity(0.1);
}),
foregroundColor: MaterialStateProperty.resolveWith((states){
foregroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
textColor ??= AppColors.buttonEnableColor;
if(states.contains(MaterialState.disabled)) return textColor?.withOpacity(0.4);
if(states.contains(MaterialState.disabled)) {
return textColor?.withOpacity(0.4);
}
return textColor;
}),
textStyle: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return textStyle(fontSize: fontSize,fontWeight: fontWeight);
textStyle: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return textStyle(fontSize: fontSize,fontWeight: fontWeight);
}
return textStyle(fontSize: fontSize,fontWeight: fontWeight);
}),
);
///elevatedButtonButtonStyle
static ButtonStyle get elevatedButtonButtonStyle => ButtonStyle(
minimumSize: MaterialStateProperty.resolveWith((states) => btnMinSize),
shape: MaterialStateProperty.resolveWith((states) => buttonShape_16),
backgroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableColor;
minimumSize: MaterialStateProperty.resolveWith((Set<MaterialState> states) => btnMinSize),
shape: MaterialStateProperty.resolveWith((Set<MaterialState> states) => buttonShape_16),
backgroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableColor;
}
return AppColors.buttonEnableColor;
}),
foregroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableTextColor;
foregroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableTextColor;
}
return AppColors.buttonEnableTextColor;
}),
);
///outlinedButtonButtonStyle
static ButtonStyle get outlinedButtonButtonStyle => ButtonStyle(
minimumSize: MaterialStateProperty.resolveWith((states) => btnMinSize),
shape: MaterialStateProperty.resolveWith((states) => buttonShape_16),
backgroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableColor;
minimumSize: MaterialStateProperty.resolveWith((Set<MaterialState> states) => btnMinSize),
shape: MaterialStateProperty.resolveWith((Set<MaterialState> states) => buttonShape_16),
backgroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableColor;
}
return AppColors.buttonEnableColor;
}),
foregroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableTextColor;
foregroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableTextColor;
}
return AppColors.buttonEnableTextColor;
}),
);
@ -166,21 +212,25 @@ class AppStyle {
///outlinedButtonButtonStyle2
static ButtonStyle get outlinedButtonButtonStyle2_Selected => ButtonStyle(
minimumSize: MaterialStateProperty.resolveWith((states) => btnMinSize),
shape: MaterialStateProperty.resolveWith((states) => buttonShape_11),
backgroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableColor;
minimumSize: MaterialStateProperty.resolveWith((Set<MaterialState> states) => btnMinSize),
shape: MaterialStateProperty.resolveWith((Set<MaterialState> states) => buttonShape_11),
backgroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableColor;
}
return AppColors.buttonEnableColor;
}),
foregroundColor: MaterialStateProperty.resolveWith((states){
if(states.contains(MaterialState.disabled)) return AppColors.buttonDisableTextColor;
foregroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states){
if(states.contains(MaterialState.disabled)) {
return AppColors.buttonDisableTextColor;
}
return AppColors.buttonEnableTextColor;
}),
);
///outlinedButtonButtonStyle2_Selected
static ButtonStyle get outlinedButtonButtonStyle2 => ButtonStyle(
shape: MaterialStateProperty.resolveWith((states) => buttonShape_11),
shape: MaterialStateProperty.resolveWith((Set<MaterialState> states) => buttonShape_11),
side: MaterialStateProperty.all(BorderSide(
width: 1.w,
color: AppColors.buttonEnableColor.withOpacity(0.5),

View File

@ -122,9 +122,9 @@ class AppTheme {
class NoShadowScrollBehavior extends ScrollBehavior {
const NoShadowScrollBehavior({this.axisDirection = AxisDirection.up}):super();
final AxisDirection axisDirection;
const NoShadowScrollBehavior({this.axisDirection = AxisDirection.up}):super();
@override
Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) {
return GlowingOverscrollIndicator(axisDirection: axisDirection, color: Colors.red,showTrailing: false,showLeading: false,child: child,);

View File

@ -1,8 +1,4 @@
class LockUserNoListEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
LockUserNoListEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
@ -15,6 +11,10 @@ class LockUserNoListEntity {
data = Data.fromJson(json['data']);
}
}
int? errorCode;
String? description;
String? errorMsg;
Data? data;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -27,7 +27,6 @@ class LockUserNoListEntity {
}
class Data {
List<int>? userNos = [];
Data({
this.userNos,
@ -40,6 +39,7 @@ class Data {
});
}
}
List<int>? userNos = [];
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};

View File

@ -1,21 +1,15 @@
import 'dart:convert';
import '../io_tool/io_tool.dart';
import '../sm4Encipher/sm4.dart';
import '../io_sender.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
///TODO:
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
///
class SenderCancelAddCardCommand extends SenderProtocol {
String? keyID;
String? userID;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
SenderCancelAddCardCommand({
this.keyID,
@ -25,6 +19,12 @@ class SenderCancelAddCardCommand extends SenderProtocol {
this.signKey,
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {
@ -34,9 +34,9 @@ class SenderCancelAddCardCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
data.addAll(intChangList(commandType!.typeValue));
@ -45,12 +45,12 @@ class SenderCancelAddCardCommand extends SenderProtocol {
data.add(25);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -58,7 +58,7 @@ class SenderCancelAddCardCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
@ -71,7 +71,7 @@ class SenderCancelAddCardCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -81,7 +81,7 @@ class SenderCancelAddCardCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}

View File

@ -10,29 +10,12 @@ import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
///TODO:
///
/*
UseCountLimit 0 UseCountLimit 0FaceNo 255userId Delete All !@#
**/
class SenderAddFaceCommand extends SenderProtocol {
String? keyID;
String? userID;
int? faceNo;
int? useCountLimit;
int? isForce;
int? operate;
int? isAdmin;
List<int>? token;
int? isRound;
int? weekRound;
int? startDate;
int? endDate;
String? startTime;
String? endTime;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
SenderAddFaceCommand({
this.keyID,
@ -53,6 +36,23 @@ class SenderAddFaceCommand extends SenderProtocol {
this.signKey,
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? faceNo;
int? useCountLimit;
int? isForce;
int? operate;
int? isAdmin;
List<int>? token;
int? isRound;
int? weekRound;
int? startDate;
int? endDate;
String? startTime;
String? endTime;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {
@ -70,9 +70,9 @@ class SenderAddFaceCommand extends SenderProtocol {
@override
List<int> messageDetail() {
final List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
data.addAll(intChangList(commandType!.typeValue));
@ -139,7 +139,7 @@ class SenderAddFaceCommand extends SenderProtocol {
// AppLog.log("addFingerprint startDate:${DateTool().dateToYMDHNString(startDate.toString())} endDate:${DateTool().dateToYMDHNString(endDate.toString())}");
// startTime 4
final List<int> startTimeList = [0,0,0,0];
final List<int> startTimeList = <int>[0,0,0,0];
if(startTime!.contains(':')){
final List<String> getStartTimeList = startTime!.split(':');
startTimeList[2] = int.parse(getStartTimeList[0]);
@ -148,7 +148,7 @@ class SenderAddFaceCommand extends SenderProtocol {
subData.addAll(startTimeList);
// endTime 4
final List<int> endTimeList = [0,0,0,0];
final List<int> endTimeList = <int>[0,0,0,0];
if(endTime!.contains(':')){
final List<String> getendTimeList = endTime!.split(':');
endTimeList[2] = int.parse(getendTimeList[0]);
@ -160,7 +160,7 @@ class SenderAddFaceCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
final List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
@ -173,7 +173,7 @@ class SenderAddFaceCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
final authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);

View File

@ -7,14 +7,8 @@ import '../io_sender.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
///TODO:
///
class SenderCancelAddFaceCommand extends SenderProtocol {
String? keyID;
String? userID;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
SenderCancelAddFaceCommand({
this.keyID,
@ -24,6 +18,12 @@ class SenderCancelAddFaceCommand extends SenderProtocol {
this.signKey,
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {
@ -33,7 +33,7 @@ class SenderCancelAddFaceCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
final List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
@ -44,12 +44,12 @@ class SenderCancelAddFaceCommand extends SenderProtocol {
data.add(86);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -57,7 +57,7 @@ class SenderCancelAddFaceCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = [];
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
@ -70,7 +70,7 @@ class SenderCancelAddFaceCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -80,7 +80,7 @@ class SenderCancelAddFaceCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = 16 - data.length % 16;
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}

View File

@ -1,186 +0,0 @@
import '../io_sender.dart';
import '../io_type.dart';
///TODO:
/*
UseCountLimit 0 UseCountLimit 0FingerNo 255userId Delete All !@#
**/
// class SenderAddFaceWithTimeCycleCoercionCommand extends SenderProtocol {
//
// String? keyID;
// String? userID;
// int? fingerNo;
// int? useCountLimit;
// int? isForce;
// List<int>? token;
// int? isRound;
// int? weekRound;
// int? startDate;
// int? endDate;
// String? startTime;
// String? endTime;
// int? needAuthor;
// List<int>? signKey;
// List<int>? privateKey;
//
// SenderAddFaceWithTimeCycleCoercionCommand({
// this.keyID,
// this.userID,
// this.fingerNo,
// this.useCountLimit,
// this.isForce,
// this.token,
// this.isRound,
// this.weekRound,
// this.startDate,
// this.endDate,
// this.startTime,
// this.endTime,
// this.needAuthor,
// this.signKey,
// this.privateKey,
// }) : super(CommandType.generalExtendedCommond);
//
// @override
// List<int> messageDetail() {
// List<int> data = [];
// List<int> subData = [];
// List<int> ebcData = [];
//
// //
// int type = commandType!.typeValue;
// double typeDouble = type / 256;
// int type1 = typeDouble.toInt();
// int type2 = type % 256;
// data.add(type1);
// data.add(type2);
//
// //
// data.add(36);
//
// // keyID 40
// int keyIDLength = utf8.encode(keyID!).length;
// subData.addAll(utf8.encode(keyID!));
// subData = getFixedLengthList(subData, 40 - keyIDLength);
//
// //userID 20
// int userIDLength = utf8.encode(userID!).length;
// subData.addAll(utf8.encode(userID!));
// subData = getFixedLengthList(subData, 20 - userIDLength);
//
// // fingerNo
// subData.add(fingerNo!);
//
// // UseCountLimit
// subData.add(useCountLimit!);
//
// // isForce
// subData.add(isForce!);
//
// // token
// subData.addAll(token!);
//
// // isRound
// subData.add(isRound!);
//
// // weekRound
// subData.add(weekRound!);
//
// // startDate 4
// subData.add((startDate! & 0xff000000) >> 24);
// subData.add((startDate! & 0xff0000) >> 16);
// subData.add((startDate! & 0xff00) >> 8);
// subData.add((startDate! & 0xff));
//
// // endDate 4
// subData.add((endDate! & 0xff000000) >> 24);
// subData.add((endDate! & 0xff0000) >> 16);
// subData.add((endDate! & 0xff00) >> 8);
// subData.add((endDate! & 0xff));
//
// // startTime 4
// List<int> startTimeList = [0,0,0,0];
// if(startTime!.contains(":")){
// List<String> getStartTimeList = startTime!.split(":");
// startTimeList[2] = int.parse(getStartTimeList[0]);
// startTimeList[3] = int.parse(getStartTimeList[1]);
// }
// subData.addAll(startTimeList);
//
// // endTime 4
// List<int> endTimeList = [0,0,0,0];
// if(endTime!.contains(":")){
// List<String> getendTimeList = endTime!.split(":");
// endTimeList[2] = int.parse(getendTimeList[0]);
// endTimeList[3] = int.parse(getendTimeList[1]);
// }
// subData.addAll(endTimeList);
//
// if(needAuthor == 0){
// //AuthCodeLen 1
// subData.add(0);
// } else {
// List<int> authCodeData = [];
// //KeyID
// authCodeData.addAll(utf8.encode(keyID!));
//
// //authUserID
// authCodeData.addAll(utf8.encode(userID!));
//
// //token 4 Token 0
// authCodeData.addAll(token!);
//
// authCodeData.addAll(signKey!);
//
// // 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);
// }
// }
//
// Get.log("${commandType!.typeName} SM4Data:$data");
// // LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
// return ebcData;
// }
// }
//
// class SenderAddFingerprintWithTimeCycleCoercionReply extends Reply {
// SenderAddFingerprintWithTimeCycleCoercionReply.parseData(CommandType commandType, List<int> dataDetail)
// : super.parseData(commandType, dataDetail) {
// data = dataDetail;
// int status = data[2];
// errorWithStstus(status);
// }
// }
//
// class SenderAddFingerprintProcessReply extends Reply {
// SenderAddFingerprintProcessReply.parseData(CommandType commandType, List<int> dataDetail)
// : super.parseData(commandType, dataDetail) {
// data = dataDetail;
// int status = data[2];
// errorWithStstus(status);
// }
// }
//
// class SenderAddFingerprintConfirmationReply extends Reply {
// SenderAddFingerprintConfirmationReply.parseData(CommandType commandType, List<int> dataDetail)
// : super.parseData(commandType, dataDetail) {
// data = dataDetail;
// int status = data[2];
// errorWithStstus(status);
// }
// }

View File

@ -1,148 +0,0 @@
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:
/// 使SenderAddFingerprintWithTimeCycleCoercionCommand 2024.4.16 addby
/*
UseCountLimit 0 UseCountLimit 0FingerNo 255userId Delete All !@#
**/
// class SenderAddFingerprintCommand extends SenderProtocol {
//
// String? keyID;
// String? userID;
// int? fingerNo;
// int? useCountLimit;
// List<int>? token;
// int? startTime;
// int? endTime;
// int? needAuthor;
// List<int>? signKey;
// List<int>? privateKey;
//
// SenderAddFingerprintCommand({
// this.keyID,
// this.userID,
// this.fingerNo,
// this.useCountLimit,
// this.token,
// this.startTime,
// this.endTime,
// this.needAuthor,
// this.signKey,
// this.privateKey,
// }) : super(CommandType.generalExtendedCommond);
//
// @override
// List<int> messageDetail() {
// List<int> data = [];
// List<int> subData = [];
// List<int> ebcData = [];
//
// //
// 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;
// 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(fingerNo!);
//
// // UseCountLimit
// subData.add(useCountLimit!);
//
// // token
// subData.addAll(token!);
//
// // startTime 4
// subData.add((startTime! & 0xff000000) >> 24);
// subData.add((startTime! & 0xff0000) >> 16);
// subData.add((startTime! & 0xff00) >> 8);
// subData.add((startTime! & 0xff));
//
// // endTime 4
// subData.add((endTime! & 0xff000000) >> 24);
// subData.add((endTime! & 0xff0000) >> 16);
// subData.add((endTime! & 0xff00) >> 8);
// subData.add((endTime! & 0xff));
//
// if(needAuthor == 0){
// //AuthCodeLen 1
// subData.add(0);
// } else {
// List<int> authCodeData = [];
// //KeyID
// authCodeData.addAll(utf8.encode(keyID!));
//
// //authUserID
// authCodeData.addAll(utf8.encode(userID!));
//
// //token 4 Token 0
// authCodeData.addAll(token!);
//
// authCodeData.addAll(signKey!);
//
// // KeyIDauthUserIDmd5加密之后就是authCode
// var authCode = crypto.md5.convert(authCodeData);
//
// subData.add(authCode.bytes.length);
// subData.addAll(authCode.bytes);
// }
//
// data.add(subData.length);
// data.addAll(subData);
//
// if ((data.length % 16) != 0) {
// int add = (16 - data.length % 16);
// for (int i = 0; i < add; i++) {
// data.add(0);
// }
// }
// // LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
// return ebcData;
// }
// }
//
// class SenderAddFingerprintReply extends Reply {
// SenderAddFingerprintReply.parseData(CommandType commandType, List<int> dataDetail)
// : super.parseData(commandType, dataDetail) {
// data = dataDetail;
// }
// }
//
// class SenderAddFingerprintProcessReply extends Reply {
// SenderAddFingerprintProcessReply.parseData(CommandType commandType, List<int> dataDetail)
// : super.parseData(commandType, dataDetail) {
// data = dataDetail;
// }
// }
//
// class SenderAddFingerprintConfirmationReply extends Reply {
// SenderAddFingerprintConfirmationReply.parseData(CommandType commandType, List<int> dataDetail)
// : super.parseData(commandType, dataDetail) {
// data = dataDetail;
// }
// }

View File

@ -7,14 +7,8 @@ import '../io_sender.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
///TODO:
///
class SenderCancelAddFingerprintCommand extends SenderProtocol {
String? keyID;
String? userID;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
SenderCancelAddFingerprintCommand({
this.keyID,
@ -24,6 +18,12 @@ class SenderCancelAddFingerprintCommand extends SenderProtocol {
this.signKey,
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {
@ -33,9 +33,9 @@ class SenderCancelAddFingerprintCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
data.addAll(intChangList(commandType!.typeValue));
@ -44,12 +44,12 @@ class SenderCancelAddFingerprintCommand extends SenderProtocol {
data.add(37);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -57,7 +57,7 @@ class SenderCancelAddFingerprintCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
@ -70,7 +70,7 @@ class SenderCancelAddFingerprintCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -80,7 +80,7 @@ class SenderCancelAddFingerprintCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}

View File

@ -10,31 +10,12 @@ import '../io_sender.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
///TODO:
///
/*
UseCountLimit 0 UseCountLimit 0FingerNo 255userId Delete All !@#
**/
class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
String? keyID;
String? userID;
int? fingerNo;
int? useCountLimit;
int? isForce;
int? operate;
int? isAdmin;
List<int>? token;
int? isRound;
int? weekRound;
int? startDate;
int? endDate;
String? startTime;
String? endTime;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
SenderAddFingerprintWithTimeCycleCoercionCommand({
this.keyID,
this.userID,
@ -55,6 +36,24 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? fingerNo;
int? useCountLimit;
int? isForce;
int? operate;
int? isAdmin;
List<int>? token;
int? isRound;
int? weekRound;
int? startDate;
int? endDate;
String? startTime;
String? endTime;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {
return 'SenderAddFingerprintWithTimeCycleCoercionCommand{keyID: $keyID, '
@ -70,7 +69,7 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
final List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
@ -81,12 +80,12 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
data.add(36);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -121,27 +120,27 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
subData.add((startDate! & 0xff000000) >> 24);
subData.add((startDate! & 0xff0000) >> 16);
subData.add((startDate! & 0xff00) >> 8);
subData.add((startDate! & 0xff));
subData.add(startDate! & 0xff);
// endDate 4
subData.add((endDate! & 0xff000000) >> 24);
subData.add((endDate! & 0xff0000) >> 16);
subData.add((endDate! & 0xff00) >> 8);
subData.add((endDate! & 0xff));
subData.add(endDate! & 0xff);
// startTime 4
List<int> startTimeList = [0,0,0,0];
if(startTime!.contains(":")){
List<String> getStartTimeList = startTime!.split(":");
final List<int> startTimeList = [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]);
}
subData.addAll(startTimeList);
// endTime 4
List<int> endTimeList = [0,0,0,0];
if(endTime!.contains(":")){
List<String> getendTimeList = endTime!.split(":");
final List<int> endTimeList = [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]);
}
@ -151,7 +150,7 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = [];
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
@ -164,7 +163,7 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -174,7 +173,7 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -191,7 +190,7 @@ class SenderAddFingerprintWithTimeCycleCoercionReply extends Reply {
SenderAddFingerprintWithTimeCycleCoercionReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}
@ -200,7 +199,7 @@ class SenderAddFingerprintProcessReply extends Reply {
SenderAddFingerprintProcessReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}
@ -209,7 +208,7 @@ class SenderAddFingerprintConfirmationReply extends Reply {
SenderAddFingerprintConfirmationReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,16 +1,8 @@
import 'dart:convert';
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
import '../sm4Encipher/sm4.dart';
///TODO: 使SenderAddICCardWithTimeCycleCoercionCommand 2024.4.16 addby
/// 使SenderAddICCardWithTimeCycleCoercionCommand 2024.4.16 addby
///
///TODO:
///
// /*
//
// UseCountLimit 0 UseCountLimit 0FingerNo 255userId Delete All !@#

View File

@ -10,31 +10,13 @@ import '../io_sender.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
///TODO:
///
/*
UseCountLimit 0 UseCountLimit 0FingerNo 255userId Delete All !@#
**/
class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
String? keyID;
String? userID;
int? cardNo;
int? useCountLimit;
int? isForce;
int? operate;
int? isAdmin;
List<int>? token;
int? isRound;
int? weekRound;
int? startDate;
int? endDate;
String? startTime;
String? endTime;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
SenderAddICCardWithTimeCycleCoercionCommand({
this.keyID,
this.userID,
@ -55,6 +37,24 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? cardNo;
int? useCountLimit;
int? isForce;
int? operate;
int? isAdmin;
List<int>? token;
int? isRound;
int? weekRound;
int? startDate;
int? endDate;
String? startTime;
String? endTime;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {
@ -71,9 +71,9 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
data.addAll(intChangList(commandType!.typeValue));
@ -82,12 +82,12 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
data.add(24);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -122,27 +122,27 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
subData.add((startDate! & 0xff000000) >> 24);
subData.add((startDate! & 0xff0000) >> 16);
subData.add((startDate! & 0xff00) >> 8);
subData.add((startDate! & 0xff));
subData.add(startDate! & 0xff);
// endDate 4
subData.add((endDate! & 0xff000000) >> 24);
subData.add((endDate! & 0xff0000) >> 16);
subData.add((endDate! & 0xff00) >> 8);
subData.add((endDate! & 0xff));
subData.add(endDate! & 0xff);
// startTime 4
List<int> startTimeList = [0,0,0,0];
if(startTime!.contains(":")){
List<String> getStartTimeList = startTime!.split(":");
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]);
}
subData.addAll(startTimeList);
// endTime 4
List<int> endTimeList = [0,0,0,0];
if(endTime!.contains(":")){
List<String> getendTimeList = endTime!.split(":");
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]);
}
@ -152,7 +152,7 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
@ -165,7 +165,7 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -175,7 +175,7 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -192,7 +192,7 @@ class SenderAddICCardWithTimeCycleCoercionReply extends Reply {
SenderAddICCardWithTimeCycleCoercionReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}
@ -201,7 +201,7 @@ class SenderAddICCardConfirmationReply extends Reply {
SenderAddICCardConfirmationReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -8,7 +8,7 @@ import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
/// TODO:
///
class SenderCancelAddPalmCommand extends SenderProtocol {
SenderCancelAddPalmCommand({
@ -34,7 +34,7 @@ class SenderCancelAddPalmCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
final List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
@ -45,12 +45,12 @@ class SenderCancelAddPalmCommand extends SenderProtocol {
data.add(44);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -58,7 +58,7 @@ class SenderCancelAddPalmCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = [];
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
@ -71,7 +71,7 @@ class SenderCancelAddPalmCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -81,7 +81,7 @@ class SenderCancelAddPalmCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = 16 - data.length % 16;
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}

View File

@ -10,7 +10,7 @@ import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
///TODO:
///
class SenderAddPalmWithTimeCycleCoercionCommand extends SenderProtocol {
SenderAddPalmWithTimeCycleCoercionCommand({

View File

@ -8,7 +8,7 @@ import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
/// TODO:
///
class SenderCancelAddRemoteControlCommand extends SenderProtocol {
SenderCancelAddRemoteControlCommand({
@ -34,7 +34,7 @@ class SenderCancelAddRemoteControlCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
final List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
@ -45,12 +45,12 @@ class SenderCancelAddRemoteControlCommand extends SenderProtocol {
data.add(28);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -58,7 +58,7 @@ class SenderCancelAddRemoteControlCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = [];
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
@ -71,7 +71,7 @@ class SenderCancelAddRemoteControlCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -81,7 +81,7 @@ class SenderCancelAddRemoteControlCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = 16 - data.length % 16;
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}

View File

@ -10,7 +10,7 @@ import '../io_sender.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
///TODO:
///
class SenderAddRemoteControlWithTimeCycleCoercionCommand extends SenderProtocol {
SenderAddRemoteControlWithTimeCycleCoercionCommand({

View File

@ -1,140 +0,0 @@
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 0FingerNo 255userId Delete All !@#
**/
// class SenderAddStressFingerprintCommand extends SenderProtocol {
//
// String? keyID;
// String? userID;
// int? fingerNo;
// int? fingerType;
// int? useCountLimit;
// List<int>? token;
// int? startTime;
// int? endTime;
// int? needAuthor;
// List<int>? publicKey;
// List<int>? privateKey;
// List<int>? signKey;
//
// SenderAddStressFingerprintCommand({
// this.keyID,
// this.userID,
// this.fingerNo,
// this.fingerType,
// this.useCountLimit,
// this.token,
// this.startTime,
// this.endTime,
// this.needAuthor,
// this.publicKey,
// this.privateKey,
// this.signKey
// }) : super(CommandType.generalExtendedCommond);
//
// @override
// List<int> messageDetail() {
// List<int> data = [];
// List<int> subData = [];
// List<int> ebcData = [];
//
// //
// int type = commandType!.typeValue;
// double typeDouble = type / 256;
// int type1 = typeDouble.toInt();
// int type2 = type % 256;
// data.add(type1);
// data.add(type2);
//
// //
// data.add(62);
//
// // keyID 40
// int keyIDLength = utf8.encode(keyID!).length;
// 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(fingerNo!);
//
// // fingerType
// subData.add(fingerType!);
//
// // UseCountLimit
// subData.add(255);
//
// // token
// subData.addAll(token!);
//
// // startTime 4
// subData.add((startTime! & 0xff000000) >> 24);
// subData.add((startTime! & 0xff0000) >> 16);
// subData.add((startTime! & 0xff00) >> 8);
// subData.add((startTime! & 0xff));
//
// // endTime 4
// subData.add((endTime! & 0xff000000) >> 24);
// subData.add((endTime! & 0xff0000) >> 16);
// subData.add((endTime! & 0xff00) >> 8);
// subData.add((endTime! & 0xff));
//
// if(needAuthor == 0){
// //AuthCodeLen 1
// subData.add(0);
// } else {
// List<int> authCodeData = [];
//
// //KeyID
// authCodeData.addAll(utf8.encode(keyID!));
//
// //authUserID
// authCodeData.addAll(utf8.encode(userID!));
//
// //token 4 Token 0
// authCodeData.addAll(token!);
//
// authCodeData.addAll(signKey!);
//
// // KeyIDauthUserIDmd5加密之后就是authCode
// var authCode = crypto.md5.convert(authCodeData);
// subData.add(authCode.bytes.length);
// subData.addAll(authCode.bytes);
// }
//
// data.add(subData.length);
// data.addAll(subData);
//
// if ((data.length % 16) != 0) {
// int add = (16 - data.length % 16);
// for (int i = 0; i < add; i++) {
// data.add(0);
// }
// }
// // LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
// return ebcData;
// }
// }
//
// class SenderAddStressFingerprintReply extends Reply {
// SenderAddStressFingerprintReply.parseData(CommandType commandType, List<int> dataDetail)
// : super.parseData(commandType, dataDetail) {
// data = dataDetail;
// }
// }

View File

@ -1,143 +0,0 @@
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: 使SenderAddICCardWithTimeCycleCoercionCommand 2024.4.16 addby
///
///TODO:
/*
UseCountLimit 0 UseCountLimit 0FingerNo 255userId Delete All !@#
**/
// class SenderAddStressICCardCommand extends SenderProtocol {
//
// String? keyID;
// String? userID;
// int? icCardNo;
// int? cardType;
// int? useCountLimit;
// List<int>? token;
// int? startTime;
// int? endTime;
// int? needAuthor;
// List<int>? publicKey;
// List<int>? privateKey;
// List<int>? signKey;
//
// SenderAddStressICCardCommand({
// this.keyID,
// this.userID,
// this.icCardNo,
// this.cardType,
// this.useCountLimit,
// this.token,
// this.startTime,
// this.endTime,
// this.needAuthor,
// this.publicKey,
// this.privateKey,
// this.signKey
// }) : super(CommandType.generalExtendedCommond);
//
// @override
// List<int> messageDetail() {
// List<int> data = [];
// List<int> subData = [];
// List<int> ebcData = [];
//
// //
// int type = commandType!.typeValue;
// double typeDouble = type / 256;
// int type1 = typeDouble.toInt();
// int type2 = type % 256;
// data.add(type1);
// data.add(type2);
//
// //
// data.add(61);
//
// // keyID 40
// int keyIDLength = utf8.encode(keyID!).length;
// 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);
//
// // icCardNo
// subData.add(icCardNo!);
//
// // cardType
// subData.add(cardType!);
//
// // UseCountLimit
// subData.add(0xff);
//
// // token
// subData.addAll(token!);
//
// // startTime 4
// subData.add((startTime! & 0xff000000) >> 24);
// subData.add((startTime! & 0xff0000) >> 16);
// subData.add((startTime! & 0xff00) >> 8);
// subData.add((startTime! & 0xff));
//
// // endTime 4
// subData.add((endTime! & 0xff000000) >> 24);
// subData.add((endTime! & 0xff0000) >> 16);
// subData.add((endTime! & 0xff00) >> 8);
// subData.add((endTime! & 0xff));
//
// if(needAuthor == 0){
// //AuthCodeLen 1
// subData.add(0);
// } else {
// List<int> authCodeData = [];
//
// //KeyID
// authCodeData.addAll(utf8.encode(keyID!));
//
// //authUserID
// authCodeData.addAll(utf8.encode(userID!));
//
// //token 4 Token 0
// authCodeData.addAll(token!);
//
// authCodeData.addAll(signKey!);
//
// // KeyIDauthUserIDmd5加密之后就是authCode
// var authCode = crypto.md5.convert(authCodeData);
//
// subData.add(authCode.bytes.length);
// subData.addAll(authCode.bytes);
// }
//
// data.add(subData.length);
// data.addAll(subData);
//
// if ((data.length % 16) != 0) {
// int add = (16 - data.length % 16);
// for (int i = 0; i < add; i++) {
// data.add(0);
// }
// }
// // LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
// return ebcData;
// }
// }
//
// class SenderAddStressICCardReply extends Reply {
// SenderAddStressICCardReply.parseData(CommandType commandType, List<int> dataDetail)
// : super.parseData(commandType, dataDetail) {
// data = dataDetail;
// }
// }

View File

@ -11,24 +11,13 @@ import '../io_sender.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
///TODO:
///
/*
UseCountLimit 0 UseCountLimit 0FingerNo 255userId Delete All !@#
**/
class SenderAddStressPasswordCommand extends SenderProtocol {
String? keyID;
String? userID;
int? passwordNo;
int? useCountLimit;
List<int>? token;
int? startTime;
int? endTime;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
SenderAddStressPasswordCommand({
this.keyID,
this.userID,
@ -42,6 +31,17 @@ class SenderAddStressPasswordCommand extends SenderProtocol {
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() {
@ -56,15 +56,15 @@ class SenderAddStressPasswordCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
@ -72,12 +72,12 @@ class SenderAddStressPasswordCommand extends SenderProtocol {
data.add(60);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -94,19 +94,19 @@ class SenderAddStressPasswordCommand extends SenderProtocol {
subData.add((startTime! & 0xff000000) >> 24);
subData.add((startTime! & 0xff0000) >> 16);
subData.add((startTime! & 0xff00) >> 8);
subData.add((startTime! & 0xff));
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));
subData.add(endTime! & 0xff);
if(needAuthor == 0){
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
@ -120,7 +120,7 @@ class SenderAddStressPasswordCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -130,7 +130,7 @@ class SenderAddStressPasswordCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -147,7 +147,7 @@ class SenderAddStressPasswordReply extends Reply {
SenderAddStressPasswordReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -11,31 +11,8 @@ import '../io_sender.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
//TODO:
//
class AddUserCommand extends SenderProtocol {
String? lockID;
String? authUserID;
String? keyID;
String? userID;
int? openMode;
int? keyType;
int? startDate;
int? expireDate;
int? useCountLimit;
int? isRound;
int? weekRound;
int? startHour;
int? startMin;
int? endHour;
int? endMin;
int? role;
String? password;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
List<int>? token;
AddUserCommand(
{this.lockID,
@ -60,6 +37,29 @@ class AddUserCommand extends SenderProtocol {
this.privateKey,
this.token})
: super(CommandType.addUser);
String? lockID;
String? authUserID;
String? keyID;
String? userID;
int? openMode;
int? keyType;
int? startDate;
int? expireDate;
int? useCountLimit;
int? isRound;
int? weekRound;
int? startHour;
int? startMin;
int? endHour;
int? endMin;
int? role;
String? password;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
List<int>? token;
@override
String toString() {
@ -78,34 +78,34 @@ class AddUserCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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
int lockIDLength = utf8.encode(lockID!).length;
final int lockIDLength = utf8.encode(lockID!).length;
data.addAll(utf8.encode(lockID!));
data = getFixedLengthList(data, 40 - lockIDLength);
//authUserID 20
int authUserIDLength = utf8.encode(authUserID!).length;
final int authUserIDLength = utf8.encode(authUserID!).length;
data.addAll(utf8.encode(authUserID!));
data = getFixedLengthList(data, 20 - authUserIDLength);
//KeyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
data.addAll(utf8.encode(keyID!));
data = getFixedLengthList(data, 40 - keyIDLength);
//userID useid 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
data.addAll(utf8.encode(userID!));
data = getFixedLengthList(data, 20 - userIDLength);
@ -128,18 +128,18 @@ class AddUserCommand extends SenderProtocol {
data.add((d1! & 0xff000000) >> 24);
data.add((d1 & 0xff0000) >> 16);
data.add((d1 & 0xff00) >> 8);
data.add((d1 & 0xff));
data.add(d1 & 0xff);
// expireDate 4
data.add((d2! & 0xff000000) >> 24);
data.add((d2 & 0xff0000) >> 16);
data.add((d2 & 0xff00) >> 8);
data.add((d2 & 0xff));
data.add(d2 & 0xff);
//useCountLimit 2
double useCountLimitDouble = useCountLimit! / 256;
int useCountLimit1 = useCountLimitDouble.toInt();
int useCountLimit2 = useCountLimit! % 256;
final double useCountLimitDouble = useCountLimit! / 256;
final int useCountLimit1 = useCountLimitDouble.toInt();
final int useCountLimit2 = useCountLimit! % 256;
data.add(useCountLimit1);
data.add(useCountLimit2);
@ -154,7 +154,7 @@ class AddUserCommand extends SenderProtocol {
data.add(role!);
//password 20
int passwordLength = utf8.encode(password!).length;
final int passwordLength = utf8.encode(password!).length;
data.addAll(utf8.encode(password!));
data = getFixedLengthList(data, 20 - passwordLength);
@ -165,7 +165,7 @@ class AddUserCommand extends SenderProtocol {
//AuthCodeLen 1
data.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(authUserID!));
@ -179,14 +179,14 @@ class AddUserCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);
}
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}

View File

@ -1,79 +0,0 @@
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 AutomaticPadlockCommand extends SenderProtocol {
// String? lockID;
// String? userID;
// int? autoLockFlag;
// List<int>? token;
// int? needAuthor;
// List<int>? signKey;
// List<int>? privateKey;
// AutomaticPadlockCommand({
// this.lockID,
// this.userID,
// this.autoLockFlag,
// this.token,
// this.needAuthor,
// this.signKey,
// this.privateKey
// }) : super(CommandType.generalExtendedCommond);
//
// @override
// List<int> messageDetail() {
// List<int> data = [];
// List<int> subData = [];
// List<int> ebcData = [];
//
// //
// int type = commandType!.typeValue;
// double typeDouble = type / 256;
// int type1 = typeDouble.toInt();
// int type2 = type % 256;
// data.add(type1);
// data.add(type2);
//
// //
// data.add(4);
//
// //lockID 40
// int lockIDLength = utf8.encode(lockID!).length;
// subData.addAll(utf8.encode(lockID!));
// subData = getFixedLengthList(subData, 40 - lockIDLength);
//
// //userID useid 20
// int userIDLength = utf8.encode(userID!).length;
// subData.addAll(utf8.encode(userID!));
// subData = getFixedLengthList(subData, 20 - userIDLength);
//
// // autoLockFlag 01
// subData.add(autoLockFlag!);
//
// 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);
// }
// }
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
// return ebcData;
// }
// }
//
// class AutomaticPadlockReply extends Reply {
// AutomaticPadlockReply.parseData(CommandType commandType, List<int> dataDetail)
// : super.parseData(commandType, dataDetail) {
// data = dataDetail;
// }
// }

View File

@ -11,21 +11,9 @@ import '../io_sender.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
//TODO:
//
class ChangeAdministratorPasswordCommand extends SenderProtocol {
String? keyID;
String? userID;
int? pwdNo;
String? pwd;
int? useCountLimit;
List<int>? token;
int? startTime;
int? endTime;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
ChangeAdministratorPasswordCommand({
this.keyID,
this.userID,
@ -40,6 +28,18 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? pwdNo;
String? pwd;
int? useCountLimit;
List<int>? token;
int? startTime;
int? endTime;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {
@ -53,9 +53,9 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
// int type = commandType!.typeValue;
@ -70,21 +70,20 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
data.add(2);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
// PwdNo
subData.addAll(intChangList(pwdNo!));
AppLog.log("pwdNo:$pwdNo");
// pwd 20
int pwdLength = utf8.encode(pwd!).length;
final int pwdLength = utf8.encode(pwd!).length;
subData.addAll(utf8.encode(pwd!));
subData = getFixedLengthList(subData, 20 - pwdLength);
@ -98,19 +97,19 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
subData.add((startTime! & 0xff000000) >> 24);
subData.add((startTime! & 0xff0000) >> 16);
subData.add((startTime! & 0xff00) >> 8);
subData.add((startTime! & 0xff));
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));
subData.add(endTime! & 0xff);
if(needAuthor == 0){
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
@ -124,7 +123,7 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -134,7 +133,7 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -151,7 +150,7 @@ class ChangeAdministratorPasswordReply extends Reply {
ChangeAdministratorPasswordReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,5 +1,5 @@
//TODO:
//
import 'dart:convert';
import '../../app_settings/app_settings.dart';
@ -11,17 +11,6 @@ import '../sm4Encipher/sm4.dart';
import 'package:crypto/crypto.dart' as crypto;
class SenderCheckingCardStatusCommand extends SenderProtocol {
String? keyID;
String? userID;
int? role;
int? cardCount;
int? cardNo;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
SenderCheckingCardStatusCommand({
this.keyID,
this.userID,
@ -34,6 +23,16 @@ class SenderCheckingCardStatusCommand extends SenderProtocol {
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() {
@ -44,15 +43,15 @@ class SenderCheckingCardStatusCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
@ -60,12 +59,12 @@ class SenderCheckingCardStatusCommand extends SenderProtocol {
data.add(20);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -82,7 +81,7 @@ class SenderCheckingCardStatusCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
@ -96,7 +95,7 @@ class SenderCheckingCardStatusCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -106,7 +105,7 @@ class SenderCheckingCardStatusCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}

View File

@ -1,25 +1,17 @@
//TODO:()
// ()
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';
import 'package:crypto/crypto.dart' as crypto;
class SenderCheckingUserInfoCountCommand extends SenderProtocol {
String? keyID;
String? userID;
int? role;
int? nowTime;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
SenderCheckingUserInfoCountCommand({
this.keyID,
this.userID,
@ -31,6 +23,15 @@ class SenderCheckingUserInfoCountCommand extends SenderProtocol {
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() {
@ -41,15 +42,15 @@ class SenderCheckingUserInfoCountCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
@ -57,12 +58,12 @@ class SenderCheckingUserInfoCountCommand extends SenderProtocol {
data.add(15);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -73,7 +74,7 @@ class SenderCheckingUserInfoCountCommand extends SenderProtocol {
subData.add((nowTime! & 0xff000000) >> 24);
subData.add((nowTime! & 0xff0000) >> 16);
subData.add((nowTime! & 0xff00) >> 8);
subData.add((nowTime! & 0xff));
subData.add(nowTime! & 0xff);
// token
// subData.addAll(token!);
@ -82,7 +83,7 @@ class SenderCheckingUserInfoCountCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
@ -96,7 +97,7 @@ class SenderCheckingUserInfoCountCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -106,7 +107,7 @@ class SenderCheckingUserInfoCountCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -123,7 +124,7 @@ class SenderCheckingUserInfoCountReply extends Reply {
SenderCheckingUserInfoCountReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,30 +1,16 @@
import 'dart:convert';
import 'dart:typed_data';
import 'package:get/get.dart';
import 'package:star_lock/tools/dateTool.dart';
import 'package:crypto/crypto.dart' as crypto;
import '../../app_settings/app_settings.dart';
import '../io_tool/io_tool.dart';
import '../sm4Encipher/sm4.dart';
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
import '../sm4Encipher/sm4.dart';
//
class CleanUpUsersCommand extends SenderProtocol {
String? lockID;
String? authUserID;
String? keyID;
String? userID;
List<int>? userNoList;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
CleanUpUsersCommand({
this.lockID,
@ -37,6 +23,17 @@ class CleanUpUsersCommand extends SenderProtocol {
this.userNoList,
this.token,
}) : super(CommandType.cleanUpUsers);
String? lockID;
String? authUserID;
String? keyID;
String? userID;
List<int>? userNoList;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
@override
String toString() {
@ -48,40 +45,40 @@ class CleanUpUsersCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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
int lockIDLength = utf8.encode(lockID!).length;
final int lockIDLength = utf8.encode(lockID!).length;
data.addAll(utf8.encode(lockID!));
data = getFixedLengthList(data, 40 - lockIDLength);
//authUserID 20
int authUserIDLength = utf8.encode(authUserID!).length;
final int authUserIDLength = utf8.encode(authUserID!).length;
data.addAll(utf8.encode(authUserID!));
data = getFixedLengthList(data, 20 - authUserIDLength);
//KeyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
data.addAll(utf8.encode(keyID!));
data = getFixedLengthList(data, 40 - keyIDLength);
//userID useid 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
data.addAll(utf8.encode(userID!));
data = getFixedLengthList(data, 20 - userIDLength);
ByteData indexBytes = ByteData(2); // 2
final ByteData indexBytes = ByteData(2); // 2
indexBytes.setInt16(0, userNoList!.length);
List<int> indexList = indexBytes.buffer.asUint8List();
final List<int> indexList = indexBytes.buffer.asUint8List();
data.addAll(indexList);
data.addAll(userNoList!);
@ -93,7 +90,7 @@ class CleanUpUsersCommand extends SenderProtocol {
//AuthCodeLen 1
data.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(authUserID!));
@ -107,14 +104,14 @@ class CleanUpUsersCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);
}
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}

View File

@ -1,29 +1,17 @@
//TODO:WIFI配网
// WIFI配网
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';
import 'package:crypto/crypto.dart' as crypto;
class SenderConfiguringWifiCommand extends SenderProtocol {
String? keyID;
String? userID;
String? ssid;
String? password;
int? numberOfServers;
List<int>? listOfServers;
int? numberOfPhone;
List<String>? listOfPhone;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
SenderConfiguringWifiCommand({
this.keyID,
this.userID,
@ -39,6 +27,19 @@ class SenderConfiguringWifiCommand extends SenderProtocol {
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
String? ssid;
String? password;
int? numberOfServers;
List<int>? listOfServers;
int? numberOfPhone;
List<String>? listOfPhone;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
@override
String toString() {
@ -51,15 +52,15 @@ class SenderConfiguringWifiCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
@ -67,22 +68,22 @@ class SenderConfiguringWifiCommand extends SenderProtocol {
data.add(50);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
//SSID 30
int ssidLength = utf8.encode(ssid!).length;
final int ssidLength = utf8.encode(ssid!).length;
subData.addAll(utf8.encode(ssid!));
subData = getFixedLengthList(subData, 30 - ssidLength);
//Password 20
int passwordLength = utf8.encode(password!).length;
final int passwordLength = utf8.encode(password!).length;
subData.addAll(utf8.encode(password!));
subData = getFixedLengthList(subData, 20 - passwordLength);
@ -96,8 +97,8 @@ class SenderConfiguringWifiCommand extends SenderProtocol {
subData.add(numberOfPhone!);
// listOfPhone
listOfPhone!.forEach((element) {
int phoneLength = utf8.encode(element).length;
listOfPhone!.forEach((String element) {
final int phoneLength = utf8.encode(element).length;
subData.addAll(utf8.encode(element));
subData = getFixedLengthList(subData, 20 - phoneLength);
});
@ -109,7 +110,7 @@ class SenderConfiguringWifiCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//userID
authCodeData.addAll(utf8.encode(userID!));
@ -123,7 +124,7 @@ class SenderConfiguringWifiCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -133,7 +134,7 @@ class SenderConfiguringWifiCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -150,7 +151,7 @@ class SenderConfiguringWifiReply extends Reply {
SenderConfiguringWifiReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[5];
final int status = data[5];
errorWithStstus(status);
}
}

View File

@ -1,24 +1,16 @@
//TODO:
//
import 'dart:convert';
import '../io_tool/io_tool.dart';
import '../sm4Encipher/sm4.dart';
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
class DeletUserCommand extends SenderProtocol {
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
String? lockID;
String? authUserID;
String? keyID;
String? delUserID;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
List<int>? token;
class DeletUserCommand extends SenderProtocol {
DeletUserCommand({
this.lockID,
this.authUserID,
@ -30,6 +22,14 @@ class DeletUserCommand extends SenderProtocol {
this.token
}) : super(CommandType.deletUser);
String? lockID;
String? authUserID;
String? keyID;
String? delUserID;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
List<int>? token;
@override
String toString() {
@ -40,34 +40,34 @@ class DeletUserCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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
int lockIDLength = utf8.encode(lockID!).length;
final int lockIDLength = utf8.encode(lockID!).length;
data.addAll(utf8.encode(lockID!));
data = getFixedLengthList(data, 40 - lockIDLength);
//authUserID 20
int authUserIDLength = utf8.encode(authUserID!).length;
final int authUserIDLength = utf8.encode(authUserID!).length;
data.addAll(utf8.encode(authUserID!));
data = getFixedLengthList(data, 20 - authUserIDLength);
//KeyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
data.addAll(utf8.encode(keyID!));
data = getFixedLengthList(data, 40 - keyIDLength);
//delUserID 20
int delUserIDLength = utf8.encode(delUserID!).length;
final int delUserIDLength = utf8.encode(delUserID!).length;
data.addAll(utf8.encode(delUserID!));
data = getFixedLengthList(data, 20 - delUserIDLength);
@ -78,7 +78,7 @@ class DeletUserCommand extends SenderProtocol {
//AuthCodeLen 1
data.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(authUserID!));
@ -92,14 +92,14 @@ class DeletUserCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);
}
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -116,7 +116,7 @@ class DeletUserReply extends Reply {
DeletUserReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[6];
final int status = data[6];
errorWithStstus(status);
}
}

View File

@ -1,33 +1,18 @@
//TODO:
//
import 'dart:convert';
import 'package:crypto/crypto.dart' as crypto;
import 'package:star_lock/tools/dateTool.dart';
import '../io_tool/io_tool.dart';
import '../sm4Encipher/sm4.dart';
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
import '../sm4Encipher/sm4.dart';
class EditUserCommand extends SenderProtocol {
String? lockID;
String? authUserID;
String? keyID;
String? userID;
int? openMode;
int? keyType;
int? startDate;
int? expireDate;
int? role;
String? password;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
List<int>? token;
EditUserCommand({
this.lockID,
this.authUserID,
@ -45,6 +30,20 @@ class EditUserCommand extends SenderProtocol {
this.token
}) : super(CommandType.editUser);
String? lockID;
String? authUserID;
String? keyID;
String? userID;
int? openMode;
int? keyType;
int? startDate;
int? expireDate;
int? role;
String? password;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
List<int>? token;
@override
String toString() {
@ -60,34 +59,34 @@ class EditUserCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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
int lockIDLength = utf8.encode(lockID!).length;
final int lockIDLength = utf8.encode(lockID!).length;
data.addAll(utf8.encode(lockID!));
data = getFixedLengthList(data, 40 - lockIDLength);
//authUserID 20
int authUserIDLength = utf8.encode(authUserID!).length;
final int authUserIDLength = utf8.encode(authUserID!).length;
data.addAll(utf8.encode(authUserID!));
data = getFixedLengthList(data, 20 - authUserIDLength);
//KeyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
data.addAll(utf8.encode(keyID!));
data = getFixedLengthList(data, 40 - keyIDLength);
//userID useid 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
data.addAll(utf8.encode(userID!));
data = getFixedLengthList(data, 20 - userIDLength);
@ -110,19 +109,19 @@ class EditUserCommand extends SenderProtocol {
data.add((d1! & 0xff000000) >> 24);
data.add((d1 & 0xff0000) >> 16);
data.add((d1 & 0xff00) >> 8);
data.add((d1 & 0xff));
data.add(d1 & 0xff);
// expireDate 4
data.add((d2! & 0xff000000) >> 24);
data.add((d2 & 0xff0000) >> 16);
data.add((d2 & 0xff00) >> 8);
data.add((d2 & 0xff));
data.add(d2 & 0xff);
// role 1 010xff
data.add(role!);
//password 20
int passwordLength = utf8.encode(password!).length;
final int passwordLength = utf8.encode(password!).length;
data.addAll(utf8.encode(password!));
data = getFixedLengthList(data, 20 - passwordLength);
@ -133,7 +132,7 @@ class EditUserCommand extends SenderProtocol {
//AuthCodeLen 1
data.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(authUserID!));
@ -147,14 +146,14 @@ class EditUserCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);
}
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}

View File

@ -1,5 +1,5 @@
//TODO:
//
import 'dart:convert';
import 'package:crypto/crypto.dart' as crypto;
@ -11,14 +11,6 @@ import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
class FactoryDataResetCommand extends SenderProtocol {
String? lockID;
String? userID;
String? keyID;
List<int>? publicKey;
List<int>? privateKey;
List<int>? token;
int? needAuthor;
FactoryDataResetCommand({
this.lockID,
this.userID,
@ -29,6 +21,13 @@ class FactoryDataResetCommand extends SenderProtocol {
this.privateKey,
}) : super(CommandType.factoryDataReset);
String? lockID;
String? userID;
String? keyID;
List<int>? publicKey;
List<int>? privateKey;
List<int>? token;
int? needAuthor;
@override
String toString() {
@ -39,24 +38,24 @@ class FactoryDataResetCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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
int lockIDLength = utf8.encode(lockID!).length;
final int lockIDLength = utf8.encode(lockID!).length;
data.addAll(utf8.encode(lockID!));
data = getFixedLengthList(data, 40 - lockIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
data.addAll(utf8.encode(userID!));
data = getFixedLengthList(data, 20 - userIDLength);
@ -67,7 +66,7 @@ class FactoryDataResetCommand extends SenderProtocol {
//AuthCodeLen 1
data.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//userID
authCodeData.addAll(utf8.encode(lockID!));
@ -78,14 +77,14 @@ class FactoryDataResetCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);
}
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -102,7 +101,7 @@ class FactoryDataResetReply extends Reply {
FactoryDataResetReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[6];
final int status = data[6];
errorWithStstus(status);
}
}

View File

@ -6,8 +6,6 @@ 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 GatewayConfiguringWifiCommand extends SenderProtocol {

View File

@ -6,8 +6,6 @@ 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 GatewayGetStatusCommand extends SenderProtocol {

View File

@ -8,7 +8,6 @@ import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
// import '../sm4Encipher/sm4.dart';
class GatewayGetWifiCommand extends SenderProtocol {

View File

@ -1,117 +0,0 @@
///TODO:
///
// import 'dart:convert';
//
// import '../io_tool/io_tool.dart';
// import '../sm4Encipher/sm4.dart';
// import '../io_reply.dart';
// import '../io_sender.dart';
// import '../io_type.dart';
//
// class GetLockStatuCommand extends SenderProtocol {
//
// String? lockID;
// String? userID;
// List<int>? privateKey;
// GetLockStatuCommand({
// this.lockID,
// this.userID,
// this.privateKey
// }) : super(CommandType.readLockStatusInfo);
//
// @override
// List<int> messageDetail() {
// List<int> data = [];
// List<int> ebcData = [];
//
// //
// int type = commandType!.typeValue;
// double typeDouble = type / 256;
// int type1 = typeDouble.toInt();
// int type2 = type % 256;
// data.add(type1);
// data.add(type2);
//
// // id 40
// int lockIDLength = utf8.encode(lockID!).length;
// data.addAll(utf8.encode(lockID!));
// data = getFixedLengthList(data, 40 - lockIDLength);
//
// //userID useid 20
// int userIDLength = utf8.encode(userID!).length;
// data.addAll(utf8.encode(userID!));
// data = getFixedLengthList(data, 20 - userIDLength);
//
// if ((data.length % 16) != 0) {
// int add = (16 - data.length % 16);
// for (int i = 0; i < add; i++) {
// data.add(0);
// }
// }
// // LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
// return ebcData;
// }
// }
//
// class GetLockStatuReply extends Reply {
// GetLockStatuReply.parseData(CommandType commandType, List<int> dataDetail)
// : super.parseData(commandType, dataDetail) {
// data = dataDetail;
//
// int status = data[2];
// errorWithStstus(status);
// switch(status){
// case 0x00:
// //
// var softVersion = data.sublist(3, 7);
//
// var power = data[7];
//
// // APP
// var appUserCount = data.sublist(50, 53);
//
// //
// var blacklistCount = data[53];
//
// //
// var bleKeyCount = data[54];
//
// //
// var remainCount = data.sublist(54, 56);
//
// //
// var notUploadCount = data.sublist(56, 58);
//
// //
// var pwdCount = data[58];
//
// //
// var fingerprintCount = data[59];
//
// //
// var lockTime = data.sublist(60, 64);
//
// //
// var hardVersion = data.sublist(64, 68);
// break;
// case 0x06:
// //
//
// break;
// case 0x07:
// //
//
// break;
// case 0x09:
// //
//
// break;
// default:
// //
//
// break;
// }
// }
// }

View File

@ -11,16 +11,9 @@ import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
List<int> publicKeyDataList = [];
List<int> publicKeyDataList = <int>[];
class GetPrivateKeyCommand extends SenderProtocol {
String? lockID;
String? keyID; // ID
String? authUserID; // ID
int? nowTime;
int? needAuthor;
List<int>? publicKeyData;
GetPrivateKeyCommand(
{this.lockID,
this.keyID,
@ -29,6 +22,12 @@ class GetPrivateKeyCommand extends SenderProtocol {
this.needAuthor,
this.publicKeyData})
: super(CommandType.getLockPrivateKey);
String? lockID;
String? keyID; // ID
String? authUserID; // ID
int? nowTime;
int? needAuthor;
List<int>? publicKeyData;
@override
String toString() {
@ -40,8 +39,8 @@ class GetPrivateKeyCommand extends SenderProtocol {
@override
List<int> messageDetail() {
publicKeyDataList = publicKeyData!;
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
final int type = commandType!.typeValue;
@ -67,9 +66,6 @@ class GetPrivateKeyCommand extends SenderProtocol {
data = getFixedLengthList(data, 20 - authUserIDLength);
//NowTime 4
// DateTime now = DateTime.now();
// int timestamp = now.millisecondsSinceEpoch;
// var d1 = 0x11223344;
data.add((nowTime! & 0xff000000) >> 24);
data.add((nowTime! & 0xff0000) >> 16);
data.add((nowTime! & 0xff00) >> 8);
@ -78,7 +74,7 @@ class GetPrivateKeyCommand extends SenderProtocol {
if (needAuthor == 0) {
data.add(0);
} else {
final List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(authUserID!));
@ -87,9 +83,6 @@ class GetPrivateKeyCommand extends SenderProtocol {
authCodeData.addAll(utf8.encode(keyID!));
//NowTime 4
// DateTime now = DateTime.now();
// int timestamp = now.millisecondsSinceEpoch;
// var d1 = 0x11223344;
authCodeData.add((nowTime! & 0xff000000) >> 24);
authCodeData.add((nowTime! & 0xff0000) >> 16);
authCodeData.add((nowTime! & 0xff00) >> 8);
@ -98,7 +91,7 @@ class GetPrivateKeyCommand extends SenderProtocol {
authCodeData.addAll(publicKeyData!);
// KeyIDauthUserIDmd5加密之后就是authCode
final authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);

View File

@ -10,14 +10,6 @@ import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
class SenderGetWifiCommand extends SenderProtocol {
String? keyID;
String? userID;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
SenderGetWifiCommand({
this.keyID,
this.userID,
@ -27,6 +19,12 @@ class SenderGetWifiCommand extends SenderProtocol {
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
@override
String toString() {
@ -37,15 +35,15 @@ class SenderGetWifiCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
@ -53,23 +51,19 @@ class SenderGetWifiCommand extends SenderProtocol {
data.add(53);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
// token
// subData.addAll(token!);
if(needAuthor == 0){
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//userID
authCodeData.addAll(utf8.encode(userID!));
@ -83,7 +77,7 @@ class SenderGetWifiCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -93,7 +87,7 @@ class SenderGetWifiCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -110,7 +104,7 @@ class SenderGetWifiReply extends Reply {
SenderGetWifiReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -10,17 +10,8 @@ import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
//TODO:
//
class OpenLockCommand extends SenderProtocol {
String? lockID;
String? userID;
int? openMode;
int? openTime;
String? onlineToken;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
OpenLockCommand({
this.lockID,
this.userID,
@ -32,6 +23,15 @@ class OpenLockCommand extends SenderProtocol {
this.signKey,
this.privateKey
}) : super(CommandType.openLock);
String? lockID;
String? userID;
int? openMode;
int? openTime;
String? onlineToken;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
@ -44,8 +44,8 @@ class OpenLockCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
final int type = commandType!.typeValue;
@ -84,7 +84,7 @@ class OpenLockCommand extends SenderProtocol {
//AuthCodeLen 1
data.add(0);
} else {
final List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//KeyID
authCodeData.addAll(utf8.encode(lockID!));
@ -97,7 +97,7 @@ class OpenLockCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
final authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);

View File

@ -1,32 +1,17 @@
import 'dart:convert';
import 'dart:typed_data';
import 'package:get/get.dart';
import 'package:crypto/crypto.dart' as crypto;
import '../../app_settings/app_settings.dart';
import '../io_tool/io_tool.dart';
import '../sm4Encipher/sm4.dart';
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
import '../sm4Encipher/sm4.dart';
//oat升级
class OTAUpgradeCommand extends SenderProtocol {
String? lockID;
String? userID;
String? keyID;
int? platform;
int? product;
String? hwVersion;
String? fwVersion;
int? fwSize;
String? fwMD5;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
List<int>? token;
bool encrypt;
OTAUpgradeCommand(
{this.lockID,
@ -44,6 +29,20 @@ class OTAUpgradeCommand extends SenderProtocol {
this.token,
this.encrypt = true})
: super(CommandType.startOATUpgrade);
String? lockID;
String? userID;
String? keyID;
int? platform;
int? product;
String? hwVersion;
String? fwVersion;
int? fwSize;
String? fwMD5;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
List<int>? token;
bool encrypt;
@override
String toString() {
@ -93,10 +92,6 @@ class OTAUpgradeCommand extends SenderProtocol {
data.add(platform1);
//product 2
// int product0 = (product! & 0xFF00) >> 8;
// int product1 = product! & 0xFF;
// data.add(product0);
// data.add(product1);
data.addAll(<int>[0, 1]); // 01
//HwVersion 20
@ -170,8 +165,6 @@ class OTAUpgradeCommand extends SenderProtocol {
}
class OTAUpgradeReply extends Reply {
List<int> token = <int>[];
OTAUpgradeReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
@ -179,4 +172,5 @@ class OTAUpgradeReply extends Reply {
status = data[6];
errorWithStstus(status);
}
List<int> token = <int>[];
}

View File

@ -1,26 +1,20 @@
import 'dart:convert';
import 'dart:typed_data';
import 'package:get/get.dart';
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;
//oat升级
class ProcessOtaUpgradeCommand extends SenderProtocol {
int? index;
int? size;
List<int>? data;
ProcessOtaUpgradeCommand({
this.index,
this.size,
this.data,
}) : super(CommandType.processOTAUpgrade);
int? index;
int? size;
List<int>? data;
@override
@ -30,26 +24,26 @@ class ProcessOtaUpgradeCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
final List<int> data = [];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
//index 2
ByteData indexBytes = ByteData(2); // 4
final ByteData indexBytes = ByteData(2); // 4
indexBytes.setInt16(0, index!);
List<int> indexList = indexBytes.buffer.asUint8List();
final List<int> indexList = indexBytes.buffer.asUint8List();
data.addAll(indexList);
//size 2
ByteData bytes = ByteData(2); // 4
final ByteData bytes = ByteData(2); // 4
bytes.setInt16(0, size!);
List<int> byteList = bytes.buffer.asUint8List();
final List<int> byteList = bytes.buffer.asUint8List();
data.addAll(byteList);
data.addAll(this.data!);

View File

@ -1,24 +1,16 @@
//TODO:
//
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';
import 'package:crypto/crypto.dart' as crypto;
class SenderQueryingFaceStatusCommand extends SenderProtocol {
String? keyID;
String? userID;
int? role;
int? faceCount;
int? faceNo;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
SenderQueryingFaceStatusCommand({
this.keyID,
@ -31,6 +23,15 @@ class SenderQueryingFaceStatusCommand extends SenderProtocol {
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
@ -42,15 +43,15 @@ class SenderQueryingFaceStatusCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
@ -58,12 +59,12 @@ class SenderQueryingFaceStatusCommand extends SenderProtocol {
data.add(80);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -80,7 +81,7 @@ class SenderQueryingFaceStatusCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
@ -94,7 +95,7 @@ class SenderQueryingFaceStatusCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -104,7 +105,7 @@ class SenderQueryingFaceStatusCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -121,7 +122,7 @@ class SenderQueryingFaceStatusReply extends Reply {
CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,26 +1,17 @@
//TODO:
//
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';
import 'package:crypto/crypto.dart' as crypto;
class SenderQueryingFingerprintStatusCommand extends SenderProtocol {
String? keyID;
String? userID;
int? role;
int? fingerCount;
int? fingerNo;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
SenderQueryingFingerprintStatusCommand({
this.keyID,
this.userID,
@ -33,6 +24,15 @@ class SenderQueryingFingerprintStatusCommand extends SenderProtocol {
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() {
@ -44,15 +44,15 @@ class SenderQueryingFingerprintStatusCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
@ -60,12 +60,12 @@ class SenderQueryingFingerprintStatusCommand extends SenderProtocol {
data.add(30);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -82,7 +82,7 @@ class SenderQueryingFingerprintStatusCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
@ -96,7 +96,7 @@ class SenderQueryingFingerprintStatusCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -106,7 +106,7 @@ class SenderQueryingFingerprintStatusCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -123,7 +123,7 @@ class SenderQueryingFingerprintStatusReply extends Reply {
SenderQueryingFingerprintStatusReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -8,19 +8,8 @@ import '../io_sender.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
///TODO:
///
class SenderReadAdminPasswordCommand extends SenderProtocol {
String? keyID;
String? userID;
int? role;
int? pwdNum;
int? pwdNo;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
SenderReadAdminPasswordCommand({
this.keyID,
this.userID,
@ -33,6 +22,15 @@ class SenderReadAdminPasswordCommand extends SenderProtocol {
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? role;
int? pwdNum;
int? pwdNo;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
@override
String toString() {
@ -44,15 +42,15 @@ class SenderReadAdminPasswordCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
@ -60,12 +58,12 @@ class SenderReadAdminPasswordCommand extends SenderProtocol {
data.add(74);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -82,7 +80,7 @@ class SenderReadAdminPasswordCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
@ -96,7 +94,7 @@ class SenderReadAdminPasswordCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -106,7 +104,7 @@ class SenderReadAdminPasswordCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -124,7 +122,7 @@ class SenderReadAdminPasswordReply extends Reply {
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -12,17 +12,8 @@ import 'package:crypto/crypto.dart' as crypto;
import '../sm4Encipher/sm4.dart';
///TODO:()/
/// ()/
class ReadSupportFunctionsNoParametersCommand extends SenderProtocol {
String? keyID;
String? userID;
int? featureBit;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
ReadSupportFunctionsNoParametersCommand({
this.keyID,
this.userID,
@ -33,6 +24,13 @@ class ReadSupportFunctionsNoParametersCommand extends SenderProtocol {
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? featureBit;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
@override
String toString() {
@ -44,15 +42,15 @@ class ReadSupportFunctionsNoParametersCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
@ -60,12 +58,12 @@ class ReadSupportFunctionsNoParametersCommand extends SenderProtocol {
data.add(71);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -76,7 +74,7 @@ class ReadSupportFunctionsNoParametersCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
@ -90,7 +88,7 @@ class ReadSupportFunctionsNoParametersCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -100,7 +98,7 @@ class ReadSupportFunctionsNoParametersCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -117,7 +115,7 @@ class ReadSupportFunctionsNoParametersReply extends Reply {
ReadSupportFunctionsNoParametersReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -12,17 +12,8 @@ import 'package:crypto/crypto.dart' as crypto;
import '../sm4Encipher/sm4.dart';
///TODO:()/
// ()/
class ReadSupportFunctionsWithParametersCommand extends SenderProtocol {
String? keyID;
String? userID;
int? featureBit;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
ReadSupportFunctionsWithParametersCommand({
this.keyID,
this.userID,
@ -33,6 +24,13 @@ class ReadSupportFunctionsWithParametersCommand extends SenderProtocol {
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? featureBit;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
@override
String toString() {
@ -44,15 +42,15 @@ class ReadSupportFunctionsWithParametersCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
@ -60,12 +58,12 @@ class ReadSupportFunctionsWithParametersCommand extends SenderProtocol {
data.add(73);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -76,7 +74,7 @@ class ReadSupportFunctionsWithParametersCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
@ -90,7 +88,7 @@ class ReadSupportFunctionsWithParametersCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -100,7 +98,7 @@ class ReadSupportFunctionsWithParametersCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -117,7 +115,7 @@ class ReadSupportFunctionsWithParametersReply extends Reply {
ReadSupportFunctionsWithParametersReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,25 +1,16 @@
//TODO:()
// ()
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';
import 'package:crypto/crypto.dart' as crypto;
class SenderReferEventRecordNumberCommand extends SenderProtocol {
String? keyID;
String? userID;
int? logsCount;
int? logsNo;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
SenderReferEventRecordNumberCommand({
this.keyID,
this.userID,
@ -31,6 +22,15 @@ class SenderReferEventRecordNumberCommand extends SenderProtocol {
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() {
@ -42,15 +42,15 @@ class SenderReferEventRecordNumberCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
@ -58,12 +58,12 @@ class SenderReferEventRecordNumberCommand extends SenderProtocol {
data.add(40);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -80,7 +80,7 @@ class SenderReferEventRecordNumberCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
@ -94,7 +94,7 @@ class SenderReferEventRecordNumberCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -104,7 +104,7 @@ class SenderReferEventRecordNumberCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -121,7 +121,7 @@ class SenderReferEventRecordNumberReply extends Reply {
SenderReferEventRecordNumberReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,6 +1,8 @@
//TODO:()
// ()
import 'dart:convert';
import 'package:crypto/crypto.dart' as crypto;
import 'package:star_lock/tools/dateTool.dart';
import '../io_reply.dart';
@ -8,7 +10,6 @@ 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 SenderReferEventRecordTimeCommand extends SenderProtocol {
@ -43,9 +44,9 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
// int type = commandType!.typeValue;
@ -60,12 +61,12 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
data.add(41);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -91,7 +92,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
@ -105,7 +106,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -115,7 +116,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = 16 - data.length % 16;
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -132,7 +133,7 @@ class SenderReferEventRecordTimeReply extends Reply {
CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,34 +1,20 @@
import 'dart:convert';
import 'package:crypto/crypto.dart' as crypto;
import 'package:star_lock/tools/dateTool.dart';
import '../../app_settings/app_settings.dart';
import '../io_tool/io_tool.dart';
import '../sm4Encipher/sm4.dart';
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
import '../sm4Encipher/sm4.dart';
//TODO:( )
/*
pwd 6 0UseCountLimit 0pwd 6 0UseCountLimit 0pwdNo 255userId DeleteAll !@#
( ) pwd 6 0UseCountLimit 0pwd 6 0UseCountLimit 0pwdNo 255userId DeleteAll !@#
**/
class SenderCustomPasswordsCommand extends SenderProtocol {
String? keyID;
String? userID;
int? pwdNo;
int? operate;
int? isAdmin;
String? pwd;
int? useCountLimit;
List<int>? token;
int? startTime;
int? endTime;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
SenderCustomPasswordsCommand({
this.keyID,
@ -45,6 +31,19 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
this.signKey,
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? pwdNo;
int? operate;
int? isAdmin;
String? pwd;
int? useCountLimit;
List<int>? token;
int? startTime;
int? endTime;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {

View File

@ -1,21 +1,16 @@
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:(线)
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
// (线)
class SenderResetPasswordsCommand extends SenderProtocol {
String? keyID;
String? userID;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
SenderResetPasswordsCommand({
this.keyID,
@ -25,6 +20,12 @@ class SenderResetPasswordsCommand extends SenderProtocol {
this.signKey,
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {
@ -35,9 +36,9 @@ class SenderResetPasswordsCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
data.addAll(intChangList(commandType!.typeValue));
@ -46,12 +47,12 @@ class SenderResetPasswordsCommand extends SenderProtocol {
data.add(19);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -62,7 +63,7 @@ class SenderResetPasswordsCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
@ -76,7 +77,7 @@ class SenderResetPasswordsCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -86,7 +87,7 @@ class SenderResetPasswordsCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -104,7 +105,7 @@ class SenderResetPasswordsReply extends Reply {
CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,26 +1,17 @@
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 'package:crypto/crypto.dart' as crypto;
import '../sm4Encipher/sm4.dart';
///TODO:()/
/// ()/
class SetSupportFunctionsNoParametersCommand extends SenderProtocol {
String? keyID;
String? userID;
int? featureBit;
int? featureEnable;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
SetSupportFunctionsNoParametersCommand({
this.keyID,
this.userID,
@ -32,6 +23,14 @@ class SetSupportFunctionsNoParametersCommand extends SenderProtocol {
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? featureBit;
int? featureEnable;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
@override
String toString() {
@ -44,15 +43,15 @@ class SetSupportFunctionsNoParametersCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
@ -60,12 +59,12 @@ class SetSupportFunctionsNoParametersCommand extends SenderProtocol {
data.add(70);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -79,7 +78,7 @@ class SetSupportFunctionsNoParametersCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
@ -93,7 +92,7 @@ class SetSupportFunctionsNoParametersCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -103,7 +102,7 @@ class SetSupportFunctionsNoParametersCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -120,7 +119,7 @@ class SetSupportFunctionsNoParametersReply extends Reply {
SetSupportFunctionsNoParametersReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -9,19 +9,8 @@ import 'package:crypto/crypto.dart' as crypto;
import '../sm4Encipher/sm4.dart';
///TODO:()
/// ()
class SetSupportFunctionsWithParametersCommand extends SenderProtocol {
String? keyID;
String? userID;
int? featureBit;
int? featureParaLength;
List<int>? featureData;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
SetSupportFunctionsWithParametersCommand({
this.keyID,
this.userID,
@ -34,6 +23,15 @@ class SetSupportFunctionsWithParametersCommand extends SenderProtocol {
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
String? keyID;
String? userID;
int? featureBit;
int? featureParaLength;
List<int>? featureData;
List<int>? token;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
@override
String toString() {
@ -46,15 +44,15 @@ class SetSupportFunctionsWithParametersCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> subData = [];
List<int> ebcData = [];
final List<int> data = <int>[];
List<int> subData = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
@ -62,12 +60,12 @@ class SetSupportFunctionsWithParametersCommand extends SenderProtocol {
data.add(72);
// keyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
subData.addAll(utf8.encode(keyID!));
subData = getFixedLengthList(subData, 40 - keyIDLength);
//userID 20
int userIDLength = utf8.encode(userID!).length;
final int userIDLength = utf8.encode(userID!).length;
subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength);
@ -84,7 +82,7 @@ class SetSupportFunctionsWithParametersCommand extends SenderProtocol {
//AuthCodeLen 1
subData.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
@ -98,7 +96,7 @@ class SetSupportFunctionsWithParametersCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
subData.add(authCode.bytes.length);
subData.addAll(authCode.bytes);
@ -108,7 +106,7 @@ class SetSupportFunctionsWithParametersCommand extends SenderProtocol {
data.addAll(subData);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -125,7 +123,7 @@ class SetSupportFunctionsWithParametersReply extends Reply {
SetSupportFunctionsWithParametersReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -3,14 +3,13 @@ import 'dart:convert';
import 'package:star_lock/tools/dateTool.dart';
import '../io_tool/io_tool.dart';
import '../sm4Encipher/sm4.dart';
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import 'package:crypto/crypto.dart' as crypto;
import '../sm4Encipher/sm4.dart';
//TODO:
//
class TimingCommand extends SenderProtocol {
String? lockID;
String? userID;
@ -44,32 +43,32 @@ class TimingCommand extends SenderProtocol {
List<int> ebcData = [];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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);
//lockID 40
int lockIDLength = utf8.encode(lockID!).length;
final 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;
final int userIDLength = utf8.encode(userID!).length;
data.addAll(utf8.encode(userID!));
data = getFixedLengthList(data, 20 - userIDLength);
// nowTime 4
int? d1 = nowTime;
final int? d1 = nowTime;
data.add((d1! & 0xff000000) >> 24);
data.add((d1 & 0xff0000) >> 16);
data.add((d1 & 0xff00) >> 8);
data.add((d1 & 0xff));
data.add(d1 & 0xff);
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -85,7 +84,7 @@ class TimingReply extends Reply {
TimingReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,25 +1,16 @@
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 TransferPermissionsCommand extends SenderProtocol {
import '../io_reply.dart';
import '../io_sender.dart';
import '../io_tool/io_tool.dart';
import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
String? lockID;
String? authUserID;
String? keyID;
String? oldUserID;
String? newUserID;
int? needAuthor;
List<int>? publicKey;
List<int>? privateKey;
List<int>? token;
//
class TransferPermissionsCommand extends SenderProtocol {
TransferPermissionsCommand({
this.lockID,
this.authUserID,
@ -32,6 +23,16 @@ class TransferPermissionsCommand extends SenderProtocol {
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() {
@ -43,39 +44,39 @@ class TransferPermissionsCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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
int lockIDLength = utf8.encode(lockID!).length;
final int lockIDLength = utf8.encode(lockID!).length;
data.addAll(utf8.encode(lockID!));
data = getFixedLengthList(data, 40 - lockIDLength);
//authUserID 20
int authUserIDLength = utf8.encode(authUserID!).length;
final int authUserIDLength = utf8.encode(authUserID!).length;
data.addAll(utf8.encode(authUserID!));
data = getFixedLengthList(data, 20 - authUserIDLength);
//KeyID 40
int keyIDLength = utf8.encode(keyID!).length;
final int keyIDLength = utf8.encode(keyID!).length;
data.addAll(utf8.encode(keyID!));
data = getFixedLengthList(data, 40 - keyIDLength);
//oldUserID 20
int oldUserIDLength = utf8.encode(oldUserID!).length;
final int oldUserIDLength = utf8.encode(oldUserID!).length;
data.addAll(utf8.encode(oldUserID!));
data = getFixedLengthList(data, 20 - oldUserIDLength);
//newUserID 20
int newUserIDLength = utf8.encode(newUserID!).length;
final int newUserIDLength = utf8.encode(newUserID!).length;
data.addAll(utf8.encode(newUserID!));
data = getFixedLengthList(data, 20 - newUserIDLength);
@ -86,7 +87,7 @@ class TransferPermissionsCommand extends SenderProtocol {
//AuthCodeLen 1
data.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//authUserID
authCodeData.addAll(utf8.encode(authUserID!));
@ -100,14 +101,14 @@ class TransferPermissionsCommand extends SenderProtocol {
authCodeData.addAll(publicKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);
}
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}

View File

@ -1,5 +1,5 @@
//TODO:
//
import 'dart:convert';
import 'package:crypto/crypto.dart' as crypto;
@ -11,14 +11,6 @@ import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
class TransferSmartLockCommand extends SenderProtocol {
String? lockID;
String? userID;
String? keyID;
List<int>? publicKey;
List<int>? privateKey;
List<int>? token;
int? needAuthor;
TransferSmartLockCommand({
this.lockID,
this.userID,
@ -29,6 +21,14 @@ class TransferSmartLockCommand extends SenderProtocol {
this.privateKey,
}) : super(CommandType.transferSmartLock);
String? lockID;
String? userID;
String? keyID;
List<int>? publicKey;
List<int>? privateKey;
List<int>? token;
int? needAuthor;
@override
String toString() {

View File

@ -10,16 +10,6 @@ import '../io_type.dart';
import '../sm4Encipher/sm4.dart';
class UpdataLockCardListCommand extends SenderProtocol {
String? lockID;
String? keyID;
String? userID;
int? page;
int? countReq;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
UpdataLockCardListCommand({
this.lockID,
this.keyID,
@ -32,6 +22,16 @@ class UpdataLockCardListCommand extends SenderProtocol {
this.privateKey
}) : super(CommandType.updataLockCardList);
String? lockID;
String? keyID;
String? userID;
int? page;
int? countReq;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {
return 'UpdataLockCardListCommand{lockID: $lockID, keyID:$keyID userID: $userID, '
@ -41,24 +41,24 @@ class UpdataLockCardListCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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
int lockIDLength = utf8.encode(lockID!).length;
final 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;
final int userIDLength = utf8.encode(userID!).length;
data.addAll(utf8.encode(userID!));
data = getFixedLengthList(data, 20 - userIDLength);
@ -75,7 +75,7 @@ class UpdataLockCardListCommand extends SenderProtocol {
//AuthCodeLen 1
data.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//KeyID
authCodeData.addAll(utf8.encode(lockID!));
@ -88,14 +88,14 @@ class UpdataLockCardListCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);
}
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -113,7 +113,7 @@ class UpdataLockCardListReply extends Reply {
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,25 +1,15 @@
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 'package:crypto/crypto.dart' as crypto;
import '../sm4Encipher/sm4.dart';
class UpdataLockFaceListCommand extends SenderProtocol {
String? lockID;
String? keyID;
String? userID;
int? page;
int? countReq;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
UpdataLockFaceListCommand({
this.lockID,
this.keyID,
@ -32,6 +22,16 @@ class UpdataLockFaceListCommand extends SenderProtocol {
this.privateKey
}) : super(CommandType.updataLockFaceList);
String? lockID;
String? keyID;
String? userID;
int? page;
int? countReq;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {
return 'UpdataLockPasswordListCommand{lockID: $lockID, keyID:$keyID userID: $userID, '
@ -41,24 +41,24 @@ class UpdataLockFaceListCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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
int lockIDLength = utf8.encode(lockID!).length;
final 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;
final int userIDLength = utf8.encode(userID!).length;
data.addAll(utf8.encode(userID!));
data = getFixedLengthList(data, 20 - userIDLength);
@ -75,7 +75,7 @@ class UpdataLockFaceListCommand extends SenderProtocol {
//AuthCodeLen 1
data.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//KeyID
authCodeData.addAll(utf8.encode(lockID!));
@ -88,14 +88,14 @@ class UpdataLockFaceListCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);
}
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -113,7 +113,7 @@ class UpdataLockFaceListReply extends Reply {
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,25 +1,15 @@
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 'package:crypto/crypto.dart' as crypto;
import '../sm4Encipher/sm4.dart';
class UpdataLockFingerprintListCommand extends SenderProtocol {
String? lockID;
String? keyID;
String? userID;
int? page;
int? countReq;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
UpdataLockFingerprintListCommand({
this.lockID,
this.keyID,
@ -32,6 +22,16 @@ class UpdataLockFingerprintListCommand extends SenderProtocol {
this.privateKey
}) : super(CommandType.updataLockFingerprintList);
String? lockID;
String? keyID;
String? userID;
int? page;
int? countReq;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {
return 'UpdataLockPasswordListCommand{lockID: $lockID, keyID:$keyID userID: $userID, '
@ -41,24 +41,24 @@ class UpdataLockFingerprintListCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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
int lockIDLength = utf8.encode(lockID!).length;
final 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;
final int userIDLength = utf8.encode(userID!).length;
data.addAll(utf8.encode(userID!));
data = getFixedLengthList(data, 20 - userIDLength);
@ -75,7 +75,7 @@ class UpdataLockFingerprintListCommand extends SenderProtocol {
//AuthCodeLen 1
data.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//KeyID
authCodeData.addAll(utf8.encode(lockID!));
@ -88,14 +88,14 @@ class UpdataLockFingerprintListCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);
}
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -113,7 +113,7 @@ class UpdataLockFingerprintListReply extends Reply {
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -1,24 +1,15 @@
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 'package:crypto/crypto.dart' as crypto;
import '../sm4Encipher/sm4.dart';
class UpdataLockPalmVeinListCommand extends SenderProtocol {
String? lockID;
String? userID;
int? page;
int? countReq;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
UpdataLockPalmVeinListCommand({
this.lockID,
this.userID,
@ -30,6 +21,15 @@ class UpdataLockPalmVeinListCommand extends SenderProtocol {
this.privateKey
}) : super(CommandType.updataLockPalmVeinList);
String? lockID;
String? userID;
int? page;
int? countReq;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {
return 'UpdataLockPasswordListCommand{lockID: $lockID, userID: $userID, '
@ -39,24 +39,24 @@ class UpdataLockPalmVeinListCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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
int lockIDLength = utf8.encode(lockID!).length;
final 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;
final int userIDLength = utf8.encode(userID!).length;
data.addAll(utf8.encode(userID!));
data = getFixedLengthList(data, 20 - userIDLength);
@ -73,7 +73,7 @@ class UpdataLockPalmVeinListCommand extends SenderProtocol {
//AuthCodeLen 1
data.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//KeyID
authCodeData.addAll(utf8.encode(lockID!));
@ -86,14 +86,14 @@ class UpdataLockPalmVeinListCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);
}
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -111,7 +111,7 @@ class UpdataLockPalmVeinListReply extends Reply {
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -10,16 +10,6 @@ import 'package:crypto/crypto.dart' as crypto;
import '../sm4Encipher/sm4.dart';
class UpdataLockPasswordListCommand extends SenderProtocol {
String? lockID;
String? keyID;
String? userID;
int? page;
int? countReq;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
UpdataLockPasswordListCommand({
this.lockID,
this.keyID,
@ -32,6 +22,16 @@ class UpdataLockPasswordListCommand extends SenderProtocol {
this.privateKey
}) : super(CommandType.updataLockPasswordList);
String? lockID;
String? keyID;
String? userID;
int? page;
int? countReq;
List<int>? token;
int? needAuthor;
List<int>? signKey;
List<int>? privateKey;
@override
String toString() {
return 'UpdataLockPasswordListCommand{lockID: $lockID, keyID:$keyID userID: $userID, '
@ -41,24 +41,24 @@ class UpdataLockPasswordListCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
int type = commandType!.typeValue;
double typeDouble = type / 256;
int type1 = typeDouble.toInt();
int type2 = type % 256;
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
int lockIDLength = utf8.encode(lockID!).length;
final 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;
final int userIDLength = utf8.encode(userID!).length;
data.addAll(utf8.encode(userID!));
data = getFixedLengthList(data, 20 - userIDLength);
@ -75,7 +75,7 @@ class UpdataLockPasswordListCommand extends SenderProtocol {
//AuthCodeLen 1
data.add(0);
} else {
List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//KeyID
authCodeData.addAll(utf8.encode(lockID!));
@ -88,14 +88,14 @@ class UpdataLockPasswordListCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);
}
if ((data.length % 16) != 0) {
int add = (16 - data.length % 16);
final int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) {
data.add(0);
}
@ -113,7 +113,7 @@ class UpdataLockPasswordListReply extends Reply {
: super.parseData(commandType, dataDetail) {
data = dataDetail;
int status = data[2];
final int status = data[2];
errorWithStstus(status);
}
}

View File

@ -41,8 +41,8 @@ class UpdataLockRemoteControlListCommand extends SenderProtocol {
@override
List<int> messageDetail() {
List<int> data = [];
List<int> ebcData = [];
List<int> data = <int>[];
List<int> ebcData = <int>[];
//
final int type = commandType!.typeValue;
@ -75,7 +75,7 @@ class UpdataLockRemoteControlListCommand extends SenderProtocol {
//AuthCodeLen 1
data.add(0);
} else {
final List<int> authCodeData = [];
final List<int> authCodeData = <int>[];
//KeyID
authCodeData.addAll(utf8.encode(lockID!));
@ -88,7 +88,7 @@ class UpdataLockRemoteControlListCommand extends SenderProtocol {
authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode
final authCode = crypto.md5.convert(authCodeData);
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
data.add(authCode.bytes.length);
data.addAll(authCode.bytes);

View File

@ -1,16 +1,19 @@
import 'dart:typed_data';
import 'package:star_lock/app_settings/app_settings.dart';
import 'io_tool/io_manager.dart';
import 'io_tool/io_tool.dart';
import 'io_type.dart';
abstract class IOData {
List<int> messageDetail();
}
abstract class SenderProtocol extends IOData {
abstract class SenderProtocol extends IOData { //
// final int? tail = 0xFF; // CRC 2
SenderProtocol(this.commandType) {
_commandIndex = IoManager().commandIndex;
}
// var uint8View1 = Uint8List(300);
CommandType? commandType; //
@ -21,17 +24,12 @@ abstract class SenderProtocol extends IOData {
0X02
]; // 0XEF01EE02 4
final int ask = 0X01; // 0X01 0X11 1
int? _commandIndex = 1; //
int _commandIndex = 1; //
int identifier =
0x20; // 4 4 1 01AES1282SM43SM4
List<int>? commandData = <int>[]; //
// final int? tail = 0xFF; // CRC 2
SenderProtocol(this.commandType) {
_commandIndex = IoManager().commandIndex;
}
List<int>? commandData = <int>[];
void printLog(List<int> data) {
AppLog.log(
@ -39,10 +37,10 @@ abstract class SenderProtocol extends IOData {
? '子命令:${data[3]}' : ''} \n参数是:\n${toString()} \n加密之前数据是:\n$data :${data.length}");
}
//TODO:
//
List<int> packageData() {
commandData = messageDetail();
List<int> commandList = <int>[];
final List<int> commandList = <int>[];
//
commandList.addAll(header);
@ -51,24 +49,24 @@ abstract class SenderProtocol extends IOData {
commandList.add(ask); //
//
int commandIndexChange = _commandIndex!;
double commandIndexChangeDouble = commandIndexChange / 256;
int commandIndexChang1 = commandIndexChangeDouble.toInt();
int commandIndexChang2 = commandIndexChange % 256;
final int commandIndexChange = _commandIndex;
final double commandIndexChangeDouble = commandIndexChange / 256;
final int commandIndexChang1 = commandIndexChangeDouble.toInt();
final int commandIndexChang2 = commandIndexChange % 256;
commandList.add(commandIndexChang1);
commandList.add(commandIndexChang2);
//
// 4 4 1 01AES1282SM43SM4
int value = identifierValue();
final int value = identifierValue();
commandList.add(value);
//
int dataLen = dataSourceLength();
final int dataLen = dataSourceLength();
// commandList.add(dataLength);
// var dataLen = 42;
double dataLength = dataLen / 256;
final double dataLength = dataLen / 256;
commandList.add(dataLength.toInt());
commandList.add(dataLen % 256);
commandList.add(dataLength.toInt());
@ -78,10 +76,10 @@ abstract class SenderProtocol extends IOData {
commandList.addAll(commandData!); //
//
int mcrc = crc_16(commandList);
double mcrcDouble = mcrc / 256;
int mcrcDouble1 = mcrcDouble.toInt();
int mcrcDouble2 = mcrc % 256;
final int mcrc = crc_16(commandList);
final double mcrcDouble = mcrc / 256;
final int mcrcDouble1 = mcrcDouble.toInt();
final int mcrcDouble2 = mcrc % 256;
commandList.add(mcrcDouble1); //
commandList.add(mcrcDouble2);
return commandList;
@ -91,7 +89,7 @@ abstract class SenderProtocol extends IOData {
// 4 4 1 01AES1282SM43SM4
int identifierValue() => commandType!.identifierValue;
//TODO:
//
int dataSourceLength() => commandData!.length;
List<int> crcTable = <int>[
@ -353,8 +351,7 @@ abstract class SenderProtocol extends IOData {
0x1ef0
];
int crc_16(buffer) {
var len = buffer.length;
int crc_16(List<int> buffer) {
int value_ = 0x0000; //0xa635; //CRC类型设定
int tmp;
for (int i = 0; i < buffer.length; i++) {
@ -366,7 +363,7 @@ abstract class SenderProtocol extends IOData {
return value_;
}
int reverse8(data) {
int reverse8(int data) {
int i;
int temp = 0;
for (i = 0; i < 8; i++) {
@ -376,7 +373,7 @@ abstract class SenderProtocol extends IOData {
return temp;
}
int reverse16(data) {
int reverse16(int data) {
int i;
int temp = 0;
for (i = 0; i < 16; i++) {

View File

@ -4,14 +4,14 @@ enum DataTransmissionMode {
}
class IoManager {
factory IoManager() => share();
IoManager._init();
static IoManager? _ioManager;
IoManager._init();
static IoManager share(){
_ioManager ??= IoManager._init();
return _ioManager!;
}
factory IoManager() => share();
IoManager get manager => share();
//
@ -23,7 +23,7 @@ class IoManager {
///
int _commandIndex = 1;
configCommandIdx(int idx) => _commandIndex = idx;
int configCommandIdx(int idx) => _commandIndex = idx;
Future<void> increaseCommandIndex() async {
_commandIndex < 255 ? _commandIndex++ : _commandIndex = 0;
}
@ -31,8 +31,8 @@ class IoManager {
int get commandIndex => _commandIndex;
/// lockId
String _currentDeviceLockId = "";
configCurrentDeviceLockId(String lockId) => _currentDeviceLockId = lockId;
String _currentDeviceLockId = '';
String configCurrentDeviceLockId(String lockId) => _currentDeviceLockId = lockId;
String get getCurrentDeviceLockId => _currentDeviceLockId;
void resetAllFlags() {

View File

@ -19,7 +19,7 @@ class EventSendModel {
this.serviceId,
this.characteristicId,
this.allowLongWrite});
List<int> data = [];
List<int> data = <int>[];
String? topic = '';
DataChannel? sendChannel;

View File

@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:typed_data';
@ -113,7 +114,7 @@ String uint8ToHex(Uint8List byteArr) {
return String.fromCharCodes(result); //Unicode转回为对应字符,
}
//TODO:int-> List ()=>()
// int-> List ()=>()
int byteInt8(List<int> dataDetail, int index) => _toInt8(dataDetail[index]);
int _toInt8(int value) {
@ -165,7 +166,7 @@ List<int> intToInt8List(int value) => <int>[value];
List<int> intToByte2ListHigh(int value) => <int>[value, value >> 8];
//TODO:int->4List () 1byte = 8bit
// int->4List () 1byte = 8bit
List<int> intToByte4ListHigh(int value) =>
<int>[value, value >> 8, value >> 16, value >> 24];
@ -217,9 +218,6 @@ int _toUInt32(int value) {
}
bool checkListIndex(List<int> dataDetail, int index, int offsetLength) {
if (dataDetail == null) {
return true;
}
final int len = dataDetail.length;
final bool result = index + offsetLength > len;
if (result) {}
@ -262,7 +260,7 @@ List<List<T>> splitList<T>(List<T> list, int len) {
return result;
}
//TODO:int-> List () WiFi用到的!!!!
// int-> List () WiFi用到的!!!!
List<int> intToByte2ListLow(int value) => <int>[value >> 8, value];
String radixHex16String(List<int> codeUnits) {

View File

@ -3,19 +3,19 @@
import 'package:event_bus/event_bus.dart';
class EventBusManager {
EventBus? eventBus;
static EventBusManager? _manager;
factory EventBusManager() => shareManager();
EventBusManager._init(){
eventBus = EventBus(sync: false);
}
EventBus? eventBus;
static EventBusManager? _manager;
static EventBusManager shareManager(){
_manager ??= EventBusManager._init();
return _manager!;
}
factory EventBusManager() => shareManager();
EventBusManager get manager => shareManager();
//
eventBusFir(dynamic event) {

View File

@ -1,4 +1,4 @@
//TODO:
//
enum CommandType {
addUser, // = 0x3001
deletUser, // = 0x3002

View File

@ -123,8 +123,8 @@ class CommandReciverManager {
parseData(oriDataList).then((Reply? value) async {
EasyLoading.dismiss();
await EventBusManager().eventBusFir(value);
}).catchError((error) {
AppLog.log('APP解析数据时发生错误: $error');
}).catchError((Object error) {
AppLog.log('APP解析数据时发生错误: ${error.toString()}');
});
}
}

View File

@ -69,9 +69,9 @@ class SenderBeforeDataManage {
switch (status) {
case 0x00:
//
var userNoData = reply.data.sublist(47, 49);
CommonDataManage().currentLockUserNo = listChangInt(userNoData);
CommonDataManage().currentKeyInfo.lockUserNo = CommonDataManage().currentLockUserNo;
final List<int> userNoData = reply.data.sublist(47, 49);
CommonDataManage().currentLockUserNo = listChangInt(userNoData);
CommonDataManage().currentKeyInfo.lockUserNo = CommonDataManage().currentLockUserNo;
_updateLockUserNo(userNoData);
break;

View File

@ -21,7 +21,7 @@ class CommandSenderManager {
static CommandSenderManager getInstance() => _manager;
init() {
void init() {
_initLockAddUserSucceedEvent();
_initTransferSmartLockSucceedEvent();
}
@ -149,7 +149,7 @@ class CommandSenderManager {
// bufferList = [];
// }
dispose() {
void dispose() {
_passCurrentLockInformationEvent?.cancel();
_transferSmartLockEvent?.cancel();
}

View File

@ -4,7 +4,7 @@ import 'utils/utils.dart';
enum SM4CryptoMode { ECB, CBC }
class SM4 {
static const List<int> S_BOX = [
static const List<int> S_BOX = <int>[
0xd6,
0x90,
0xe9,
@ -263,9 +263,9 @@ class SM4 {
0x48
];
static const List<int> FK = [0xA3B1BAC6, 0x56AA3350, 0x677D9197, 0xB27022DC];
static const List<int> FK = <int>[0xA3B1BAC6, 0x56AA3350, 0x677D9197, 0xB27022DC];
static const List<int> CK = [
static const List<int> CK = <int>[
0x00070e15,
0x1c232a31,
0x383f464d,
@ -306,8 +306,8 @@ class SM4 {
static const int blockSize = 16;
static final _encryptKey = List<int>.filled(32, 0);
static final _decryptKey = List<int>.filled(32, 0);
static final List<int> _encryptKey = List<int>.filled(32, 0);
static final List<int> _decryptKey = List<int>.filled(32, 0);
static int _readUint32BE(List<int> b, int i) {
return ((b[i] & 0xff) << 24) |
@ -317,20 +317,20 @@ class SM4 {
}
static void _writeUint32BE(int n, List<int> b, int i) {
b[i] = ((n >> 24) & 0xff);
b[i + 1] = ((n >> 16) & 0xff);
b[i + 2] = ((n >> 8) & 0xff);
b[i] = (n >> 24) & 0xff;
b[i + 1] = (n >> 16) & 0xff;
b[i + 2] = (n >> 8) & 0xff;
b[i + 3] = n & 0xff;
}
static int _Sbox(int inch) => S_BOX[inch & 0xFF];
static int _sm4F(int x0, int x1, int x2, int x3, int rk) {
final x = x1 ^ x2 ^ x3 ^ rk;
final int x = x1 ^ x2 ^ x3 ^ rk;
int bb = 0;
int c = 0;
List<int> a = List<int>.filled(4, 0);
List<int> b = List<int>.filled(4, 0);
final List<int> a = List<int>.filled(4, 0);
final List<int> b = List<int>.filled(4, 0);
_writeUint32BE(x, a, 0);
b[0] = _Sbox(a[0]);
b[1] = _Sbox(a[1]);
@ -348,20 +348,20 @@ class SM4 {
static int _calculateRoundKey(int key) {
int roundKey = 0;
List<int> keyBytes = List<int>.filled(4, 0);
List<int> sboxBytes = List<int>.filled(4, 0);
final List<int> keyBytes = List<int>.filled(4, 0);
final List<int> sboxBytes = List<int>.filled(4, 0);
_writeUint32BE(key, keyBytes, 0);
for (int i = 0; i < 4; i++) {
sboxBytes[i] = _Sbox(keyBytes[i]);
}
int temp = _readUint32BE(sboxBytes, 0);
final int temp = _readUint32BE(sboxBytes, 0);
roundKey = temp ^ SMUtils.leftShift(temp, 13) ^ SMUtils.leftShift(temp, 23);
return roundKey;
}
static void setKey(List<int> key) {
List<int> keyBytes = key;
List<int> intermediateKeys = List<int>.filled(36, 0);
final List<int> keyBytes = key;
final List<int> intermediateKeys = List<int>.filled(36, 0);
for (int i = 0; i < 4; i++) {
intermediateKeys[i] = _readUint32BE(keyBytes, i * 4) ^ FK[i];
}
@ -375,7 +375,7 @@ class SM4 {
}
for (int i = 0; i < 16; i++) {
int temp = _encryptKey[i];
final int temp = _encryptKey[i];
_decryptKey[i] = _encryptKey[31 - i];
_decryptKey[31 - i] = temp;
}
@ -383,7 +383,7 @@ class SM4 {
static void _round(List<int> sk, List<int> input, List<int> output) {
int i = 0;
List<int> ulbuf = List<int>.filled(36, 0);
final List<int> ulbuf = List<int>.filled(36, 0);
ulbuf[0] = _readUint32BE(input, 0);
ulbuf[1] = _readUint32BE(input, 4);
ulbuf[2] = _readUint32BE(input, 8);
@ -404,7 +404,7 @@ class SM4 {
final int padLen = blockSize - (input.length % blockSize);
if (mode == SM4_ENCRYPT) {
final paddedList = List<int>.filled(input.length + padLen, 0);
final List<int> paddedList = List<int>.filled(input.length + padLen, 0);
paddedList.setRange(0, input.length, input);
for (int i = input.length; i < paddedList.length; i++) {
paddedList[i] = padLen;
@ -423,23 +423,24 @@ class SM4 {
List<int> data, int flag, SM4CryptoMode mode, String? iv) {
late List<int> lastVector;
if (mode == SM4CryptoMode.CBC) {
if (iv == null || iv.length != 32)
throw Exception("IV must be a string of length 16");
else
if (iv == null || iv.length != 32) {
throw Exception('IV must be a string of length 16');
} else {
lastVector = SMUtils.hexStringToBytes(iv);
}
}
final key = (flag == SM4_ENCRYPT) ? _encryptKey : _decryptKey;
final List<int> key = (flag == SM4_ENCRYPT) ? _encryptKey : _decryptKey;
if (flag == SM4_ENCRYPT) {
data = _padding(data, SM4_ENCRYPT);
}
final length = data.length;
final List<int> output = [];
final int length = data.length;
final List<int> output = <int>[];
for (int offset = 0; offset < length; offset += blockSize) {
final outData = List<int>.filled(blockSize, 0);
final copyLen =
final List<int> outData = List<int>.filled(blockSize, 0);
final int copyLen =
(offset + blockSize <= length) ? blockSize : length - offset;
final input = data.sublist(offset, offset + copyLen);
final List<int> input = data.sublist(offset, offset + copyLen);
if (mode == SM4CryptoMode.CBC && flag == SM4_ENCRYPT) {
for (int i = 0; i < blockSize; i++) {
input[i] = input[i] ^ lastVector[i];
@ -476,18 +477,18 @@ class SM4 {
// /// auto add 0x00
static List<int> _autoAddZero(List<int> list) {
/// supplementary list
List<int> supplementList = List.filled(16, 0x00);
final List<int> supplementList = List.filled(16, 0x00);
/// complete list
List<int> completeList = [...list, ...supplementList].sublist(0, 16);
final List<int> completeList = <int>[...list, ...supplementList].sublist(0, 16);
return completeList;
}
/// hex byte list to hex string
static String _listToHex(List<int> arr) {
String hexString = arr
.map((item) {
String itemHexString = item.toRadixString(16);
final String hexString = arr
.map((int item) {
final String itemHexString = item.toRadixString(16);
// The hexadecimal notation is 0123456789ABCDEF
//if there is a single one, add 0
if (itemHexString.length == 1) {
@ -504,7 +505,7 @@ class SM4 {
static String createHexKey({
required String key,
autoPushZero = true,
bool autoPushZero = true,
}) {
List<int> keyList = _utf8ToArray(key);
@ -521,9 +522,11 @@ class SM4 {
static List<int> encrypt(List<int> data,
{List<int>? key, SM4CryptoMode mode = SM4CryptoMode.ECB, String? iv}) {
if (key != null) setKey(key);
List<int> input = data;
List<int> output = _crypto(input, SM4_ENCRYPT, mode, iv);
if (key != null) {
setKey(key);
}
final List<int> input = data;
final List<int> output = _crypto(input, SM4_ENCRYPT, mode, iv);
return output;
}
@ -535,11 +538,13 @@ class SM4 {
// return utf8.decode(output);
// }
static decrypt(List<int> data,
static List<int> decrypt(List<int> data,
{List<int>? key, SM4CryptoMode mode = SM4CryptoMode.ECB, String? iv}) {
if (key != null) setKey(key);
List<int> input = data;
List<int> output = _crypto(input, SM4_DECRYPT, mode, iv);
if (key != null) {
setKey(key);
}
final List<int> input = data;
final List<int> output = _crypto(input, SM4_DECRYPT, mode, iv);
return output;
}
}

View File

@ -1,14 +1,14 @@
class _ASN1Object {
String? tlv;
String t = '00';
String l = '00';
String v = '';
_ASN1Object() {
tlv = null;
}
String? tlv;
String t = '00';
String l = '00';
String v = '';
/// der 16
String getEncodedHex() {
@ -84,11 +84,11 @@ class _DERInteger extends _ASN1Object {
}
class _DERSequence extends _ASN1Object {
List<_ASN1Object> asn1Array;
_DERSequence(this.asn1Array) : super() {
t = '30'; //
}
List<_ASN1Object> asn1Array;
@override
String getValue() {

View File

@ -1,10 +1,10 @@
class ECFieldElementFp {
final BigInt x;
final BigInt q;
ECFieldElementFp(this.q, this.x) {
// TODO if (x.compareTo(q) >= 0) error
// if (x.compareTo(q) >= 0) error
}
final BigInt x;
final BigInt q;
///
bool equals(ECFieldElementFp other) {
@ -51,16 +51,16 @@ class ECFieldElementFp {
}
class ECPointFp {
final ECCurveFp curve;
late final ECFieldElementFp? x;
late final ECFieldElementFp? y;
late final BigInt z;
BigInt? zinv;
ECPointFp(this.curve, this.x, this.y, [BigInt? z]) {
this.z = z ?? BigInt.one;
zinv = null;
}
final ECCurveFp curve;
late final ECFieldElementFp? x;
late final ECFieldElementFp? y;
late final BigInt z;
BigInt? zinv;
ECFieldElementFp getX() {
zinv ??= z.modInverse(curve.q);
@ -73,19 +73,29 @@ class ECPointFp {
}
bool equals(ECPointFp other) {
if (other == this) return true;
if (isInfinity()) return other.isInfinity();
if (other.isInfinity()) return isInfinity();
if (other == this) {
return true;
}
if (isInfinity()) {
return other.isInfinity();
}
if (other.isInfinity()) {
return isInfinity();
}
final u = (other.y!.toBigInteger() * z - y!.toBigInteger() * other.z) % curve.q;
if (u != BigInt.zero) return false;
final BigInt u = (other.y!.toBigInteger() * z - y!.toBigInteger() * other.z) % curve.q;
if (u != BigInt.zero) {
return false;
}
final v = (other.x!.toBigInteger() * z - x!.toBigInteger() * other.z) % curve.q;
final BigInt v = (other.x!.toBigInteger() * z - x!.toBigInteger() * other.z) % curve.q;
return v == BigInt.zero;
}
bool isInfinity() {
if (x == null && y == null) return true;
if (x == null && y == null) {
return true;
}
return z == BigInt.zero && y!.toBigInteger() != BigInt.zero;
}
@ -94,21 +104,25 @@ class ECPointFp {
}
ECPointFp add(ECPointFp b) {
if (isInfinity()) return b;
if (b.isInfinity()) return this;
final x1 = x!.toBigInteger();
final y1 = y!.toBigInteger();
final z1 = z;
final x2 = b.x!.toBigInteger();
final y2 = b.y!.toBigInteger();
final z2 = b.z;
final q = curve.q;
final w1 = (x1 * z2) % q;
final w2 = (x2 * z1) % q;
final w3 = (w1 - w2) % q;
final w4 = (y1 * z2) % q;
final w5 = (y2 * z1) % q;
final w6 = (w4 - w5) % q;
if (isInfinity()) {
return b;
}
if (b.isInfinity()) {
return this;
}
final BigInt x1 = x!.toBigInteger();
final BigInt y1 = y!.toBigInteger();
final BigInt z1 = z;
final BigInt x2 = b.x!.toBigInteger();
final BigInt y2 = b.y!.toBigInteger();
final BigInt z2 = b.z;
final BigInt q = curve.q;
final BigInt w1 = (x1 * z2) % q;
final BigInt w2 = (x2 * z1) % q;
final BigInt w3 = (w1 - w2) % q;
final BigInt w4 = (y1 * z2) % q;
final BigInt w5 = (y2 * z1) % q;
final BigInt w6 = (w4 - w5) % q;
if (w3 == BigInt.zero) {
if (w6 == BigInt.zero) {
@ -117,49 +131,57 @@ class ECPointFp {
return curve.infinity;
}
final w7 = (w1 + w2) % q;
final w8 = (z1 * z2) % q;
final w9 = (w3 * w3) % q;
final w10 = (w3 * w9) % q;
final w11 = (w8 * (w6 * w6) % q - w7 * w9) % q;
final BigInt w7 = (w1 + w2) % q;
final BigInt w8 = (z1 * z2) % q;
final BigInt w9 = (w3 * w3) % q;
final BigInt w10 = (w3 * w9) % q;
final BigInt w11 = (w8 * (w6 * w6) % q - w7 * w9) % q;
final x3 = (w3 * w11) % q;
final y3 = (w6 * (w9 * w1 % q - w11) - w4 * w10) % q;
final z3 = (w10 * w8) % q;
final BigInt x3 = (w3 * w11) % q;
final BigInt y3 = (w6 * (w9 * w1 % q - w11) - w4 * w10) % q;
final BigInt z3 = (w10 * w8) % q;
return ECPointFp(curve, curve.fromBigInteger(x3), curve.fromBigInteger(y3), z3);
}
ECPointFp twice() {
if (isInfinity()) return this;
if (y!.toBigInteger().sign == 0) return curve.infinity;
if (isInfinity()) {
return this;
}
if (y!.toBigInteger().sign == 0) {
return curve.infinity;
}
final x1 = x!.toBigInteger();
final y1 = y!.toBigInteger();
final z1 = z;
final q = curve.q;
final a = curve.a.toBigInteger();
final BigInt x1 = x!.toBigInteger();
final BigInt y1 = y!.toBigInteger();
final BigInt z1 = z;
final BigInt q = curve.q;
final BigInt a = curve.a.toBigInteger();
final w1 = (x1 * x1 * BigInt.from(3) + a * (z1 * z1)) % q;
final w2 = (y1 * BigInt.from(2) * z1) % q;
final w3 = (y1 * y1) % q;
final w4 = (w3 * x1 * z1) % q;
final w5 = (w2 * w2) % q;
final w6 = (w1 * w1 - w4 * BigInt.from(8)) % q;
final BigInt w1 = (x1 * x1 * BigInt.from(3) + a * (z1 * z1)) % q;
final BigInt w2 = (y1 * BigInt.from(2) * z1) % q;
final BigInt w3 = (y1 * y1) % q;
final BigInt w4 = (w3 * x1 * z1) % q;
final BigInt w5 = (w2 * w2) % q;
final BigInt w6 = (w1 * w1 - w4 * BigInt.from(8)) % q;
final x3 = (w2 * w6) % q;
final y3 = (w1 * (w4 * BigInt.from(4) - w6) - w5 * BigInt.from(2) * w3) % q;
final z3 = (w2 * w5) % q;
final BigInt x3 = (w2 * w6) % q;
final BigInt y3 = (w1 * (w4 * BigInt.from(4) - w6) - w5 * BigInt.from(2) * w3) % q;
final BigInt z3 = (w2 * w5) % q;
return ECPointFp(curve, curve.fromBigInteger(x3), curve.fromBigInteger(y3), z3);
}
ECPointFp multiply(BigInt k) {
if (isInfinity()) return this;
if (k.sign == 0) return curve.infinity;
if (isInfinity()) {
return this;
}
if (k.sign == 0) {
return curve.infinity;
}
final k3 = k * BigInt.from(3);
final neg = negate();
final BigInt k3 = k * BigInt.from(3);
final ECPointFp neg = negate();
ECPointFp Q = this;
for (int i = k3.bitLength - 2; i > 0; i--) {
@ -168,9 +190,8 @@ class ECPointFp {
/*final k3Bit = (k3 >> i) & BigInt.one == BigInt.one;
final kBit = (k >> i) & BigInt.one == BigInt.zero;*/
final k3Bit = (k3 >> i).isOdd;
;
final kBit = (k >> i).isOdd;
final bool k3Bit = (k3 >> i).isOdd;
final bool kBit = (k >> i).isOdd;
if (k3Bit != kBit) {
Q = Q.add(k3Bit ? this : neg);
@ -194,8 +215,12 @@ class ECCurveFp {
late ECPointFp infinity;
bool equals(Object? other) {
if (identical(this, other)) return true;
if (other is! ECCurveFp) return false;
if (identical(this, other)) {
return true;
}
if (other is! ECCurveFp) {
return false;
}
return q == other.q && a == other.a && b == other.b;
}
@ -209,8 +234,8 @@ class ECCurveFp {
return infinity;
case 2:
case 3:
final x = fromBigInteger(BigInt.parse(s.substring(2), radix: 16));
var y = fromBigInteger(x
final ECFieldElementFp x = fromBigInteger(BigInt.parse(s.substring(2), radix: 16));
ECFieldElementFp y = fromBigInteger(x
.multiply(x.square())
.add(x.multiply(a))
.add(b)
@ -230,9 +255,9 @@ class ECCurveFp {
case 4:
case 6:
case 7:
final len = (s.length - 2) ~/ 2;
final xHex = s.substring(2, 2 + len);
final yHex = s.substring(2 + len, 2 + 2 * len);
final int len = (s.length - 2) ~/ 2;
final String xHex = s.substring(2, 2 + len);
final String yHex = s.substring(2 + len, 2 + 2 * len);
/*print("xHex: ${BigInt.parse(xHex, radix: 16).toRadixString(16)}");
print("yHex: ${BigInt.parse(yHex, radix: 16).toRadixString(16)}");*/
return ECPointFp(this, fromBigInteger(BigInt.parse(xHex, radix: 16)),
@ -244,7 +269,9 @@ class ECCurveFp {
}
String leftPad(String input, int num) {
if (input.length >= num) return input;
if (input.length >= num) {
return input;
}
return List.filled(num - input.length, '0').join() + input;
}

View File

@ -4,15 +4,14 @@ import 'package:get/get.dart';
import 'entity/SafetyVerificationEntity.dart';
class SafetyVerificationState{
// Rx<SafetyVerificationEntity> safetyVerificationEntity = SafetyVerificationEntity().obs;
var sliderXMoved = 0.0.obs;
var getData = {}.obs;
SafetyVerificationState() {
getData.value = Get.arguments as Map;
}
// Rx<SafetyVerificationEntity> safetyVerificationEntity = SafetyVerificationEntity().obs;
RxDouble sliderXMoved = 0.0.obs;
RxMap getData = {}.obs;
void onClose() {
}

View File

@ -93,7 +93,7 @@ class _StarLockForgetPasswordPageState
),
LoginInput(
controller: state.phoneController,
onchangeAction: (v) {
onchangeAction: (dynamic v) {
logic.checkNext(state.phoneController);
},
leftWidget: Padding(
@ -113,7 +113,7 @@ class _StarLockForgetPasswordPageState
SizedBox(height: 10.h),
LoginInput(
controller: state.pwdController,
onchangeAction: (v) {
onchangeAction: (dynamic v) {
logic.checkNext(state.pwdController);
},
isPwd: true,
@ -141,7 +141,7 @@ class _StarLockForgetPasswordPageState
SizedBox(height: 10.w),
LoginInput(
controller: state.sureController,
onchangeAction: (v) {
onchangeAction: (dynamic v) {
logic.checkNext(state.sureController);
},
isPwd: true,
@ -166,7 +166,7 @@ class _StarLockForgetPasswordPageState
Expanded(
child: LoginInput(
controller: state.codeController,
onchangeAction: (v) {
onchangeAction: (dynamic v) {
logic.checkNext(state.codeController);
},
leftWidget: Padding(

View File

@ -81,7 +81,7 @@ class _StarLockForgetPasswordPageState
),
LoginInput(
controller: state.phoneController,
onchangeAction: (v) {
onchangeAction: (dynamic v) {
logic.checkNext(state.phoneController);
},
leftWidget: Padding(
@ -94,7 +94,7 @@ class _StarLockForgetPasswordPageState
]),
LoginInput(
controller: state.pwdController,
onchangeAction: (v) {
onchangeAction: (dynamic v) {
logic.checkNext(state.pwdController);
},
isPwd: true,
@ -113,7 +113,7 @@ class _StarLockForgetPasswordPageState
),
LoginInput(
controller: state.sureController,
onchangeAction: (v) {
onchangeAction: (dynamic v) {
logic.checkNext(state.sureController);
},
isPwd: true,
@ -131,10 +131,10 @@ class _StarLockForgetPasswordPageState
Expanded(
child: LoginInput(
controller: state.codeController,
onchangeAction: (v) {
onchangeAction: (dynamic v) {
logic.checkNext(state.codeController);
},
leftWidget: SizedBox(),
leftWidget: const SizedBox(),
hintText:
'请输入验证码'.tr,
inputFormatters: <TextInputFormatter>[

View File

@ -1,9 +1,7 @@
import 'package:get/get.dart';
import 'starLock_login_logic.dart';
class StarLockLoginBinding extends Bindings {
@override
void dependencies() {

View File

@ -62,7 +62,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () async {
var data = await Get.toNamed(Routers.starLockRegisterPage);
final data = await Get.toNamed(Routers.starLockRegisterPage);
if (data != null) {
state.emailOrPhoneController.text = data['phoneOrEmailStr'];
logic.checkNext(state.emailOrPhoneController);
@ -98,7 +98,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
),
action: () async {
var result =
final result =
await Get.toNamed(Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;

View File

@ -54,7 +54,7 @@ class SelectGatewayListLogic extends BaseGetXController {
// lockInfo['mac'] = macStr;
gatewayModel.mac = macStr;
index = index + 20;
AppLog.log('网关MAC地址 macList:$macList macStr:$macStr');
// AppLog.log('网关MAC地址 macList:$macList macStr:$macStr');
//
final List<int> serialNum = reply.data.sublist(index, index + 20);
@ -62,7 +62,7 @@ class SelectGatewayListLogic extends BaseGetXController {
// lockInfo['serialNum'] = serialNumStr;
gatewayModel.serialNum = serialNumStr;
index = index + 20;
AppLog.log('网关序列号 serialNum:$serialNum serialNumStr:$serialNumStr');
// AppLog.log('网关序列号 serialNum:$serialNum serialNumStr:$serialNumStr');
//
final List<int> gatewayVersion = reply.data.sublist(index, index + 20);
@ -70,7 +70,7 @@ class SelectGatewayListLogic extends BaseGetXController {
// lockInfo['gatewayVersion'] = gatewayVersionStr;
gatewayModel.gatewayVersion = gatewayVersionStr;
index = index + 20;
AppLog.log('软件版本 gatewayVersion:$gatewayVersion gatewayVersionStr:$gatewayVersionStr');
// AppLog.log('软件版本 gatewayVersion:$gatewayVersion gatewayVersionStr:$gatewayVersionStr');
// wifiMac地址
// final List<int> wifiMac = reply.data.sublist(index, index + 20);

View File

@ -0,0 +1,81 @@
class GatewayConnectionLockListEntity {
GatewayConnectionLockListEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
GatewayConnectionLockListEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
int? errorCode;
String? description;
String? errorMsg;
Data? data;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class Data {
Data({this.list, this.total, this.pageNo, this.pageSize});
Data.fromJson(Map<String, dynamic> json) {
if (json['list'] != null) {
list = <GatewayConnectionLockItemEntity>[];
json['list'].forEach((v) {
list!.add(GatewayConnectionLockItemEntity.fromJson(v));
});
}
total = json['total'];
pageNo = json['pageNo'];
pageSize = json['pageSize'];
}
List<GatewayConnectionLockItemEntity>? list;
int? total;
int? pageNo;
int? pageSize;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (list != null) {
data['list'] = list!.map((v) => v.toJson()).toList();
}
data['total'] = total;
data['pageNo'] = pageNo;
data['pageSize'] = pageSize;
return data;
}
}
class GatewayConnectionLockItemEntity {
GatewayConnectionLockItemEntity({this.lockId, this.lockAlias, this.rssi});
GatewayConnectionLockItemEntity.fromJson(Map<String, dynamic> json) {
lockId = json['lockId'];
lockAlias = json['lockAlias'];
rssi = json['rssi'];
}
int? lockId;
String? lockAlias;
int? rssi;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['lockId'] = lockId;
data['lockAlias'] = lockAlias;
data['rssi'] = rssi;
return data;
}
}

View File

@ -0,0 +1,28 @@
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../network/api_repository.dart';
import 'gatewayConnectionLockList_entity.dart';
import 'gatewayConnectionLockList_state.dart';
class GatewayConnectionLockListLogic extends BaseGetXController {
GatewayConnectionLockListState state = GatewayConnectionLockListState();
// -
Future<GatewayConnectionLockListEntity> gatewayConnectionLockListDataRequest() async {
final GatewayConnectionLockListEntity entity = await ApiRepository.to.gatewayConnectionLockLoadData(
gatewayId:state.gatewayId.value
);
if (entity.errorCode!.codeIsSuccessful) {
state.itemDataList.value = entity.data!.list!;
}
return entity;
}
@override
void onReady() {
super.onReady();
gatewayConnectionLockListDataRequest();
}
}

View File

@ -4,8 +4,11 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../../app_settings/app_colors.dart';
import '../../../tools/noData.dart';
import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart';
import 'gatewayConnectionLockList_entity.dart';
import 'gatewayConnectionLockList_logic.dart';
import 'gatewayConnectionLockList_state.dart';
class GatewayConnectionLockListPage extends StatefulWidget {
const GatewayConnectionLockListPage({Key? key}) : super(key: key);
@ -15,6 +18,8 @@ class GatewayConnectionLockListPage extends StatefulWidget {
}
class _GatewayConnectionLockListPageState extends State<GatewayConnectionLockListPage> {
final GatewayConnectionLockListLogic logic = Get.put(GatewayConnectionLockListLogic());
final GatewayConnectionLockListState state = Get.find<GatewayConnectionLockListLogic>().state;
@override
Widget build(BuildContext context) {
@ -26,23 +31,26 @@ class _GatewayConnectionLockListPageState extends State<GatewayConnectionLockLis
backgroundColor: AppColors.mainColor
),
body: Column(
children: [
children: <Widget>[
Container(
width: 1.sw,
color: Colors.grey.shade300,
padding: EdgeInsets.all(10.h),
child: Text('网关连接的锁'.tr, style: TextStyle(fontSize: 24.sp))
),
Expanded(
child: ListView.builder(
Obx(() => Expanded(
child:
state.itemDataList.value.isNotEmpty ?
ListView.builder(
itemCount:10,
itemBuilder: (c, index){
return _gatewayConnectionLockListItem('images/mine/icon_mine_gatewaySignal_prompt.png', 'MCBN01 8f3106', '信号强'.tr,(){
itemBuilder: (BuildContext c, int index){
final GatewayConnectionLockItemEntity entity = state.itemDataList[index];
return _gatewayConnectionLockListItem('images/mine/icon_mine_gatewaySignal_prompt.png', entity.lockAlias ?? '', '信号强'.tr,(){
// Navigator.pushNamed(context, Routers.gatewayDetailPage);
});
}
),
)
):NoData(),
))
],
),
);
@ -60,32 +68,27 @@ class _GatewayConnectionLockListPageState extends State<GatewayConnectionLockLis
borderRadius: BorderRadius.circular(10.w),
),
child: Row(
children: [
children: <Widget>[
Image.asset(lockTypeIcon, width: 70.w, height: 70.w,),
SizedBox(width: 20.w,),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
// color: Colors.red,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(gateWayName, style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500)),
],
),
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(gateWayName, style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500)),
],
),
SizedBox(height:5.h),
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Image.asset('images/mine/icon_mine_gatewaySignal_strong.png', width: 30.w, height: 30.w,),
SizedBox(width: 10.w,),
Text(signalStrength, style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w500), ),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Image.asset('images/mine/icon_mine_gatewaySignal_strong.png', width: 30.w, height: 30.w,),
SizedBox(width: 10.w,),
Text(signalStrength, style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w500), ),
],
),
SizedBox(width:20.h),
],

View File

@ -0,0 +1,17 @@
import 'package:get/get.dart';
import 'gatewayConnectionLockList_entity.dart';
class GatewayConnectionLockListState{
GatewayConnectionLockListState() {
var map = Get.arguments;
if (map['gatewayId'] > 0) {
gatewayId.value = map['gatewayId'];
}
}
var gatewayId = 0.obs;
final itemDataList = <GatewayConnectionLockItemEntity>[].obs;
}

View File

@ -58,7 +58,7 @@ class _GatewayDetailPageState extends State<GatewayDetailPage> {
}),
CommonItem(
leftTitel: '状态'.tr,
rightTitle: state.getewayItemData.value.isOnline == 1 ? '在线' : '离线',
rightTitle: state.getewayItemData.value.isOnline == 1 ? '在线'.tr : '离线'.tr,
isHaveLine: true,
isHaveDirection: false),
CommonItem(
@ -74,14 +74,16 @@ class _GatewayDetailPageState extends State<GatewayDetailPage> {
SizedBox(
height: 10.h,
),
// CommonItem(
// leftTitel: '附近的锁'.tr,
// rightTitle: state.getewayItemData.value.lockNum.toString(),
// isHaveLine: true,
// isHaveDirection: true,
// action: () {
// Navigator.pushNamed(context, Routers.gatewayConnectionLockPage);
// }),
CommonItem(
leftTitel: '附近的锁'.tr,
rightTitle: state.getewayItemData.value.lockNum.toString(),
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.gatewayConnectionLockPage, arguments: {
'gatewayId':state.getewayItemData.value.gatewayId ?? 0
});
}),
// CommonItem(
// leftTitel: '网关升级'.tr,
// rightTitle: '',

View File

@ -1,6 +1,7 @@
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../login/login/entity/LoginEntity.dart';
import '../../../network/api_repository.dart';
import '../../mineSet/transferGateway/selectGetewayList_entity.dart';
import 'gatewayList_state.dart';
@ -29,10 +30,28 @@ class GatewayListLogic extends BaseGetXController {
return entity;
}
@override
void onInit() {
super.onInit();
//
// Future<void> gatewayDistributionNetwork() async{
// final LoginEntity entity = await ApiRepository.to.gatewayDistributionNetwork(
// gatewayName: '测试网关添加',
// gatewayMac: '48:6F:73:52:A1:C3',
// serialNumber: '1.0.0',
// gatewayType: 2,
// networkName: '测试网关添加WiFi名字',
// networkMac: '48:6F:73:52:A1:C3',
// version: '1.0.0',
// );
// if(entity.errorCode!.codeIsSuccessful){
// showToast('配网成功', something:(){
//
// });
// }
// }
}
// @override
// void onInit() {
// super.onInit();
// gatewayDistributionNetwork();
// }
}

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -6,7 +7,6 @@ import 'package:star_lock/tools/noData.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart';
import '../../../tools/EasyRefreshTool.dart';
import '../../../tools/storage.dart';
import '../../../tools/titleAppBar.dart';
import '../../mineSet/transferGateway/selectGetewayList_entity.dart';
import 'gatewayList_logic.dart';
@ -49,7 +49,7 @@ class _GatewayListPageState extends State<GatewayListPage> {
actionsList: <Widget>[
GestureDetector(
onTap: () {
Get.toNamed(Routers.selectGatewayTypeNextTipPage)!.then((value) => getHttpData(isRefresh: true));
Get.toNamed(Routers.selectGatewayTypeNextTipPage)!.then((dynamic value) => getHttpData(isRefresh: true));
},
child: Image.asset(
'images/icon_add_white.png',
@ -75,7 +75,7 @@ class _GatewayListPageState extends State<GatewayListPage> {
return _gatewatListItem(item, () {
Get.toNamed(Routers.gatewayDetailPage, arguments: {
'getewayItemData': item
})!.then((value) => getHttpData(isRefresh: true));
})!.then((dynamic value) => getHttpData(isRefresh: true));
});
},
separatorBuilder: (BuildContext context, int index) {

View File

@ -155,6 +155,7 @@ abstract class Api {
'/plug/transferPlugConfirm'; //
final String transferGatewayURL = '/plug/transfer'; //
final String updateGatewayURL = '/gateway/update'; //
final String gatewayListByLockURL = '/gateway/listByLock'; // -
final String getKeyDetailURL = '/key/get'; //
final String lockUserListURL = '/keyUser/listKeyUser'; //

View File

@ -1783,6 +1783,10 @@ class ApiProvider extends BaseProvider {
'countryCode': countryCode
}));
Future<Response> gatewayConnectionLockListLoadData(int gatewayId) => post(
gatewayListByLockURL.toUrl,
jsonEncode({'gatewayId': gatewayId}));
//
Future<Response> removeBrokenLockData(List lockIdList) =>
post(removeBadLockURL.toUrl, jsonEncode({'lockIds': lockIdList}));

View File

@ -73,6 +73,7 @@ import '../main/lockDetail/palm/addPalm/addPalm_entity.dart';
import '../main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_entity.dart';
import '../main/lockMian/entity/lockListInfo_entity.dart';
import '../mine/addLock/saveLock/entity/SaveLockEntity.dart';
import '../mine/gateway/gatewayConnectionLock/gatewayConnectionLockList_entity.dart';
import '../mine/message/messageList/messageList_entity.dart';
import '../mine/minePersonInfo/minePersonInfoPage/minePersonGetUploadFileInfo_entity.dart';
import '../mine/mineSet/lockUserManage/expireLockList/expireCard/expireCard_entity.dart';
@ -1944,6 +1945,13 @@ class ApiRepository {
return RecipientInformationEntity.fromJson(res.body);
}
// -
Future<GatewayConnectionLockListEntity> gatewayConnectionLockLoadData(
{required int gatewayId}) async {
final res = await apiProvider.gatewayConnectionLockListLoadData(gatewayId);
return GatewayConnectionLockListEntity.fromJson(res.body);
}
//
Future<RecipientInformationEntity> transferGatewayInfoData(
{required String receiverUsername,