fix:调整新的中继协议中的上报签名逻辑
This commit is contained in:
parent
12c6bbe160
commit
ec0a9c6ebc
@ -247,7 +247,6 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
ToPeerId: '3phX8Ng2cZHz5NtP8xAf6nYy2z1BYytoejgjoHrWMGhH');
|
||||
},
|
||||
),
|
||||
|
||||
SizedBox(height: 50.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
||||
@ -236,20 +236,25 @@ class ScpMessage {
|
||||
}
|
||||
|
||||
// Payload (字符串,转换为字节)
|
||||
if (message.PayloadLength != null &&
|
||||
bytes.length - offset >= message.PayloadLength!) {
|
||||
message.Payload =
|
||||
utf8.decode(bytes.sublist(offset, offset + message.PayloadLength!));
|
||||
offset += message.PayloadLength!;
|
||||
} else {
|
||||
throw FormatException("Invalid Payload or PayloadLength");
|
||||
}
|
||||
// if (message.PayloadLength != null &&
|
||||
// bytes.length - offset >= message.PayloadLength!) {
|
||||
// message.Payload =
|
||||
// utf8.decode(bytes.sublist(offset, offset + message.PayloadLength!));
|
||||
// offset += message.PayloadLength!;
|
||||
// } else {
|
||||
// throw FormatException("Invalid Payload or PayloadLength");
|
||||
// }
|
||||
|
||||
// 打印解析后的 PayloadLength
|
||||
print('Parsed PayloadLength: ${message.PayloadLength}');
|
||||
|
||||
// 解析Payload
|
||||
// 解析Payload
|
||||
if (message.PayloadType == 110) { // 假设110表示HeartbeatResponse类型
|
||||
if (message.PayloadLength != null && bytes.length - offset >= message.PayloadLength!) {
|
||||
final payloadBytes = bytes.sublist(offset, offset + message.PayloadLength!);
|
||||
if (message.PayloadType == PayloadTypeConstant.heartbeat) {
|
||||
// 假设110表示HeartbeatResponse类型
|
||||
if (message.PayloadLength != null &&
|
||||
bytes.length - offset >= message.PayloadLength!) {
|
||||
final payloadBytes =
|
||||
bytes.sublist(offset, offset + message.PayloadLength!);
|
||||
message.Payload = HeartbeatResponse.deserialize(payloadBytes);
|
||||
offset += message.PayloadLength!;
|
||||
} else {
|
||||
@ -257,15 +262,16 @@ class ScpMessage {
|
||||
}
|
||||
} else {
|
||||
// 处理其他类型的Payload
|
||||
if (message.PayloadLength != null && bytes.length - offset >= message.PayloadLength!) {
|
||||
message.Payload = utf8.decode(bytes.sublist(offset, offset + message.PayloadLength!));
|
||||
if (message.PayloadLength != null &&
|
||||
bytes.length - offset >= message.PayloadLength!) {
|
||||
message.Payload =
|
||||
utf8.decode(bytes.sublist(offset, offset + message.PayloadLength!));
|
||||
offset += message.PayloadLength!;
|
||||
} else {
|
||||
throw FormatException("Invalid Payload or PayloadLength");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 验证PayloadCRC
|
||||
// if (message.Payload != null) {
|
||||
// var crcBytes = List<int>.from(utf8.encode(message.Payload!));
|
||||
|
||||
@ -139,8 +139,9 @@ class StartChartManage {
|
||||
try {
|
||||
_log(text: '收到消息---> 长度:${dg?.data?.length}, 数据:${dg?.data}');
|
||||
if (dg?.data != null) {
|
||||
final deserialize = ScpMessage.deserialize(dg!.data);
|
||||
_log(text: '=============${bytesToHex(dg!.data)}');
|
||||
final deserialize = ScpMessage.deserialize(dg!.data);
|
||||
|
||||
_log(text: 'Udp收到结构体数据---》$deserialize');
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user