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