1、测试:2410207的基站用TCP推数据

This commit is contained in:
weidong 2024-05-03 11:58:56 +08:00
parent 99438b4da4
commit 7713a335bc

View File

@ -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<D331RtcmMessage, Void>
if(device1.getOpMode() == GnssDevice.OP_MODE_USE) {
byte[] forwardBytes = message.getSrcData();
boolean useUDPChannel = true;
if(device1.getDeviceId().equals("2410207")) useUDPChannel = false;
// 要求快速转发因此用缓存不要每次都查数据库
List<Device> 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<D331RtcmMessage, Void>
ByteBuf buf = Unpooled.buffer();
buf.writeBytes(forwardBytes);
deviceChannel.writeAndFlush(buf);
});
}
}
}