From 8c4a723ff13e34152934b84c52267615c4e0fb8b Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期五, 06 十二月 2024 10:22:34 +0800
Subject: [PATCH] 升级模拟器增加上报81数据,为上报阀门状态,用81数据代替心跳
---
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/DataCodecFactory.java | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/DataCodecFactory.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/DataCodecFactory.java
index 417bda2..284dcb6 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/DataCodecFactory.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/DataCodecFactory.java
@@ -8,16 +8,32 @@
public class DataCodecFactory implements ProtocolCodecFactory {
private TcpUnitAdapter adapter ;
-
+ private boolean stop = false ;//涓簍rue鏃讹紝鍋滄TCP鏈嶅姟锛屽苟鎶婂凡缁廡CP杩炴帴鏂繛鎺�
+
public DataCodecFactory(TcpUnitAdapter adapter) {
this.adapter = adapter ;
}
+ public void stop(){
+ stop = true ;
+ }
+
+ public void recover(){
+ this.stop = false ;
+ }
+
+
public ProtocolEncoder getEncoder(IoSession ioSession) {
+ if(stop){
+ ioSession.closeNow() ;
+ }
return new DataEncoder();
}
public ProtocolDecoder getDecoder(IoSession ioSession) {
+ if(stop){
+ ioSession.closeNow() ;
+ }
return new DataDecoder(adapter.newPrefixedDataAvailableHandle());
}
}
--
Gitblit v1.8.0