Revert "修复1005无法插入"

This reverts commit 9336ed819ce1440d9f01c0d1fc4c6b3008862d4e.
This commit is contained in:
yarnom 2025-11-17 17:15:16 +08:00
parent 9336ed819c
commit 4aceaded03

View File

@ -187,17 +187,11 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
buf.writeBytes(forwardBytes); buf.writeBytes(forwardBytes);
//推送策略F9P基站505兼容博通510推送 添加指定基站ID的推送 //推送策略F9P基站505兼容博通510推送 添加指定基站ID的推送
// 避免修改共享的 forwardBytes针对 2307 机型仅修改本次缓冲区 if ((deviceBs.getModel()==null || deviceBs.getModel() == GnssDevice.MODEL_G505) &&
if (deviceId.startsWith("2307") && buf.readableBytes() > 2) { (device.getModel()!=null && device.getModel()==GnssDevice.MODEL_G510)||
buf.setByte(2, (byte) (buf.getByte(2) & 0x07)); 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); buf = insert1005(deviceBs, deviceId, buf);
} }
// 实际发送到设备通道
deviceChannel.writeAndFlush(buf);
} }
} }
@ -212,11 +206,8 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
//logger.info("Adding D300 string for device: {}", deviceId); //logger.info("Adding D300 string for device: {}", deviceId);
// 获取当前buf中的数据 // 获取当前buf中的数据
int readerIndex = buf.readerIndex(); byte[] originalData = buf.array();
int readable = buf.readableBytes(); String originalHex = ByteUtil.bytesToHexString(originalData);
byte[] originalData = new byte[readable];
buf.getBytes(readerIndex, originalData);
String originalHex = ByteUtil.bytesToHexString(originalData).toLowerCase(java.util.Locale.ROOT);
// 找到D300和D301的位置 // 找到D300和D301的位置
int d300Index = originalHex.indexOf("d300"); int d300Index = originalHex.indexOf("d300");
@ -239,7 +230,7 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
if (insertIndex != -1) { if (insertIndex != -1) {
// 创建新的buf // 创建新的buf
buf1005 = Unpooled.buffer(originalData.length + 64); buf1005 = Unpooled.buffer();
// 写入D300/D301之前的数据 // 写入D300/D301之前的数据
buf1005.writeBytes(originalData, 0, insertIndex / 2); buf1005.writeBytes(originalData, 0, insertIndex / 2);
@ -261,15 +252,15 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
// 写入剩余的数据 // 写入剩余的数据
buf1005.writeBytes(originalData, insertIndex / 2, originalData.length - insertIndex / 2); buf1005.writeBytes(originalData, insertIndex / 2, originalData.length - insertIndex / 2);
// 更新最后转发时间仅在成功插入时
lastD300ForwardTimeMap.put(deviceId, currentTime);
// 添加日志记录插入位置和完整数据 // 添加日志记录插入位置和完整数据
// logger.info("Inserted RTCM 1005 message before position {}, complete data: {}", // logger.info("Inserted RTCM 1005 message before position {}, complete data: {}",
// insertIndex, // insertIndex,
// ByteUtil.bytesToHexString(buf.array())); // ByteUtil.bytesToHexString(buf.array()));
} }
// 更新最后转发时间
lastD300ForwardTimeMap.put(deviceId, currentTime);
// 添加日志记录测站转发的完整数据 // 添加日志记录测站转发的完整数据
//logger.info("Forward data to device: {}, time: {}, complete data: {}", //logger.info("Forward data to device: {}, time: {}, complete data: {}",
// deviceId, // deviceId,