74 lines
1.9 KiB
Dart
74 lines
1.9 KiB
Dart
import 'dart:typed_data';
|
|
|
|
import '../io_reply.dart';
|
|
import '../io_sender.dart';
|
|
import '../io_type.dart';
|
|
|
|
//oat升级
|
|
class VoicePackageConfigureProcess extends SenderProtocol {
|
|
VoicePackageConfigureProcess({
|
|
this.index,
|
|
this.size,
|
|
this.data,
|
|
}) : super(CommandType.voicePackageConfigureProcess);
|
|
int? index;
|
|
int? size;
|
|
List<int>? data;
|
|
|
|
@override
|
|
String toString() {
|
|
return 'VoicePackageConfigureProcess{index: $index, size: $size, data: $data}';
|
|
}
|
|
|
|
@override
|
|
List<int> messageDetail() {
|
|
final List<int> data = [];
|
|
|
|
// 指令类型
|
|
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);
|
|
|
|
//index 2
|
|
final ByteData indexBytes = ByteData(2); // 创建一个长度为4的字节数据
|
|
indexBytes.setInt16(0, index!);
|
|
final List<int> indexList = indexBytes.buffer.asUint8List();
|
|
data.addAll(indexList);
|
|
|
|
//size 2
|
|
final ByteData bytes = ByteData(2); // 创建一个长度为4的字节数据
|
|
bytes.setInt16(0, size!);
|
|
final List<int> byteList = bytes.buffer.asUint8List();
|
|
data.addAll(byteList);
|
|
|
|
data.addAll(this.data!);
|
|
|
|
printLog(data);
|
|
//不加密
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class VoicePackageConfigureProcessReply extends Reply {
|
|
VoicePackageConfigureProcessReply.parseData(
|
|
CommandType commandType, List<int> dataDetail)
|
|
: super.parseData(commandType, dataDetail) {
|
|
data = dataDetail;
|
|
status = data[2];
|
|
errorWithStstus(status);
|
|
}
|
|
}
|
|
|
|
class VoicePackageConfigureConfirmationReply extends Reply {
|
|
VoicePackageConfigureConfirmationReply.parseData(
|
|
CommandType commandType, List<int> dataDetail)
|
|
: super.parseData(commandType, dataDetail) {
|
|
data = dataDetail;
|
|
status = data[2];
|
|
errorWithStstus(status);
|
|
}
|
|
}
|