diff --git a/src/main/java/com/telpo/dipperposition/common/SocketClient.java b/src/main/java/com/telpo/dipperposition/common/SocketClient.java index 3dc7473..b017c6a 100644 --- a/src/main/java/com/telpo/dipperposition/common/SocketClient.java +++ b/src/main/java/com/telpo/dipperposition/common/SocketClient.java @@ -38,7 +38,7 @@ public class SocketClient { } - public byte[] sendCmd(String astCmd, String ackAckCheckRef) { + public String sendCmd(String astCmd, String ackAckCheckRef) { try { OutputStream os=socket.getOutputStream(); PrintWriter pw=new PrintWriter(os); @@ -79,8 +79,8 @@ public class SocketClient { pw.close(); os.close(); //log.debug(ackResult); - log.debug("接收服务器的信息:"+in2b.toString()); - return in2b; + log.debug("接收服务器的信息:"+HexConvert.BinaryToHexString(in2b)); + return HexConvert.BinaryToHexString(in2b); } catch (IOException e) { log.error("Socket sendCmd Error:" + e.getMessage()); return null; diff --git a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java index 193a9ca..c552c23 100644 --- a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java +++ b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java @@ -139,8 +139,8 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { // 从缓存获取SDBP-AST-EPH星历数 //if (Integer.parseInt(starsAsycServerPort) == channel.localAddress().getPort()) { if (AST_POS_CMD.equals(recvmg)) { - byte[] astEPHBytes = dipperDataAsyncTaskService.getAstEPH(); - buf = Unpooled.buffer(astEPHBytes.length); + String astEPHBytes = dipperDataAsyncTaskService.getAstEPH(); + buf = Unpooled.buffer(astEPHBytes.getBytes().length); } diff --git a/src/main/java/com/telpo/dipperposition/service/IDipperDataAsyncTaskService.java b/src/main/java/com/telpo/dipperposition/service/IDipperDataAsyncTaskService.java index ec70f9e..708e6df 100644 --- a/src/main/java/com/telpo/dipperposition/service/IDipperDataAsyncTaskService.java +++ b/src/main/java/com/telpo/dipperposition/service/IDipperDataAsyncTaskService.java @@ -23,6 +23,6 @@ public interface IDipperDataAsyncTaskService { * 根据IP获取EPH * */ - byte[] getAstEPH(); + String getAstEPH(); } diff --git a/src/main/java/com/telpo/dipperposition/service/impl/DipperDataAsyncTaskServiceImpl.java b/src/main/java/com/telpo/dipperposition/service/impl/DipperDataAsyncTaskServiceImpl.java index 72b3a0a..aec944e 100644 --- a/src/main/java/com/telpo/dipperposition/service/impl/DipperDataAsyncTaskServiceImpl.java +++ b/src/main/java/com/telpo/dipperposition/service/impl/DipperDataAsyncTaskServiceImpl.java @@ -32,7 +32,7 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi @Override public void pullAstEPH() { // (1) 发送bds获取星历数据 - byte[] dipperData = pullEPHFromDipper(); + String dipperData = pullEPHFromDipper(); // (2) 获取星历数据 if (dipperData == null) { @@ -44,7 +44,7 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi } - private byte[] pullEPHFromDipper() { + private String pullEPHFromDipper() { // 创建Socket客户端实例; SocketClient client = new SocketClient(schedulingExecutorConfig.getAstServer(), schedulingExecutorConfig.getEphAstHexPort(),schedulingExecutorConfig.getAstTimeout()); @@ -54,7 +54,7 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi String hexIn = astTimeCmd + HexConvert.makeChecksum(astTimeCmd); String ackAckCheckRef = "233E010102000421293C"; - byte[] sendResult = client.sendCmd(hexIn, ackAckCheckRef); + String sendResult = client.sendCmd(hexIn, ackAckCheckRef); client.closeConnection(); return sendResult; @@ -62,7 +62,7 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi @Override @Async("asyncServiceExecutor") - public byte[] getAstEPH(){ - return (byte[])redisUtil.get(DIPPER_DATA_KEY); + public String getAstEPH(){ + return (String)redisUtil.get(DIPPER_DATA_KEY); } }