app-starlock/star_lock/lib/blue/sender_manage.dart

224 lines
5.9 KiB
Dart

import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
import 'package:star_lock/blue/io_protocol/io_getLockStatu.dart';
import 'io_protocol/io_addUser.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_openLock.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 senderTransferPermissions({
String? lockID,
String? authUserID,
String? keyID,
String? oldUserID,
String? newUserID,
int? needAuthor,
List<int>? publicKey,
List<int>? privateKey,
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({
String? lockID,
String? userID,
String? keyID,
List<int>? publicKey,
List<int>? privateKey,
List<int>? token,
int? needAuthor,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
command: FactoryDataResetCommand(
lockID: lockID,
userID: userID,
keyID: keyID,
needAuthor: needAuthor,
publicKey: publicKey,
privateKey: privateKey,
token: token
), callBack:callBack);
}
}