diff --git a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java index 9cb2179..492ecf7 100644 --- a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java +++ b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java @@ -58,19 +58,19 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { //通知客户端链接建立成功 // 默认返回取得时间成功 String ackAckCheckRef = "233E0101020004020A1D"; -// if (Integer.parseInt(nettyServerConfig.getPosAsycServerPort()) == channel.localAddress().getPort()) { -// ackAckCheckRef = "233E010102000401091C"; -// } -// if (Integer.parseInt(nettyServerConfig.getStarsAsycServerPort()) == channel.localAddress().getPort()) { -// ackAckCheckRef = "233E010102000421293C"; -// } - - if (9013 == channel.localAddress().getPort()) { + if (Integer.parseInt(nettyServerConfig.getPosAsycServerPort()) == channel.localAddress().getPort()) { ackAckCheckRef = "233E010102000401091C"; } - if (9012 == channel.localAddress().getPort()) { + if (Integer.parseInt(nettyServerConfig.getStarsAsycServerPort()) == channel.localAddress().getPort()) { ackAckCheckRef = "233E010102000421293C"; } + +// if (9013 == channel.localAddress().getPort()) { +// ackAckCheckRef = "233E010102000401091C"; +// } +// if (9012 == channel.localAddress().getPort()) { +// ackAckCheckRef = "233E010102000421293C"; +// } //String str = "通知客户端链接建立成功" + " " + LocalDateTime.now() + " " + channel.localAddress().getHostString() + // "\r\n"; ByteBuf buf = Unpooled.buffer(ackAckCheckRef.getBytes().length); @@ -107,34 +107,32 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { if (AST_TIME_CMD.equals(recvmg)) { // 初始时间辅助输入; channelAns = dipperTimeAsyncTaskService.pushAstTime(); - buf = Unpooled.buffer(channelAns.getBytes().length); } // 发送SDBP-AST-POS获取辅助位置信息 // if (Integer.parseInt(posAsycServerPort) == channel.localAddress().getPort()) { if (AST_POS_CMD.equals(recvmg)) { -// channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress, -// positionConfig.getCenterProvinceFilePath(), -// positionConfig.getCenterProvince(), -// positionConfig.getIpPositionRequestPath(), -// positionConfig.getIpPositionRequestKey()); channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress, - "/csv/provinceLonAlt.csv", - "湖北省", - "https://restapi.amap.com/v3/ip", - "65e794b0a1a4b87eeec86f93fea05411"); - buf = Unpooled.buffer(channelAns.getBytes().length); + positionConfig.getCenterProvinceFilePath(), + positionConfig.getCenterProvince(), + positionConfig.getIpPositionRequestPath(), + positionConfig.getIpPositionRequestKey()); +// channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress, +// "/csv/provinceLonAlt.csv", +// "湖北省", +// "https://restapi.amap.com/v3/ip", +// "65e794b0a1a4b87eeec86f93fea05411"); } // 从缓存获取SDBP-AST-EPH星历数 //if (Integer.parseInt(starsAsycServerPort) == channel.localAddress().getPort()) { if (AST_POS_CMD.equals(recvmg)) { - String astEPHBytes = dipperDataAsyncTaskService.getAstEPH(); - buf = Unpooled.buffer(astEPHBytes.getBytes().length); + channelAns = dipperDataAsyncTaskService.getAstEPH(); } - log.info(buf.toString()); + log.info(channelAns); + buf = Unpooled.buffer(channelAns.getBytes().length); // 最后把SDBP-AST-TIME、SDBP-AST-POS、SDBP-AST-EPH并包一起发给设备。 // 设备采用16进制获取数据,则代理服务器也是采用16进制返回数据。 // 通知客户端链消息发送成功