Compare commits

..

No commits in common. "f81e541cad18425ee26e005d44498ad93352cb5d" and "9336ed819ce1440d9f01c0d1fc4c6b3008862d4e" have entirely different histories.

View File

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