From 4aceaded037de1158d8b626204f7cf60a5fe4daa Mon Sep 17 00:00:00 2001 From: yarnom Date: Mon, 17 Nov 2025 17:15:16 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E4=BF=AE=E5=A4=8D1005=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=8F=92=E5=85=A5"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 9336ed819ce1440d9f01c0d1fc4c6b3008862d4e. --- .../executor/D331RtcmMessageExecutor.java | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D331RtcmMessageExecutor.java b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D331RtcmMessageExecutor.java index f09e391c..c6d50d72 100644 --- a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D331RtcmMessageExecutor.java +++ b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D331RtcmMessageExecutor.java @@ -187,17 +187,11 @@ public class D331RtcmMessageExecutor implements Executor buf.writeBytes(forwardBytes); //推送策略:F9P基站(505)兼容博通(510)推送 添加指定基站ID的推送 - // 避免修改共享的 forwardBytes,针对 2307 机型仅修改本次缓冲区 - if (deviceId.startsWith("2307") && buf.readableBytes() > 2) { - buf.setByte(2, (byte) (buf.getByte(2) & 0x07)); - } - if (((deviceBs.getModel()==null || deviceBs.getModel() == GnssDevice.MODEL_G505) && - (device.getModel()!=null && device.getModel()==GnssDevice.MODEL_G510)) - || TARGET_BASE_STATION_ID_FOR_1005.equals(deviceBs.getDeviceId())){ + if ((deviceBs.getModel()==null || deviceBs.getModel() == GnssDevice.MODEL_G505) && + (device.getModel()!=null && device.getModel()==GnssDevice.MODEL_G510)|| + TARGET_BASE_STATION_ID_FOR_1005.equals(deviceBs.getDeviceId())){ buf = insert1005(deviceBs, deviceId, buf); } - // 实际发送到设备通道 - deviceChannel.writeAndFlush(buf); } } @@ -212,11 +206,8 @@ public class D331RtcmMessageExecutor implements Executor //logger.info("Adding D300 string for device: {}", deviceId); // 获取当前buf中的数据 - int readerIndex = buf.readerIndex(); - int readable = buf.readableBytes(); - byte[] originalData = new byte[readable]; - buf.getBytes(readerIndex, originalData); - String originalHex = ByteUtil.bytesToHexString(originalData).toLowerCase(java.util.Locale.ROOT); + byte[] originalData = buf.array(); + String originalHex = ByteUtil.bytesToHexString(originalData); // 找到D300和D301的位置 int d300Index = originalHex.indexOf("d300"); @@ -239,7 +230,7 @@ public class D331RtcmMessageExecutor implements Executor if (insertIndex != -1) { // 创建新的buf - buf1005 = Unpooled.buffer(originalData.length + 64); + buf1005 = Unpooled.buffer(); // 写入D300/D301之前的数据 buf1005.writeBytes(originalData, 0, insertIndex / 2); @@ -261,15 +252,15 @@ public class D331RtcmMessageExecutor implements Executor // 写入剩余的数据 buf1005.writeBytes(originalData, insertIndex / 2, originalData.length - insertIndex / 2); - // 更新最后转发时间(仅在成功插入时) - lastD300ForwardTimeMap.put(deviceId, currentTime); - // 添加日志,记录插入位置和完整数据 // logger.info("Inserted RTCM 1005 message before position {}, complete data: {}", // insertIndex, // ByteUtil.bytesToHexString(buf.array())); } + // 更新最后转发时间 + lastD300ForwardTimeMap.put(deviceId, currentTime); + // 添加日志,记录测站转发的完整数据 //logger.info("Forward data to device: {}, time: {}, complete data: {}", // deviceId,