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