diff --git a/config/application-local.properties b/config/application-local.properties
index b018519..be39675 100644
--- a/config/application-local.properties
+++ b/config/application-local.properties
@@ -31,4 +31,4 @@ mybatis.configuration.default-enum-type-handler=com.zjyr.beidouservice.common.Co
#mybatis.configuration.log-impl=lombok.extern.slf4j.Slf4j
#config log
logging.config=file:config/logback.xml
-log4j.logger.org.mybatis=debug
\ No newline at end of file
+#log4j.logger.org.mybatis=debug
\ No newline at end of file
diff --git a/config/application-user.properties b/config/application-user.properties
index 802bc3f..c5eb6b9 100644
--- a/config/application-user.properties
+++ b/config/application-user.properties
@@ -1,3 +1,4 @@
socket.server-host=localhost
socket.server-port=10000
socket.server-mode=tcp
+socket.heart-timeout=60
diff --git a/config/logback.xml b/config/logback.xml
index 64a24bd..9312957 100644
--- a/config/logback.xml
+++ b/config/logback.xml
@@ -4,8 +4,6 @@
-
-
@@ -48,7 +46,7 @@
-
+
diff --git a/src/main/java/com/zjyr/beidouservice/adapter/impl/netty/ChannelInit.java b/src/main/java/com/zjyr/beidouservice/adapter/impl/netty/ChannelInit.java
index 4a4b2a5..a0ba98c 100644
--- a/src/main/java/com/zjyr/beidouservice/adapter/impl/netty/ChannelInit.java
+++ b/src/main/java/com/zjyr/beidouservice/adapter/impl/netty/ChannelInit.java
@@ -3,6 +3,7 @@ package com.zjyr.beidouservice.adapter.impl.netty;
import com.zjyr.beidouservice.adapter.impl.netty.decode.YuanRongProtocolDecode;
import com.zjyr.beidouservice.adapter.impl.netty.encode.ProtocolStartEncode;
import com.zjyr.beidouservice.adapter.impl.netty.encode.YuanRongProtocolEncode;
+import com.zjyr.beidouservice.config.NettySocketConfigure;
import com.zjyr.beidouservice.pojo.vo.binary.BaseBinaryProtocol;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
@@ -53,19 +54,21 @@ public class ChannelInit extends ChannelInitializer {
@Resource
private MessageHandler messageHandler;
+ @Resource
+ private NettySocketConfigure nettySocketConfigure;
+
@Override
protected void initChannel(SocketChannel channel) {
channel.pipeline()
- .addLast("idle", new IdleStateHandler(0, 0, 60, TimeUnit.SECONDS))
- .addLast("decode",
- new LengthFieldBasedFrameDecoder(MAX_FRAME_LENGTH,
+ .addLast(new IdleStateHandler(0, 0, nettySocketConfigure.getHeartTimeout(), TimeUnit.SECONDS))
+ .addLast(new LengthFieldBasedFrameDecoder(MAX_FRAME_LENGTH,
LENGTH_FIELD_OFFSET,
LENGTH_FIELD_LENGTH,
LENGTH_ADJUSTMENT,
INITIAL_BYTES_TO_STRIP))
- .addLast("decodeProtocol", new YuanRongProtocolDecode())
- .addLast("startFlag", new ProtocolStartEncode(2))
- .addLast("encode", new YuanRongProtocolEncode())
+ .addLast(new YuanRongProtocolDecode())
+ .addLast(new ProtocolStartEncode(2))
+ .addLast(new YuanRongProtocolEncode())
.addLast("message", messageHandler);
}
}
diff --git a/src/main/java/com/zjyr/beidouservice/adapter/impl/netty/decode/YuanRongProtocolDecode.java b/src/main/java/com/zjyr/beidouservice/adapter/impl/netty/decode/YuanRongProtocolDecode.java
index 113f317..5e9287e 100644
--- a/src/main/java/com/zjyr/beidouservice/adapter/impl/netty/decode/YuanRongProtocolDecode.java
+++ b/src/main/java/com/zjyr/beidouservice/adapter/impl/netty/decode/YuanRongProtocolDecode.java
@@ -1,11 +1,16 @@
package com.zjyr.beidouservice.adapter.impl.netty.decode;
import com.zjyr.beidouservice.common.CommonEnumHandler;
+import com.zjyr.beidouservice.common.impl.BeidouStatusName;
import com.zjyr.beidouservice.common.impl.ControlCommandName;
+import com.zjyr.beidouservice.common.impl.SendStatusName;
import com.zjyr.beidouservice.common.impl.SensorStatusName;
+import com.zjyr.beidouservice.common.impl.TelphoneStatusName;
+import com.zjyr.beidouservice.common.impl.WirelessStatusName;
import com.zjyr.beidouservice.pojo.vo.binary.BaseBinaryProtocol;
import com.zjyr.beidouservice.pojo.vo.binary.ControllerStatus;
import com.zjyr.beidouservice.pojo.vo.binary.MessageContent;
+import com.zjyr.beidouservice.pojo.vo.binary.SensorCotrolAck;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.channel.ChannelHandlerContext;
@@ -24,61 +29,95 @@ import java.util.List;
@Slf4j
public class YuanRongProtocolDecode extends ByteToMessageDecoder {
@Override
- protected void decode(ChannelHandlerContext channelHandlerContext,
- ByteBuf buf,
- List