55 lines
1.3 KiB
Dart
55 lines
1.3 KiB
Dart
import 'dart:convert';
|
|
import 'dart:typed_data';
|
|
|
|
import 'package:crypto/crypto.dart' as crypto;
|
|
|
|
import '../io_reply.dart';
|
|
import '../io_sender.dart';
|
|
import '../io_tool/io_tool.dart';
|
|
import '../io_type.dart';
|
|
import '../sm4Encipher/sm4.dart';
|
|
|
|
//oat升级
|
|
class ReadLockCurrentVoicePacket extends SenderProtocol {
|
|
ReadLockCurrentVoicePacket({
|
|
this.lockID,
|
|
}) : super(CommandType.readLockCurrentVoicePacket);
|
|
String? lockID;
|
|
|
|
@override
|
|
String toString() {
|
|
return 'ReadLockCurrentVoicePacket{lockID: $lockID}';
|
|
}
|
|
|
|
@override
|
|
List<int> messageDetail() {
|
|
List<int> data = <int>[];
|
|
|
|
// 指令类型
|
|
final int type = commandType!.typeValue;
|
|
final double typeDouble = type / 256;
|
|
final int type1 = typeDouble.toInt();
|
|
final int type2 = type % 256;
|
|
data.add(type1);
|
|
data.add(type2);
|
|
|
|
// 锁id 40
|
|
final int lockIDLength = utf8.encode(lockID!).length;
|
|
data.addAll(utf8.encode(lockID!));
|
|
data = getFixedLengthList(data, 40 - lockIDLength);
|
|
|
|
printLog(data);
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class ReadLockCurrentVoicePacketReply extends Reply {
|
|
ReadLockCurrentVoicePacketReply.parseData(
|
|
CommandType commandType, List<int> dataDetail)
|
|
: super.parseData(commandType, dataDetail) {
|
|
data = dataDetail;
|
|
status = data[2];
|
|
errorWithStstus(status);
|
|
}
|
|
}
|