51 lines
1.0 KiB
Dart
51 lines
1.0 KiB
Dart
import 'dart:convert';
|
||
|
||
import '../io_tool/io_tool.dart';
|
||
import 'io_reply.dart';
|
||
import 'io_sender.dart';
|
||
import 'io_type.dart';
|
||
|
||
class GetPublicKeyCommand extends SenderProtocol {
|
||
|
||
String? lockID;
|
||
GetPublicKeyCommand({
|
||
this.lockID,
|
||
}) : super(CommandType.getLockPublicKey);
|
||
|
||
@override
|
||
List<int> messageDetail() {
|
||
List<int> data = [];
|
||
print("lockID:${lockID!} lockID.utf8.encode${utf8.encode(lockID!)}");
|
||
data.addAll(utf8.encode(lockID!));
|
||
for(int i = 0; i<24; i++){
|
||
data.add(0);
|
||
}
|
||
print("dataaaaaa:$data");
|
||
return data;
|
||
}
|
||
}
|
||
|
||
class GetPublicKeyReply extends Reply {
|
||
GetPublicKeyReply.parseData(CommandType commandType, List<int> dataDetail)
|
||
: super.parseData(commandType, dataDetail) {
|
||
// print('获取公钥');
|
||
switch(dataDetail[0]){
|
||
case 0x00:
|
||
//成功
|
||
print('获取公钥');
|
||
break;
|
||
case 0x07:
|
||
//无权限
|
||
|
||
break;
|
||
case 0x0f:
|
||
//用户已存在
|
||
|
||
break;
|
||
default:
|
||
//失败
|
||
|
||
break;
|
||
}
|
||
}
|
||
} |