From cb5972493e140b26afef9edbe1eea6107c65a8d7 Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期二, 15 十月 2024 17:58:33 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
---
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/DriverV202404.java | 33 +++++++++++++++++++++------------
1 files changed, 21 insertions(+), 12 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 08c5eb2..142836d 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,6 +1,7 @@
package com.dy.common.mw.protocol.p206V202404;
import com.dy.common.mw.protocol.*;
+import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0;
import com.dy.common.util.DateTime;
import java.net.URI;
@@ -9,7 +10,7 @@
@AnnotationDriver(name= ProtocolConstantV206V202404.protocolName)
public class DriverV202404 extends Driver {
- private static String scanRootPackage = "com.dy.common.mw.protocol.p206V202404." ;
+ private static String scanRootPackage = "com.dy.common.mw.protocol.p206V202404" ;
//鍦―river涓槸鍗曚緥锛岄殢Driver鐨勫崟渚嬪璞″湪鍗曠嚎绋嬩腑杩愯
private ParseParamsForUpV202404 upCpParams ;
@@ -23,18 +24,27 @@
downCpParams = new ParseParamsForDownV202404() ;
}
+ /**
+ * 娓呯┖鑷繁
+ */
+ @Override
+ public void clear() {
+ if(this.upCpParams != null){
+ this.upCpParams.clear();
+ }
+ if(this.downCpParams != null){
+ this.downCpParams.clear();
+ }
+ this.reportOrResponse_trueOrFalse = null ;
+ this.rtuAddrInData = null ;
+ }
/**
* 鎵弿璇嗗埆鍔熻兘鐮佹敞瑙g被
*/
@Override
public void scanAnnotationCode() throws Exception{
- if(!scanRootPackage.endsWith(".")){
- scanRootPackage += "." ;
- }
- URL url = this.getClass().getResource("/" + scanRootPackage.replace('.', '/'));
- URI uri = new URI(url.toString());
- super.doScanAnnotationCode(this, ProtocolConstantV206V202404.protocolName, uri, scanRootPackage) ;
+ super.doScanAnnotationCode(this, ProtocolConstantV206V1_0_0.protocolName, scanRootPackage) ;
}
/**
@@ -48,7 +58,7 @@
*/
@Override
public MidResult[] parseData(Boolean isLowPower, String rtuAddr, byte[] upBuffer, String upHex, DriverParserDataCallback callback, Object... params) {
- reportOrResponse_trueOrFalse = null ;
+ this.clear();
boolean isFail = false ;
String upCode = null ;
try{
@@ -79,8 +89,7 @@
upData.setSubData(dV1_0_1) ;
- this.upCpParams.clear();
- this.upCpParams.setValue(ProtocolConstantV206V202404.protocolName,
+ this.upCpParams.setValue(ProtocolConstantV206V202404.protocolName,
rtuAddr,
upCode,
upHex,
@@ -103,7 +112,7 @@
isFail = true ;
return new MidResult[]{(new MidResultError(ProtocolConstantV206V202404.protocolName, rtuAddr, "涓ラ噸閿欒锛屽垎鏋怰tu鏁版嵁鍑洪敊锛佹暟鎹负锛�" + upHex + (e.getMessage() == null?"":("锛屽嚭閿欎俊鎭細" + e.getMessage())), e))} ;
} finally{
- callback.callback(rtuAddr, upCode, upHex, reportOrResponse_trueOrFalse, isFail, rtuAddrInData);
+ callback.callback(rtuAddr, upCode, CodeV202404.getCodeName(upCode), upHex, reportOrResponse_trueOrFalse, isFail, rtuAddr);
}
}
@@ -115,6 +124,7 @@
*/
@Override
public MidResult[] createCommand(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))} ;
@@ -126,7 +136,6 @@
try {
String commandCode = command.getCode() ;
- this.downCpParams.clear();
this.downCpParams.setValue(
RtuResultSendWebUrl,
ProtocolConstantV206V202404.protocolName,
--
Gitblit v1.8.0