diff --git a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java index c5b80c1..45f7b9f 100644 --- a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java +++ b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java @@ -28,9 +28,11 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { private static String AST_TIME_CMD = "TIME"; private static String AST_POS_CMD = "POS"; private static String AST_EPH_CMD = "EPH"; + private static String AST_ALL_CMD = "ALL"; private static String AST_TIME_CMD_BYTE = "54494d45"; private static String AST_POS_CMD_BYTE = "504f53"; private static String AST_EPH_CMD_BYTE = "455048"; + private static String AST_ALL_CMD_BYTE = "616C6C"; @Autowired private PositionConfig positionConfig; @@ -140,17 +142,21 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { channelAns = nettyServerHandler.dipperDataAsyncTaskService.getAstEPH(); } + // 最后把SDBP-AST-TIME、SDBP-AST-POS、SDBP-AST-EPH并包一起发给设备。 + // 设备采用16进制获取数据,则代理服务器也是采用16进制返回数据。 + // 通知客户端链消息发送成功 + if (AST_ALL_CMD.equals(msg)) { + channelAns = nettyServerHandler.dipperTimeAsyncTaskService.pushAstTime(); + channelAns += nettyServerHandler.dipperAstPosAsyncTaskService.pushAstPos(ipAddress); + channelAns += nettyServerHandler.dipperDataAsyncTaskService.getAstEPH(); + } + log.info(channelAns); if (channelAns != null) { buf = Unpooled.buffer(channelAns.getBytes().length); buf.writeBytes(channelAns.getBytes("GBK")); ctx.writeAndFlush(buf); } - // 最后把SDBP-AST-TIME、SDBP-AST-POS、SDBP-AST-EPH并包一起发给设备。 - // 设备采用16进制获取数据,则代理服务器也是采用16进制返回数据。 - // 通知客户端链消息发送成功 - //ctx.write("你也好哦"); - //ctx.flush(); } /** diff --git a/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java b/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java index 8de6387..56c3ea6 100644 --- a/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java +++ b/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java @@ -205,7 +205,8 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS // 70 32 9C 43 表示注入的辅助经度为 113.431 度 // D0 B2 CE 0D 表示注入的辅助纬度为 23.165 度 // 70 17 00 00 表示注入的辅助高度为 60 米 - // 40 0D 03 00 表示注入的位置精度为 2000 米 + // 40 0D 03 00 表示注入的位置精度为 2000 米 030d40 + // A0 86 01 00 表示注入的位置精度为 1000 米 0186a0 // 00 2F 为校验和 // astTimeCmd 组装 @@ -214,7 +215,7 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS astTimeCmd += HexConvert.encodeHEX(lanLongValue); astTimeCmd += HexConvert.encodeHEX(altLongValue); astTimeCmd += "70170000"; - astTimeCmd += "400D0300"; + astTimeCmd += "A0860100"; return astTimeCmd + HexConvert.makeChecksum(astTimeCmd); diff --git a/src/main/java/com/telpo/dipperposition/service/impl/DipperAstTimeAsyncTaskServiceImpl.java b/src/main/java/com/telpo/dipperposition/service/impl/DipperAstTimeAsyncTaskServiceImpl.java index 734aefd..c5bf044 100644 --- a/src/main/java/com/telpo/dipperposition/service/impl/DipperAstTimeAsyncTaskServiceImpl.java +++ b/src/main/java/com/telpo/dipperposition/service/impl/DipperAstTimeAsyncTaskServiceImpl.java @@ -40,6 +40,7 @@ public class DipperAstTimeAsyncTaskServiceImpl implements IDipperAstTimeAsyncTas // 14 表示 20 日 // 0C 22 38 00 00 00 00 00 表示 UTC时间,为12时34分56.0秒(小数秒建议固定为 0) // 00 28 6B EE 表示 4 秒的时间精度(十六进制 EE6B2800 转为十进制为 4000000000,乘以比 例因子 10-9就是 4 秒) + // 00 5E D0 B2 表示 3 秒的时间精度(十六进制 B2 D0 5E 00 转为十进制为3000000000,乘以比 例因子 10-9就是 3 秒 小端模式00 5E D0 B2) // 00 2F 为校验和 // TODO astTimeCmd 组装 String astTimeCmd = "233E0402"; @@ -80,7 +81,7 @@ public class DipperAstTimeAsyncTaskServiceImpl implements IDipperAstTimeAsyncTas } astTimeCmd += hexSecondString; astTimeCmd += "0000000000"; - astTimeCmd += "00286BEE"; + astTimeCmd += "005ED0B2"; String hexIn = astTimeCmd + HexConvert.makeChecksum(astTimeCmd); log.info("DipperAstTimeAsyncTaskServiceImpl 返回时间:" + hexIn);