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 String toString() { return 'GetPublicKeyCommand{lockID: $lockID}'; } @override List messageDetail() { List data = []; // 指令类型 int type = commandType!.typeValue; double typeDouble = type / 256; int type1 = typeDouble.toInt(); int type2 = type % 256; data.add(type1); data.add(type2); int length = utf8.encode(lockID!).length; data.addAll(utf8.encode(lockID!)); data = getFixedLengthList(data, 40 - length); printLog(data); return data; } } class GetPublicKeyReply extends Reply { GetPublicKeyReply.parseData(CommandType commandType, List dataDetail) : super.parseData(commandType, dataDetail) { status = dataDetail[2]; data = dataDetail; } }