fix:修复数据类型转换导致的分包组包问题
This commit is contained in:
parent
6147b86e8b
commit
7437add645
File diff suppressed because one or more lines are too long
@ -171,11 +171,11 @@ class ScpMessage {
|
|||||||
final message = ScpMessage();
|
final message = ScpMessage();
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
// Convert byte array to hex string with zero padding and without spaces
|
// Convert byte array to hex string with zero padding and without spaces
|
||||||
// String hexString =
|
String hexString =
|
||||||
// bytes.map((b) => b.toRadixString(16).padLeft(2, '0')).join();
|
bytes.map((b) => b.toRadixString(16).padLeft(2, '0')).join();
|
||||||
//
|
|
||||||
// // Log the hex string
|
// Log the hex string
|
||||||
// _log(text: '原始字节数组: $hexString');
|
_log(text: '原始字节数组: $hexString');
|
||||||
// ProtocolFlag (4 bytes)
|
// ProtocolFlag (4 bytes)
|
||||||
if (bytes.length - offset >= 4) {
|
if (bytes.length - offset >= 4) {
|
||||||
message.ProtocolFlag = utf8.decode(bytes.sublist(offset, offset + 4));
|
message.ProtocolFlag = utf8.decode(bytes.sublist(offset, offset + 4));
|
||||||
|
|||||||
@ -285,7 +285,7 @@ class StartChartManage {
|
|||||||
|
|
||||||
// 发送回声测试消息
|
// 发送回声测试消息
|
||||||
void sendEchoMessage({required List<int> payload}) async {
|
void sendEchoMessage({required List<int> payload}) async {
|
||||||
String toPeerId = '2vzXdjdzipJBpWpJxhiRzCFXrDKk54t3YJ7EjYPSRuij';
|
String toPeerId = '7SDLN3XMNAQvVAJ2yrbLFfJkKQdgfBrpa8wV7s7TXYcu';
|
||||||
|
|
||||||
// 计算需要分多少个包发送
|
// 计算需要分多少个包发送
|
||||||
final int totalPackets = (payload.length / _maxPayloadSize).ceil();
|
final int totalPackets = (payload.length / _maxPayloadSize).ceil();
|
||||||
@ -763,7 +763,8 @@ class StartChartManage {
|
|||||||
_handleUdpResultData(deserialize);
|
_handleUdpResultData(deserialize);
|
||||||
}
|
}
|
||||||
if (deserialize.PayloadType != PayloadTypeConstant.heartbeat) {
|
if (deserialize.PayloadType != PayloadTypeConstant.heartbeat) {
|
||||||
// _log(text: 'Udp收到结构体数据---》$deserialize');
|
_log(text: 'Udp收到结构体数据---》$deserialize');
|
||||||
|
// _log(text: 'text---》${utf8.decode(deserialize.Payload)}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e, stackTrace) {
|
} catch (e, stackTrace) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user