From c66ed1dcf64032a45ba053cd9ae71317d29d1fe3 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 21 一月 2025 14:18:11 +0800
Subject: [PATCH] 针对远程RTU升级,增加快速命令类型,为此增加相关配置,增加相关处理逻辑
---
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/forTcp/TcpDownCommandObj.java | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/forTcp/TcpDownCommandObj.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/forTcp/TcpDownCommandObj.java
index 2ef7e16..7d2fa9b 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/forTcp/TcpDownCommandObj.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/forTcp/TcpDownCommandObj.java
@@ -41,7 +41,7 @@
}
if(this.sendedTimes >= this.result.maxSendTimes){
//鍙戦�佹鏁拌揪鍒版渶澶у��
- if(now - this.lastSendStamp >= ServerProperties.cachWaitResultTimeout){
+ if(now - this.lastSendStamp >= ServerProperties.cacheWaitResultTimeout){
//瓒呮椂
removeNodeFromCach = true ;
//璁板綍鐘舵��
@@ -59,7 +59,7 @@
removeNodeFromCach = true ;
}else{
//涓嶅湪绾垮懡浠ょ紦瀛�
- if(now - this.cachTime >= ServerProperties.offLineCachTimeout){
+ if(now - this.cachTime >= ServerProperties.offLineCacheTimeout){
//缂撳瓨瓒呮椂
removeNodeFromCach = true ;
}
@@ -73,8 +73,15 @@
}
Long lastSendStamp = tcpSe.lastDownComTime ;
- if(this.result.isQuickSend || lastSendStamp == null || (now - lastSendStamp >= ServerProperties.commandSendInterval)){
- //鏈敹鍒板懡浠ょ粨鏋滐紝鏈揪鍒版渶澶у彂閫佹鏁帮紝RTU鍦ㄧ嚎锛岄�熷彂鍛戒护鎴栬秴杩囧懡浠や笅鍙戦棿闅旓紝浠ヤ笂婊¤冻鍙戦�佸懡浠ゆ潯浠讹紝鎵ц鍙戦�佸懡浠�
+ boolean nowSend = false ;
+ if(this.result.isQuickSend || lastSendStamp == null || (this.result.isFastCom && now - lastSendStamp >= ServerProperties.fastCommandSendInterval)){
+ //鏈敹鍒板懡浠ょ粨鏋滐紝鏈揪鍒版渶澶у彂閫佹鏁帮紝RTU鍦ㄧ嚎锛屽綋鍓嶆槸閫熷彂鍛戒护锛屾垨鑰呮槸蹇�熷懡浠よ秴杩囧懡浠や笅鍙戦棿闅旓紝浠ヤ笂婊¤冻鍙戦�佸懡浠ゆ潯浠讹紝鎵ц鍙戦�佸懡浠�
+ nowSend = true ;
+ }else if(this.result.isQuickSend || lastSendStamp == null || (now - lastSendStamp >= ServerProperties.commandSendInterval)) {
+ //鏈敹鍒板懡浠ょ粨鏋滐紝鏈揪鍒版渶澶у彂閫佹鏁帮紝RTU鍦ㄧ嚎锛屽綋鍓嶆槸閫熷彂鍛戒护锛屾垨鑰呮槸鍛戒护瓒呰繃鍛戒护涓嬪彂闂撮殧锛屼互涓婃弧瓒冲彂閫佸懡浠ゆ潯浠讹紝鎵ц鍙戦�佸懡浠�
+ nowSend = true ;
+ }
+ if(nowSend){
tcpSe.ioSession.write(this.result.downBuffer) ;
tcpSe.lastDownComTime = now ;
if(!this.result.hasResponse){
--
Gitblit v1.8.0