From 7d55b601b8ec846e9d48ce31de1c5c6930d6dee0 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 19 八月 2025 17:24:35 +0800
Subject: [PATCH] 1、修改等待中间件返回结果超时时间为10秒; 2、修改向水肥机下发命令相关逻辑; 3、修改水肥机回复命令结果处理逻辑; 4、去除前端webSocket关闭产生异常日志记录。
---
pipIrr-platform/pipIrr-mw/pipIrr-mw-simulate-rtu/src/main/java/com/dy/simRtu/tcpClient/upData/UpData.java | 76 ++++++++++++++++++++++++++++++++++++++
1 files changed, 76 insertions(+), 0 deletions(-)
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-simulate-rtu/src/main/java/com/dy/simRtu/tcpClient/upData/UpData.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-simulate-rtu/src/main/java/com/dy/simRtu/tcpClient/upData/UpData.java
new file mode 100644
index 0000000..3db4a2a
--- /dev/null
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-simulate-rtu/src/main/java/com/dy/simRtu/tcpClient/upData/UpData.java
@@ -0,0 +1,76 @@
+package com.dy.simRtu.tcpClient.upData;
+
+import com.dy.common.mw.protocol.p206V1.ProtocolConstantV206V1;
+import com.dy.common.mw.protocol.p206V1.parse.global.GlCreate;
+import com.dy.common.util.ByteUtil;
+import org.apache.mina.core.session.IoSession;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2024/7/15 14:20
+ * @Description
+ */
+public class UpData {
+
+ protected static IoSession session ;
+
+ private static Object synObj = new Object() ;
+
+ public static void setSession(IoSession session){
+ UpData.session = session ;
+ }
+
+ protected static void upSend(byte[] bs) throws Exception{
+ synchronized (synObj){
+ session.write(bs) ;
+ }
+ }
+
+ protected static byte[] creatHead(String rtuAddr, String code, byte ctrl)throws Exception {
+ byte[] bsHead = new byte[ProtocolConstantV206V1.lenHead2Code] ;
+ byte index = 0 ;
+ bsHead[index] = ProtocolConstantV206V1.P_Head_Byte ;
+
+ index++ ;
+ bsHead[index] = 0 ;//甯ч暱搴�
+
+ index++ ;
+ bsHead[index] = ProtocolConstantV206V1.P_Head_Byte ;
+
+ index++ ;
+ bsHead[index] = ctrl; //鎺у埗鍩熷姛鑳界爜
+
+ index++ ;
+ GlCreate.createRtuAddr4P206(rtuAddr, bsHead, index);
+ index += 5 ;
+
+ ByteUtil.hex2Bytes(code, bsHead, index) ;
+
+ return bsHead ;
+ }
+
+ protected static byte[] creatHead4Upgrade(String rtuAddr, String preCode, String sufCode)throws Exception {
+ byte[] bsHead = new byte[12] ;
+ byte index = 0 ;
+ bsHead[index] = ProtocolConstantV206V1.UG_P_Head_Byte ;
+
+ index++ ;
+ bsHead[index] = 0 ;//甯ч暱搴�
+ index++ ;
+ bsHead[index] = 0 ;//甯ч暱搴�
+
+ index++ ;
+ bsHead[index] = ProtocolConstantV206V1.UG_P_Head_Byte ;
+
+ index++ ;
+ bsHead[index] = ByteUtil.hex2Bytes(preCode)[0]; //鍔熻兘鐮佸煙
+
+ index++ ;
+ bsHead[index] = ByteUtil.hex2Bytes(sufCode)[0]; //鍔熻兘鐮佸煙
+
+ index++ ;
+ GlCreate.createRtuAddr4P206(rtuAddr, bsHead, index);
+
+ return bsHead ;
+ }
+}
--
Gitblit v1.8.0