From ced270333d68853a2f70114d9fa7ceff5b6ccb79 Mon Sep 17 00:00:00 2001 From: linwl <304115325@qq.com> Date: Thu, 21 Jan 2021 21:18:45 +0800 Subject: [PATCH] =?UTF-8?q?ALL=E6=94=B9=E4=B8=BAall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/NettyServerHandler.java | 2 +- .../DipperAstPosAsyncTaskServiceImpl.java | 39 +++++++++++++++---- .../DipperAstTimeAsyncTaskServiceImpl.java | 30 +++++++------- 3 files changed, 48 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java index eca0d3e..3d062e5 100644 --- a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java +++ b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java @@ -154,7 +154,7 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { log.info(channelAns); if (channelAns != null) { buf = Unpooled.buffer(channelAns.getBytes().length); - buf.writeBytes(channelAns.getBytes("GBK")); + buf.writeBytes(channelAns.getBytes("UTF-8")); ctx.writeAndFlush(buf); } } 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 56c3ea6..f6b4d80 100644 --- a/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java +++ b/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java @@ -210,14 +210,37 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS // 00 2F 为校验和 // astTimeCmd 组装 - String astTimeCmd = "233E0401"; - astTimeCmd += "1000"; - astTimeCmd += HexConvert.encodeHEX(lanLongValue); - astTimeCmd += HexConvert.encodeHEX(altLongValue); - astTimeCmd += "70170000"; - astTimeCmd += "A0860100"; - - return astTimeCmd + HexConvert.makeChecksum(astTimeCmd); + String astTimeCmd = "23 3E 04 01 "; + astTimeCmd += "10 00 "; + byte[] lanBytes = HexConvert.hexStringToBytes(HexConvert.encodeHEX(lanLongValue).toUpperCase()); + + byte[] altBytes = HexConvert.hexStringToBytes(HexConvert.encodeHEX(altLongValue).toUpperCase()); + + StringBuffer lanBuf = new StringBuffer(); + for(int i=0; i