feat: 新增 NtripCaster 数据流推送控制

This commit is contained in:
yarnom 2025-08-22 15:53:29 +08:00
parent 00fa3171ab
commit a5d76073f6
8 changed files with 35 additions and 6 deletions

View File

@ -64,6 +64,8 @@ public class GnssDevice {
private Double iposn; //初始位置
private Double iposd; //初始位置
private Boolean forward_to_ntrip; // 是否转发至NtripCaster默认false
private Double ecefx;
private Double ecefy;
private Double ecefz;

View File

@ -119,9 +119,12 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
}
// 添加NTRIP处理
byte[] srcdata = message.getSrcData();
String rtcm = ByteUtil.bytesToHexString(srcdata);
sendToNtrip(id, rtcm);
if(deviceBs.getForwardToNtrip()) {
byte[] srcdata = message.getSrcData();
String rtcm = ByteUtil.bytesToHexString(srcdata);
sendToNtrip(id, rtcm);
}
ThreadManager.getFixedThreadPool().submit(() -> {
// 原始码流输出到日志文件 -- INFO 级别
@ -264,7 +267,7 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
// 将原始字节转换为16进制字符串用于RTCM提取
//String hexData = ByteUtil.bytesToHexString(rawData);
//System.out.println(hexData);
// 提取RTCM数据并发送到NtripServer,使用设备ID作为挂载点
Optional.ofNullable(RtcmGgaUtil.getRtcms(hexData))
.ifPresent(rtcm -> {

View File

@ -20,6 +20,8 @@ public class UdpNtripServer {
private final Logger logger = LoggerFactory.getLogger(UdpNtripServer.class);
@Value("${ntrip_server.port:9903}")
private Integer port;
@Value("${ntrip_server.host:localhost}")
private String host;
private DatagramSocket socket;
private DatagramPacket outPacket;
@ -33,7 +35,7 @@ public class UdpNtripServer {
try{
//随机端口
if(socket == null) socket = new DatagramSocket();
if(outPacket == null) outPacket = new DatagramPacket(new byte[0],0, InetAddress.getByName("localhost"),port);
if(outPacket == null) outPacket = new DatagramPacket(new byte[0],0, InetAddress.getByName(host),port);
outPacket.setData(encode(ByteUtil.addBytes(mount.getBytes(), ByteUtil.hexStringTobyte(hexRtcm))));
socket.send(outPacket);
}catch (Exception e){

View File

@ -80,7 +80,8 @@ public class Device {
// 日志记录控制
Short loggingmode;
// NtripCaster 推送控制
Boolean forwardToNtrip = false;
int lastRxHead = 0;
int fixedNum = 0;

View File

@ -51,6 +51,7 @@ public class LocalDeviceServiceImpl implements DeviceService {
device.setEcefy(gnssDevice.getEcefy());
device.setEcefz(gnssDevice.getEcefz());
device.setLoggingmode(gnssDevice.getLoggingmode());
device.setForwardToNtrip(gnssDevice.getForward_to_ntrip());
return device;
}

View File

@ -72,6 +72,7 @@ CREATE TABLE IF NOT EXISTS `gnssdevices` (
`has_battery` bit(1) DEFAULT 0 COMMENT '是否内置电池',
`change_flag` int DEFAULT 0 COMMENT '参数改变标识',
`voltage_factor` tinyint DEFAULT NULL COMMENT '分压比',
`forward_to_ntrip` bit(1) DEFAULT 0 COMMENT '用于判断是否发送到NtripCaster',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View File

@ -147,6 +147,7 @@
{field: 'tenantname', title: '所属组织', width: 120},
{field: 'fwd_group_id', title: '推送组', width: 80},
{field: 'fwd_group_id2', title: '推送2', width: 80},
{field: 'forward_to_ntrip', title: '发送至NtripCaster', width: 120, templet: '#ntripTrans'},
{field: 'opmode', title: '使用状态', width: 80,templet: '#modeTrans'},
{field: 'syn', title: '参数同步', width: 80,templet: '#synTrans'},
{field: 'model', title: '型号', width: 80,templet: "<div>{{d.model==0?'G505':'G510'}}</div>"},
@ -289,5 +290,13 @@
{{# } }}
</script>
<script type="text/html" id="ntripTrans">
{{# if(d.forward_to_ntrip == false){ }}
<span class="layui-badge layui-bg-gray"></span>
{{# } else { }}
<span class="layui-badge layui-bg-green"></span>
{{# } }}
</script>
</body>
</html>

View File

@ -127,6 +127,15 @@
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">推送至NtripCaster</label>
<div class="layui-input-inline">
<select name="forward_to_ntrip" id="forward_to_ntrip" th:field="*{forward_to_ntrip}" lay-search="">
<option value="false"></option>
<option value="true"></option>
</select>
</div>
</div>
</div>
<hr>
@ -193,6 +202,7 @@
<input type="text" name="fwddeviceid" id="fwddeviceid" th:field="*{fwddeviceid}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">