diff --git a/sec-api/src/main/java/com/imdroid/secapi/client/RtcmClient.java b/sec-api/src/main/java/com/imdroid/secapi/client/RtcmClient.java index 7212ee59..2781e2b0 100644 --- a/sec-api/src/main/java/com/imdroid/secapi/client/RtcmClient.java +++ b/sec-api/src/main/java/com/imdroid/secapi/client/RtcmClient.java @@ -9,6 +9,9 @@ public interface RtcmClient { @PostMapping("/config") HttpResp config(@RequestParam(name = "deviceId") String deviceId, @RequestParam(name = "configuration") String configData); + @PostMapping("/config_by_udp") + HttpResp configByUdp(@RequestParam(name = "deviceId") String deviceId, @RequestParam(name = "configuration") String configData); + @PostMapping("/device_param_changed") HttpResp deviceParamChanged(@RequestParam(name = "deviceId") String deviceId,@RequestParam(name = "oldParentId") String oldParentId); diff --git a/sec-beidou-fwd/pom.xml b/sec-beidou-fwd/pom.xml index 1c56e2f1..031a6412 100644 --- a/sec-beidou-fwd/pom.xml +++ b/sec-beidou-fwd/pom.xml @@ -114,15 +114,7 @@ - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - 11 - 11 - - + diff --git a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/bd/FocusCalculator7.java b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/bd/FocusCalculator7.java index 5fb77415..821c78b7 100644 --- a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/bd/FocusCalculator7.java +++ b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/bd/FocusCalculator7.java @@ -2,13 +2,16 @@ package com.imdroid.sideslope.bd; import com.imdroid.sideslope.sal.Device; +import static com.imdroid.sideslope.bd.GeoCoordConverterUtil.ECEF2ENU; +import static com.imdroid.sideslope.bd.GeoCoordConverterUtil.LLA2ECEF; + /** * 博通:用GGA绝对坐标代替相对位置 */ public class FocusCalculator7 extends FocusCalculator3{ - final static long scale = 100000000L;//地球1°:111km,放大到mm乘以100,000,000 + //final static long scale = 100000000L;//地球1°:111km,放大到mm乘以100,000,000 final static int bad_change_mm = 500;//固定解跳变连续10次超过500mm,认为是周跳 final static int bad_duration = 10; @@ -18,7 +21,7 @@ public class FocusCalculator7 extends FocusCalculator3{ super(bsDevice); } - @Override + /*@Override public void addGGA(Gga gga) { if(gga == null) return; @@ -41,6 +44,55 @@ public class FocusCalculator7 extends FocusCalculator3{ } else if(gga.getQuality() == 5) counterNoFixed++; else counterNoB562 ++; + }*/ + + @Override + public void addGGA(Gga gga) { + if(gga == null) return; + double[] end; + + // 测站的GGA - 测站 LLA 数据 + GeoCoordConverterUtil.LLA_Coordinate rover_lla = new GeoCoordConverterUtil.LLA_Coordinate(gga.getLatitude(),gga.getLongitude(),gga.getAltitude()); + // 测站 LLA 坐标转 ECEF 坐标,单位米 + GeoCoordConverterUtil.ECEF_Coordinate rover_ecef = LLA2ECEF(rover_lla); + + if(bsDevice==null || bsDevice.getEcefx()==null){ + end = new double[]{ + rover_ecef.getECEF_X()*1000, + rover_ecef.getECEF_Y()*1000, + rover_ecef.getECEF_Z()*1000, + gga.getQuality()}; + } + else { + // 查询测站的绑定的基站 + GeoCoordConverterUtil.ECEF_Coordinate reference_ecef = new GeoCoordConverterUtil.ECEF_Coordinate(bsDevice.getEcefx(), bsDevice.getEcefy(), bsDevice.getEcefz()); + + // 以基站为站心的 ENU 坐标 + GeoCoordConverterUtil.ENU_Coordinate difference_enu = ECEF2ENU(reference_ecef, rover_ecef); + end = new double[]{ + difference_enu.ENU_E*1000, + difference_enu.ENU_N*1000, + difference_enu.ENU_U*1000, + gga.getQuality()}; + } + + if(gga.isFixed()) { + counterFixedResult++; + if(pointList.size()>0){ + double[] lastXyz = pointList.get(pointList.size()-1); + if(Math.abs(end[0]-lastXyz[0])>bad_change_mm || + Math.abs(end[1]-lastXyz[1])>bad_change_mm || + Math.abs(end[2]-lastXyz[2])>bad_change_mm){ + bad_count++; + return; + } + } + bad_count = 0; + + pointList.add(end); + } + else if(gga.getQuality() == 5) counterNoFixed++; + else counterNoB562 ++; } @Override diff --git a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D3F0SelfCheckMessageExecutor.java b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D3F0SelfCheckMessageExecutor.java index 22f7c6b8..aad86465 100644 --- a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D3F0SelfCheckMessageExecutor.java +++ b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D3F0SelfCheckMessageExecutor.java @@ -49,6 +49,9 @@ public class D3F0SelfCheckMessageExecutor implements Executor=8){ + long lastActiveDate = src.readUnsignedInt(); + long lastActiveTime = src.readUnsignedInt(); + short year = (short) ((lastActiveDate>>16)&0xFF); + short month = (short) ((lastActiveDate>>8)&0xFF); + short day = (short) (lastActiveDate&0xFF); + byte hour = (byte) (lastActiveTime/3600); + byte munite = (byte) (lastActiveTime/60 - hour*60); + auxInfo = auxInfo + " last active time:"+ + year+"-"+month+"-"+day+" "+hour+":"+munite; + } + if(src.readableBytes()>=14){ + int uart1Exception = src.readUnsignedShort(); + int uart2Exception = src.readUnsignedShort(); + int dtuException = src.readUnsignedShort(); + long lastDtuErrDate = src.readUnsignedInt(); + long lastDtuErrTime = src.readUnsignedInt(); + if(uart1Exception>0) { + auxInfo = auxInfo + " uart1 err: "+uart1Exception; + } + if(uart2Exception>0) { + auxInfo = auxInfo + " uart2 err: "+uart2Exception; + } + if(lastDtuErrDate!=0){ + auxInfo = auxInfo + " last dtu err state: "+dtuException; + short year = (short) ((lastDtuErrDate>>16)&0xFF); + short month = (short) ((lastDtuErrDate>>8)&0xFF); + short day = (short) (lastDtuErrDate&0xFF); + byte hour = (byte) (lastDtuErrTime/3600); + byte munite = (byte) (lastDtuErrTime/60 - hour*60); + auxInfo = auxInfo + " time: "+ + year+"-"+month+"-"+day+" "+hour+":"+munite; + } + } // read 会移动 bytebuf 的指针,所以保存原始码流需要将此指针挑拨回开始处 src.readerIndex(0); diff --git a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/server/udp/RtcmUdpHandler.java b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/server/udp/RtcmUdpHandler.java index d5596fe1..cfcefb89 100644 --- a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/server/udp/RtcmUdpHandler.java +++ b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/server/udp/RtcmUdpHandler.java @@ -32,11 +32,11 @@ public class RtcmUdpHandler extends ChannelInboundHandlerAdapter { if (packet.content() == null) { return; } - if (logger.isDebugEnabled()) { + /*if (logger.isDebugEnabled()) { byte[] data = new byte[packet.content().readableBytes()]; packet.content().getBytes(0, data); logger.debug("receive message:" + DataTypeUtil.getHexString(data)); - } + }*/ // 消息解析 BaseMessage message = MessageParser.instance.parse(packet.content()); OnlineChannels.INSTANCE.updateDataChannel(message.getId(), ctx.channel(), packet.sender()); diff --git a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/web/ApiController.java b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/web/ApiController.java index 33c5a929..5fbc2585 100644 --- a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/web/ApiController.java +++ b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/web/ApiController.java @@ -70,6 +70,33 @@ public class ApiController { return resp; } + @PostMapping(value = "/config_by_udp") + public HttpResp configByUdp(String deviceId, String configuration) { + Map status = new HashMap<>(); + HttpResp resp = new HttpResp(); + DeviceChannel deviceChannel = OnlineChannels.INSTANCE.getDataChannel(deviceId); + + if(deviceChannel!=null){ + status.put("status", "Online"); + // send command + ByteBuf buf = Unpooled.buffer(); + byte[] data = getBinaryData(ConfigDataTypeEnum.HEX, configuration); + logger.info("send command:{}", configuration); + buf.writeBytes(data); + deviceChannel.writeAndFlush(buf); + } + + if (status.isEmpty()) { + status.put("status", "Offline"); + resp.setCode(HttpResp.HTTP_RSP_FAILED); + resp.setResponseMessage("Offline."); + } else { + resp.setResponseMessage("Command sent."); + } + resp.setResponseObject(status); + return resp; + } + @PostMapping("/device_param_changed") public HttpResp deviceParamChanged(String deviceId, String oldParentId) { // 更新设备缓存 diff --git a/sec-beidou-rtcm/src/main/resources/logback.xml b/sec-beidou-rtcm/src/main/resources/logback.xml index 1742b9e7..f8735b8b 100644 --- a/sec-beidou-rtcm/src/main/resources/logback.xml +++ b/sec-beidou-rtcm/src/main/resources/logback.xml @@ -20,7 +20,7 @@ - + diff --git a/sec-beidou/pom.xml b/sec-beidou/pom.xml index d14c4b5e..ba7c6cf7 100644 --- a/sec-beidou/pom.xml +++ b/sec-beidou/pom.xml @@ -155,7 +155,7 @@ - org.apache.maven.pluginsmaven-compiler-plugin1111 + diff --git a/sec-beidou/src/main/java/com/imdroid/beidou/controller/CmdLineController.java b/sec-beidou/src/main/java/com/imdroid/beidou/controller/CmdLineController.java index 2ab43766..35c97520 100644 --- a/sec-beidou/src/main/java/com/imdroid/beidou/controller/CmdLineController.java +++ b/sec-beidou/src/main/java/com/imdroid/beidou/controller/CmdLineController.java @@ -60,7 +60,8 @@ public class CmdLineController extends BasicController{ public HttpResult configCmd(HttpSession session, @RequestParam("tx_win") String cmd, @RequestParam("device_id") String deviceId, - @RequestParam("cmd_type") int cmdType) { + @RequestParam("cmd_type") int cmdType, + @RequestParam("send_channel") int sendChannel) { String sendCmd = cmd.replaceAll(" +",""); short len = 0; int msgType = 0xD310 + cmdType; @@ -75,7 +76,10 @@ public class CmdLineController extends BasicController{ sendCmd = Integer.toHexString(msgType) + HexUtil.Short2HexString(len)+ HexUtil.Int2HexString(Integer.parseInt(deviceId))+sendCmd; } - HttpResp> rsp = rtcmClient.config(deviceId,sendCmd); + HttpResp> rsp; + if(sendChannel == 0) + rsp = rtcmClient.config(deviceId,sendCmd); + else rsp = rtcmClient.configByUdp(deviceId,sendCmd); String txInfo = "TX "+ dateFormat.format(System.currentTimeMillis())+ " "+deviceId+" "+sendCmd; diff --git a/sec-beidou/src/main/resources/db/schema.sql b/sec-beidou/src/main/resources/db/schema.sql index 3dc7f2dd..4b3a28ce 100644 --- a/sec-beidou/src/main/resources/db/schema.sql +++ b/sec-beidou/src/main/resources/db/schema.sql @@ -321,17 +321,3 @@ CREATE TABLE IF NOT EXISTS `ApiKey` ( `tenantname` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `gnssdevicesinglerecords` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `deviceid` varchar(64) NOT NULL COMMENT '设备ID', - `createtime` datetime(3) NOT NULL COMMENT '创建时间', - `model` smallint NOT NULL COMMENT '设备型号: 0-F9P(G505), 1-博通(G510)', - `x` double NOT NULL COMMENT 'GGA时是latitude, ECEF时是x', - `y` double NOT NULL COMMENT 'GGA时是longitude, ECEF时是y', - `z` double NOT NULL COMMENT 'GGA时是altitude, ECEF时是z', - `status` int NOT NULL DEFAULT '0' COMMENT 'GGA: 0初始化,1单点定位,2码差分,3无效PPS,4固定解,5浮点解,6估算,7人工固定,8模拟,9WAAS差分; ECEF: 0无B562,1浮点解,2固定解', - PRIMARY KEY (`id`), - KEY `idx_deviceid_createtime` (`deviceid`,`createtime`), - KEY `idx_createtime` (`createtime`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='GNSS单次解算记录表'; \ No newline at end of file diff --git a/sec-beidou/src/main/resources/templates/page/cmd_line.html b/sec-beidou/src/main/resources/templates/page/cmd_line.html index 2e1eef13..95c25382 100644 --- a/sec-beidou/src/main/resources/templates/page/cmd_line.html +++ b/sec-beidou/src/main/resources/templates/page/cmd_line.html @@ -53,6 +53,15 @@ +
+ +
+ +
+
diff --git a/sec-beidou/src/main/resources/templates/page/gnss_dev_cfg.html b/sec-beidou/src/main/resources/templates/page/gnss_dev_cfg.html index 8d9064ff..75a5563e 100644 --- a/sec-beidou/src/main/resources/templates/page/gnss_dev_cfg.html +++ b/sec-beidou/src/main/resources/templates/page/gnss_dev_cfg.html @@ -123,6 +123,9 @@ if([[${role}]] == "USER") { cfg_cols[15].hide = true; } + if([[${tenant_id}]] != 0) { + cfg_cols[10].hide = true; + } /** * 初始化表单,要加上,不然刷新部分组件可能会不加载 */ diff --git a/sec-beidou/src/main/resources/templates/page/operation_log.html b/sec-beidou/src/main/resources/templates/page/operation_log.html index e1406c5c..c49eec5f 100644 --- a/sec-beidou/src/main/resources/templates/page/operation_log.html +++ b/sec-beidou/src/main/resources/templates/page/operation_log.html @@ -24,6 +24,12 @@
+
+ +
+ +
+
diff --git a/sec-test-device/pom.xml b/sec-test-device/pom.xml index 271a8f75..a3596c3d 100644 --- a/sec-test-device/pom.xml +++ b/sec-test-device/pom.xml @@ -100,14 +100,7 @@ - - org.apache.maven.plugins - maven-compiler-plugin - - 11 - 11 - - + diff --git a/sec-test-device/src/main/resources/application.properties b/sec-test-device/src/main/resources/application.properties index 9ac62967..fa848559 100644 --- a/sec-test-device/src/main/resources/application.properties +++ b/sec-test-device/src/main/resources/application.properties @@ -20,3 +20,5 @@ app.format.time = HH:mm:ss app.format.datetime = yyyy-MM-dd HH:mm:ss mybatis-plus.configuration.map-underscore-to-camel-case=false + +netty.test.port = 9917 \ No newline at end of file