From 4f3eeaef9320cf7a09bf3ca6b77c198c27d32db8 Mon Sep 17 00:00:00 2001 From: weidong Date: Sun, 16 Jun 2024 00:09:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=EF=BC=9A2419385=E4=B8=B2?= =?UTF-8?q?=E5=8F=A31=E7=BB=9F=E8=AE=A1=E6=B2=A1=E6=9C=89=E6=94=B6?= =?UTF-8?q?=E5=88=B0d331=EF=BC=8C=E6=94=B9=E7=94=A8TCP=E6=8E=A8d331?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../executor/D331RtcmMessageExecutor.java | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 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 6918e503..04dcb8f1 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 @@ -7,6 +7,7 @@ import com.imdroid.sideslope.bd.Gga; import com.imdroid.sideslope.message.D331RtcmMessage; import com.imdroid.sideslope.sal.Device; import com.imdroid.sideslope.sal.DeviceService; +import com.imdroid.sideslope.server.DeviceChannel; import com.imdroid.sideslope.server.OnlineChannels; import com.imdroid.sideslope.service.DataPersistService; import io.netty.buffer.ByteBuf; @@ -52,17 +53,27 @@ public class D331RtcmMessageExecutor implements Executor for (Device device : deviceList) { if (device.getOpMode() != GnssDevice.OP_MODE_USE) continue; String deviceId = device.getDeviceId(); - OnlineChannels.INSTANCE.get(deviceId).ifPresent(deviceChannel -> { - if (logger.isDebugEnabled()) { - logger.debug("forward d331 rtcm message to device {}", deviceId); + if(deviceId.equals("2419385")){ + DeviceChannel channel = OnlineChannels.INSTANCE.getConfigChannel(deviceId); + if(channel != null && channel.isOnline()){ + ByteBuf buf = Unpooled.buffer(); + buf.writeBytes(forwardBytes); + channel.writeAndFlush(buf); } - if(deviceId.startsWith("2307")){ - forwardBytes[2] = (byte) (forwardBytes[2]&0x07);//兼容不带序号的测站 - } - ByteBuf buf = Unpooled.buffer(); - buf.writeBytes(forwardBytes); - deviceChannel.writeAndFlush(buf); - }); + } + else { + OnlineChannels.INSTANCE.get(deviceId).ifPresent(deviceChannel -> { + if (logger.isDebugEnabled()) { + logger.debug("forward d331 rtcm message to device {}", deviceId); + } + if (deviceId.startsWith("2307")) { + forwardBytes[2] = (byte) (forwardBytes[2] & 0x07);//兼容不带序号的测站 + } + ByteBuf buf = Unpooled.buffer(); + buf.writeBytes(forwardBytes); + deviceChannel.writeAndFlush(buf); + }); + } } }