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

86 lines
2.3 KiB
Dart

import 'io_protocol/io_addUser.dart';
import 'io_protocol/io_getPrivateKey.dart';
import 'io_protocol/io_getPublicKey.dart';
import 'io_protocol/io_openDoor.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 senderOpenDoor({CommandSendCallBack? callBack}) {
// CommandSenderManager().managerSendData(
// command: OpenDoorCommand(
// cmdID: 0,
// keyID: "",
// userID: "",
// openMode: 0,
// openTime: 0,
// token: 0,
// authCodeLen: 0,
// authCode: "",
// ), callBack:callBack);
// }
}