From 7713a335bcf217cbefadaec716289ecf81562a7e Mon Sep 17 00:00:00 2001 From: weidong Date: Fri, 3 May 2024 11:58:56 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=B5=8B=E8=AF=95=EF=BC=9A2410207?= =?UTF-8?q?=E7=9A=84=E5=9F=BA=E7=AB=99=E7=94=A8TCP=E6=8E=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sideslope/executor/D331RtcmMessageExecutor.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 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 70a7eb0e..8d876852 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 @@ -3,7 +3,6 @@ package com.imdroid.sideslope.executor; import com.imdroid.secapi.client.BeidouClient; import com.imdroid.secapi.dto.GnssDevice; import com.imdroid.sideslope.bd.Gga; -import com.imdroid.sideslope.calc.GNSSDataCalcService; import com.imdroid.sideslope.message.D331RtcmMessage; import com.imdroid.sideslope.sal.Device; import com.imdroid.sideslope.sal.DeviceService; @@ -45,12 +44,16 @@ public class D331RtcmMessageExecutor implements Executor if(device1.getOpMode() == GnssDevice.OP_MODE_USE) { byte[] forwardBytes = message.getSrcData(); + boolean useUDPChannel = true; + if(device1.getDeviceId().equals("2410207")) useUDPChannel = false; // 要求快速转发,因此用缓存,不要每次都查数据库 List deviceList = deviceService.findByParentId(id); for (Device device : deviceList) { if (device.getOpMode() != GnssDevice.OP_MODE_USE) continue; String deviceId = device.getDeviceId(); - OnlineChannels.INSTANCE.get(deviceId).ifPresent(deviceChannel -> { + DeviceChannel deviceChannel = + useUDPChannel?OnlineChannels.INSTANCE.getDataChannel(deviceId):OnlineChannels.INSTANCE.getConfigChannel(deviceId); + if(deviceChannel!=null) { if (logger.isDebugEnabled()) { logger.debug("forward d331 rtcm message to device {}", deviceId); } @@ -60,7 +63,7 @@ public class D331RtcmMessageExecutor implements Executor ByteBuf buf = Unpooled.buffer(); buf.writeBytes(forwardBytes); deviceChannel.writeAndFlush(buf); - }); + } } }