|
|
@@ -3,7 +3,6 @@ package com.zd.laboratory.netty;
|
|
|
import com.zd.common.core.alert.DingTalkAlert;
|
|
|
import com.zd.common.core.redis.RedisService;
|
|
|
import com.zd.common.core.utils.DateUtils;
|
|
|
-import com.zd.common.core.utils.ReUtil;
|
|
|
import com.zd.common.core.utils.SpringUtils;
|
|
|
import com.zd.laboratory.domain.LabAbnormal;
|
|
|
import com.zd.laboratory.domain.LabHardware;
|
|
|
@@ -12,6 +11,8 @@ import com.zd.laboratory.mapper.LabAbnormalMapper;
|
|
|
import com.zd.laboratory.mapper.LabHardwareMapper;
|
|
|
import com.zd.laboratory.socket.runner.TCPServer;
|
|
|
import com.zd.laboratory.utils.CRCCHECK;
|
|
|
+import io.netty.channel.ChannelFuture;
|
|
|
+import io.netty.channel.ChannelFutureListener;
|
|
|
import io.netty.channel.ChannelHandlerContext;
|
|
|
import io.netty.channel.ChannelInboundHandler;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -44,8 +45,8 @@ public class NettyServerHandler implements ChannelInboundHandler {
|
|
|
log.info("netty服务端接受消息转10进制为:" + ByteBuffer.wrap(msg).getLong());
|
|
|
// if(data.startsWith(SocketTypes.LOCK_PREFIX)){
|
|
|
// if(data.startsWith("33")){
|
|
|
-
|
|
|
- String relayCode = data.substring(0, 108);
|
|
|
+// 323020333320333320323020333320333320
|
|
|
+ String relayCode = data.substring(0, 36);
|
|
|
// 33 31 20 33 30 20 36 33 20 33 36 20 36 34 20 33 37 20 33 36 20 33 33 20 33 31 20 33 35 20 33 31 20 33 35 20 33 30 20 36 33 20 33 33 20 33 35 20 33 32 20 33 37 20
|
|
|
|
|
|
// 05 05 00 01 ee 00 d0 2e
|
|
|
@@ -92,22 +93,19 @@ public class NettyServerHandler implements ChannelInboundHandler {
|
|
|
*/
|
|
|
@Override
|
|
|
public void channelReadComplete(ChannelHandlerContext channelHandlerContext) throws Exception {
|
|
|
- String instruct = CRCCHECK.getOpenLockOrder(1);
|
|
|
-
|
|
|
- byte[] bytes = ReUtil.hexStringToByteArray(instruct);
|
|
|
-// log.info("netty服务端数据发送数据:" + instruct);
|
|
|
-// ChannelFuture channelFuture = channelHandlerContext.writeAndFlush(bytes);
|
|
|
-// ChannelFuture channelFuture = channelHandlerContext.writeAndFlush(instruct);
|
|
|
-// channelFuture.addListener(new ChannelFutureListener() {
|
|
|
-// @Override
|
|
|
-// public void operationComplete(ChannelFuture channelFuture) throws Exception {
|
|
|
-// if(channelFuture.isSuccess()){
|
|
|
-// log.info("服务端数据发送成功");
|
|
|
-// }else{
|
|
|
-// log.info("服务端数据发送失败");
|
|
|
-// }
|
|
|
-// }
|
|
|
-// });
|
|
|
+
|
|
|
+ log.info("netty服务端数据发送数据:" + NettyServer.inetPort);
|
|
|
+ ChannelFuture channelFuture = channelHandlerContext.writeAndFlush(NettyServer.inetPort);
|
|
|
+ channelFuture.addListener(new ChannelFutureListener() {
|
|
|
+ @Override
|
|
|
+ public void operationComplete(ChannelFuture channelFuture) throws Exception {
|
|
|
+ if(channelFuture.isSuccess()){
|
|
|
+ log.info("服务端数据发送成功");
|
|
|
+ }else{
|
|
|
+ log.info("服务端数据发送失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|