From 85a2968c85ab196eec3c189395f89f8e067701ef Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期三, 07 五月 2025 15:27:50 +0800
Subject: [PATCH] RTU模拟器增加命令92的响应,以测试透传命令。
---
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/DriverV202404.java | 47 +++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/DriverV202404.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/DriverV202404.java
index 9e09ff8..3250f98 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/DriverV202404.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/DriverV202404.java
@@ -1,8 +1,7 @@
package com.dy.common.mw.protocol.p206V202404;
import com.dy.common.mw.protocol.*;
-import com.dy.common.mw.protocol.p206V1.ProtocolConstantV206V1;
-import com.dy.common.mw.protocol.p206V2.ProtocolConstantV206V2;
+import com.dy.common.mw.protocol.p206V202404.parse.TransparentDown;
import com.dy.common.util.DateTime;
@AnnotationDriver(enable = true,
@@ -42,7 +41,7 @@
*/
@Override
public void scanAnnotationCode() throws Exception{
- super.doScanAnnotationCode(this, ProtocolConstantV206V1.protocolName, scanRootPackage) ;
+ super.doScanAnnotationCode(this, ProtocolConstantV206V202404.protocolName, scanRootPackage) ;
}
/**
@@ -108,7 +107,7 @@
}
@Override
public void notify(NotifyInfo ...infos) {
- notify.notify(rtuAddr, ProtocolConstantV206V1.protocolName, ProtocolConstantV206V1.protocolVer, infos);
+ notify.notify(rtuAddr, ProtocolConstantV206V202404.protocolName, ProtocolConstantV206V202404.protocolVer, infos);
}
});
}
@@ -167,4 +166,44 @@
}
+ /**
+ * 鏋勯�犱笅琛岄�忎紶鏁版嵁锛堝懡浠わ級
+ * @param isLowPower 鏄惁鍦ㄤ綆鍔熻�楃幆澧冧笅杩愯
+ * @param command 鍛戒护
+ * @return MidResult[]
+ */
+ @Override
+ public MidResult[] transparentCommand(Boolean isLowPower, Command command, Object... params){
+ this.clear();
+ String RtuResultSendWebUrl = command.getRtuResultSendWebUrl() ;
+ if(RtuResultSendWebUrl == null || RtuResultSendWebUrl.trim().equals("")){
+ return new MidResult[]{(new MidResultError(ProtocolConstantV206V202404.protocolName, null, "涓ラ噸閿欒锛屽懡浠や腑rtu杩斿洖鍛戒护缁撴灉鍙戝悜鐩殑鍦皐eb URL涓虹┖锛屼笉鑳芥瀯寤轰换浣曞懡浠わ紒", null))} ;
+ }
+ String rtuAddr = command.getRtuAddr() ;
+ if(rtuAddr == null || rtuAddr.trim().equals("")){
+ return new MidResult[]{(new MidResultError(ProtocolConstantV206V202404.protocolName, null, "涓ラ噸閿欒锛屽懡浠や腑Rtu鍦板潃涓虹┖锛屼笉鑳芥瀯寤轰换浣曞懡浠わ紒", null))} ;
+ }
+ try {
+ String commandCode = command.getCode() ;
+
+ this.downCpParams.setValue(
+ RtuResultSendWebUrl,
+ ProtocolConstantV206V202404.protocolName,
+ command.protocolVersion==null?ProtocolConstantV206V202404.protocolVer:command.protocolVersion,
+ rtuAddr,
+ command.getId(),
+ commandCode,
+ command.getParam(),
+ command.getAttachment());
+
+ if(commandCode == null){
+ return new MidResult[]{(new MidResultError(ProtocolConstantV206V202404.protocolName, rtuAddr, "涓ラ噸閿欒锛屽懡浠や腑鍔熻兘鐮佷负绌猴紝涓嶈兘鏋勫缓浠讳綍鍛戒护锛�", null))} ;
+ }else{
+ return new TransparentDown().parse(isLowPower, this.downCpParams, null);
+ }
+ } catch (Exception e) {
+ return new MidResult[]{(new MidResultError(ProtocolConstantV206V202404.protocolName, rtuAddr, "涓ラ噸閿欒锛屾瀯閫犱笅琛屾暟鎹嚭閿欙紒鍛戒护涓猴細" + command.toString(), e))} ;
+ }
+ }
+
}
\ No newline at end of file
--
Gitblit v1.8.0