diff --git a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java index 73e49e0..86868d7 100644 --- a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java +++ b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java @@ -27,9 +27,12 @@ import java.time.LocalDateTime; @Slf4j public class NettyServerHandler extends ChannelInboundHandlerAdapter { - private static String AST_TIME_CMD = "54494d45"; - private static String AST_POS_CMD = "504f53"; - private static String AST_EPH_CMD = "455048"; + 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_TIME_CMD_BYTE = "54494d45"; + private static String AST_POS_CMD_BYTE = "504f53"; + private static String AST_EPH_CMD_BYTE = "455048"; @Autowired private IDipperAstTimeAsyncTaskService dipperTimeAsyncTaskService; @@ -96,15 +99,16 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { SocketChannel channel = (SocketChannel) ctx.channel(); String ipAddress = channel.remoteAddress().toString(); //String message = " 接收到消息:{0}, 客户端IP:{1}"; - log.info("接收到消息:" + msg + "客户端IP:" + ipAddress); + log.info("接收到消息:" + msg + ",客户端IP:" + ipAddress); String channelAns = ""; // 返回时间指令 //if (Integer.parseInt(timeAsycServerPort) == channel.localAddress().getPort()) { - ByteBuf recvmg = (ByteBuf) msg; + //ByteBuf recvmg = (ByteBuf) msg; ByteBuf buf = null; - String recvmgStr = recvmg.toString(); - if (AST_TIME_CMD.equals(recvmg)) { + //String recvmgStr = recvmg.toString(); + //if (AST_TIME_CMD.equals(recvmg)) { + if (AST_TIME_CMD.equals(msg)) { // 初始时间辅助输入; channelAns = dipperTimeAsyncTaskService.pushAstTime(); } @@ -112,7 +116,8 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { // 发送SDBP-AST-POS获取辅助位置信息 // if (Integer.parseInt(posAsycServerPort) == channel.localAddress().getPort()) { - if (AST_POS_CMD.equals(recvmg)) { + //if (AST_POS_CMD.equals(recvmg)) { + if (AST_TIME_CMD.equals(msg)) { // channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress, // positionConfig.getCenterProvinceFilePath(), // positionConfig.getCenterProvince(), @@ -127,7 +132,8 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { // 从缓存获取SDBP-AST-EPH星历数 //if (Integer.parseInt(starsAsycServerPort) == channel.localAddress().getPort()) { - if (AST_POS_CMD.equals(recvmg)) { + //if (AST_POS_CMD.equals(recvmg)) { + if (AST_POS_CMD.equals(msg)) { channelAns = dipperDataAsyncTaskService.getAstEPH(); }