app-starlock/star_lock/lib/blue/sender_manage.dart
2023-11-18 10:38:13 +08:00

744 lines
22 KiB
Dart

import 'package:star_lock/blue/io_protocol/io_addICCard.dart';
import 'package:star_lock/blue/io_protocol/io_addStressICCard.dart';
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
import 'package:star_lock/blue/io_protocol/io_getLockStatu.dart';
import 'package:star_lock/blue/io_protocol/io_readAdminPassword.dart';
import 'io_protocol/io_addFingerprint.dart';
import 'io_protocol/io_addStressFingerprint.dart';
import 'io_protocol/io_addStressPassword.dart';
import 'io_protocol/io_addUser.dart';
import 'io_protocol/io_automaticPadlock.dart';
import 'io_protocol/io_checkingCardStatus.dart';
import 'io_protocol/io_checkingUserInfoCount.dart';
import 'io_protocol/io_configuringWifi.dart';
import 'io_protocol/io_editUser.dart';
import 'io_protocol/io_factoryDataReset.dart';
import 'io_protocol/io_getPrivateKey.dart';
import 'io_protocol/io_getPublicKey.dart';
import 'io_protocol/io_getStarLockStatusInfo.dart';
import 'io_protocol/io_openLock.dart';
import 'io_protocol/io_queryingFingerprintStatus.dart';
import 'io_protocol/io_readSupportFunctionsNoParameters.dart';
import 'io_protocol/io_readSupportFunctionsWithParameters.dart';
import 'io_protocol/io_referEventRecordNumber.dart';
import 'io_protocol/io_referEventRecordTime.dart';
import 'io_protocol/io_senderCustomPasswords.dart';
import 'io_protocol/io_setSupportFunctionsNoParameters.dart';
import 'io_protocol/io_setSupportFunctionsWithParameters.dart';
import 'io_protocol/io_timing.dart';
import 'io_protocol/io_transferPermissions.dart';
import 'sender_data.dart';
class IoSenderManage {
//todo:获取公钥
static void getPublicKey({String? lockId ,CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(command: GetPublicKeyCommand(
lockID: lockId,
), callBack:callBack);
}
//todo:获取私钥
static void getPrivateKey({
String? lockId,
String? keyID, // 钥匙ID
String? authUserID,// 钥匙授权人ID
int? nowTime,
List<int>? publicKeyData,
int? needAuthor,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(command: GetPrivateKeyCommand(
lockID: lockId,
keyID: keyID,
authUserID: authUserID,
nowTime: nowTime,
publicKeyData:publicKeyData,
needAuthor: needAuthor,
), callBack:callBack);
}
//todo:添加用户
static void senderAddUser({
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,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: AddUserCommand(
lockID: lockID,
authUserID: authUserID,
keyID: keyID,
userID: userID,
openMode: openMode,
keyType: keyType,
startDate: startDate,
expireDate: expireDate,
role: role,
password: password,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
token: token
), callBack:callBack);
}
//todo:修改用户
static void senderEditUser({
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,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: EditUserCommand(
lockID: lockID,
authUserID: authUserID,
keyID: keyID,
userID: userID,
openMode: openMode,
keyType: keyType,
startDate: startDate,
expireDate: expireDate,
role: role,
password: password,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
token: token
), callBack:callBack);
}
//todo:删除
static void deletUser({
String? lockID,
String? authUserID,
String? keyID,
String? delUserID,
int? needAuthor,
List<int>? publicKey,
List<int>? privateKey,
List<int>? token,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: DeletUserCommand(
lockID: lockID,
authUserID: authUserID,
keyID: keyID,
delUserID:delUserID,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
token: token
), callBack:callBack);
}
//todo:开锁
static void senderOpenLock({
String? keyID,
String? userID,
int? openMode,
int? openTime,
List<int>? token,
int? needAuthor,
List<int>? signKey,
List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: OpenLockCommand(
keyID: keyID,
userID: userID,
openMode: openMode,
openTime: openTime,
token: token,
needAuthor: needAuthor,
signKey: signKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:获取锁状态
static void senderGetLockStatu({
String? lockID,
String? userID,
List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: GetLockStatuCommand(
lockID: lockID,
userID: userID,
privateKey: privateKey,
), callBack:callBack);
}
//todo:获取星锁状态信息
static void senderGetStarLockStatuInfo({
String? lockID,
String? userID,
List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: GetStarLockStatuInfoCommand(
lockID: lockID,
userID: userID,
privateKey: privateKey,
), callBack:callBack);
}
//todo:转移权限
static void senderTransferPermissions({
required String? lockID,
required String? authUserID,
required String? keyID,
required String? oldUserID,
required String? newUserID,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
required List<int>? token,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: TransferPermissionsCommand(
lockID: lockID,
authUserID: authUserID,
keyID: keyID,
oldUserID: oldUserID,
newUserID: newUserID,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
token: token
), callBack:callBack);
}
//todo:恢复出厂设置
static void senderFactoryDataReset({
required String? lockID,
required String? userID,
required String? keyID,
required List<int>? publicKey,
required List<int>? privateKey,
required List<int>? token,
required int? needAuthor,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: FactoryDataResetCommand(
lockID: lockID,
userID: userID,
keyID: keyID,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
token: token
), callBack:callBack);
}
//todo:设置开锁密码
static void senderCustomPasswordsCommand({
required String? keyID,
required String? userID,
required int? pwdNo,
required String? pwd,
required int? useCountLimit,
required List<int>? token,
required int? startTime,
required int? endTime,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderCustomPasswordsCommand(
keyID: keyID,
userID: userID,
pwdNo: pwdNo,
pwd:pwd,
useCountLimit: useCountLimit,
token: token,
startTime: startTime,
endTime: endTime,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:添加指纹开始
static void senderAddFingerprintCommand({
required String? keyID,
required String? userID,
required int? fingerNo,
required int? useCountLimit,
required List<int>? token,
required int? startTime,
required int? endTime,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderAddFingerprintCommand(
keyID: keyID,
userID: userID,
fingerNo: fingerNo,
useCountLimit: useCountLimit,
token: token,
startTime: startTime,
endTime: endTime,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:添加卡开始
static void senderAddICCardCommand({
required String? keyID,
required String? userID,
required int? cardNo,
required int? useCountLimit,
required List<int>? token,
required int? startTime,
required int? endTime,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderAddICCardCommand(
keyID: keyID,
userID: userID,
cardNo: cardNo,
useCountLimit: useCountLimit,
token: token,
startTime: startTime,
endTime: endTime,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:校验时间
static void senderTimingCommand({
required String? lockID,
required String? userID,
required int? nowTime,
required List<int>? token,
required int? needAuthor,
required List<int>? signKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: TimingCommand(
lockID: lockID,
userID: userID,
nowTime: nowTime,
token: token,
needAuthor: needAuthor,
signKey: signKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:自动落锁 - 废弃
// static void senderAutomaticPadlockCommand({
// required String? lockID,
// required String? userID,
// required int? autoLockFlag,
// required List<int>? token,
// required int? needAuthor,
// required List<int>? signKey,
// required List<int>? privateKey,
// CommandSendCallBack? callBack}) {
// CommandSenderManager().managerSendData(
// command: AutomaticPadlockCommand(
// lockID: lockID,
// userID: userID,
// autoLockFlag: autoLockFlag,
// token: token,
// needAuthor: needAuthor,
// signKey: signKey,
// privateKey: privateKey,
// ), callBack:callBack);
// }
//todo:事件记录(页数查询)
static void senderReferEventRecordNumberCommand({
required String? keyID,
required String? userID,
required int? logsCount,
required int? logsNo,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderReferEventRecordNumberCommand(
keyID: keyID,
userID: userID,
logsCount: logsCount,
logsNo: logsNo,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:事件记录(时间查询)
static void senderReferEventRecordTimeCommand({
required String? keyID,
required String? userID,
required int? logsCount,
required int? time,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderReferEventRecordTimeCommand(
keyID: keyID,
userID: userID,
logsCount: logsCount,
time: time,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:查询指纹状态
static void senderQueryingFingerprintStatusCommand({
required String? keyID,
required String? userID,
required int? role,
required int? fingerCount,
required int? fingerNo,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderQueryingFingerprintStatusCommand(
keyID: keyID,
userID: userID,
role: role,
fingerCount: fingerCount,
fingerNo: fingerNo,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:查询卡片状态
static void senderCheckingCardStatusCommand({
required String? keyID,
required String? userID,
required int? role,
required int? cardCount,
required int? cardNo,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderCheckingCardStatusCommand(
keyID: keyID,
userID: userID,
role: role,
cardCount: cardCount,
cardNo: cardNo,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:查询用户、指纹、密码、卡片数量(用于判断是否同步)
static void senderCheckingUserInfoCountCommand({
required String? keyID,
required String? userID,
required int? role,
required int? nowTime,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderCheckingUserInfoCountCommand(
keyID: keyID,
userID: userID,
role: role,
nowTime: nowTime,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:配置wifi
static void senderConfiguringWifiCommand({
required String? keyID,
required String? userID,
required String? ssid,
required String? password,
required int? numberOfServers,
required List<int>? listOfServers,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderConfiguringWifiCommand(
keyID: keyID,
userID: userID,
ssid: ssid,
password: password,
numberOfServers: numberOfServers,
listOfServers: listOfServers,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:添加胁迫指纹
static void senderAddStressFingerprintCommand({
required String? keyID,
required String? userID,
required int? fingerNo,
required int? useCountLimit,
required List<int>? token,
required int? startTime,
required int? endTime,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderAddStressFingerprintCommand(
keyID: keyID,
userID: userID,
fingerNo: fingerNo,
useCountLimit: useCountLimit,
token: token,
startTime: startTime,
endTime: endTime,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:添加胁迫卡片
static void senderAddStressICCardCommand({
required String? keyID,
required String? userID,
required int? icCardNo,
required int? useCountLimit,
required List<int>? token,
required int? startTime,
required int? endTime,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderAddStressICCardCommand(
keyID: keyID,
userID: userID,
icCardNo: icCardNo,
useCountLimit: useCountLimit,
token: token,
startTime: startTime,
endTime: endTime,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:添加胁迫密码
static void senderAddStressPasswordCommand({
required String? keyID,
required String? userID,
required int? passwordNo,
required int? useCountLimit,
required List<int>? token,
required int? startTime,
required int? endTime,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderAddStressPasswordCommand(
keyID: keyID,
userID: userID,
passwordNo: passwordNo,
useCountLimit: useCountLimit,
token: token,
startTime: startTime,
endTime: endTime,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:读取支持功能(不带参数)启用/禁用
static void readSupportFunctionsNoParametersCommand({
required String? keyID,
required String? userID,
required int? featureBit,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: ReadSupportFunctionsNoParametersCommand(
keyID: keyID,
userID: userID,
featureBit: featureBit,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:设置支持功能(不带参数)启用/禁用
static void setSupportFunctionsNoParametersCommand({
required String? keyID,
required String? userID,
required int? featureBit,
required int? featureEnable,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SetSupportFunctionsNoParametersCommand(
keyID: keyID,
userID: userID,
featureBit: featureBit,
featureEnable:featureEnable,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:读取支持功能(带参数)启用/禁用
static void readSupportFunctionsWithParametersCommand({
required String? keyID,
required String? userID,
required int? featureBit,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: ReadSupportFunctionsWithParametersCommand(
keyID: keyID,
userID: userID,
featureBit: featureBit,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:设置支持功能(带参数)启用/禁用
static void setSupportFunctionsWithParametersCommand({
required String? keyID,
required String? userID,
required int? featureBit,
required int? featureParaLength,
required List<int>? featureData,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SetSupportFunctionsWithParametersCommand(
keyID: keyID,
userID: userID,
featureBit: featureBit,
featureParaLength:featureParaLength,
featureData:featureData,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
//todo:读取管理员密码
static void senderReadAdminPasswordCommand({
required String? keyID,
required String? userID,
required int? role,
required int? pwdNum,
required int? pwdNo,
required List<int>? token,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: SenderReadAdminPasswordCommand(
keyID: keyID,
userID: userID,
role: role,
pwdNum: pwdNum,
pwdNo: pwdNo,
token: token,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
), callBack:callBack);
}
}