From 7f66dd2dee66a81df6ab999fc9daea3ac60a3642 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期一, 20 一月 2025 13:52:44 +0800
Subject: [PATCH] 优化代码
---
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/DriverV202404.java | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 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 6f95d48..c504d5c 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
@@ -2,9 +2,12 @@
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.util.DateTime;
-@AnnotationDriver(name= ProtocolConstantV206V202404.protocolName)
+@AnnotationDriver(enable = true,
+ name= ProtocolConstantV206V202404.protocolName,
+ version= ProtocolConstantV206V202404.protocolVer)
public class DriverV202404 extends Driver {
private static String scanRootPackage = "com.dy.common.mw.protocol.p206V202404" ;
@@ -14,7 +17,6 @@
private ParseParamsForDownV202404 downCpParams ;
private Boolean reportOrResponse_trueOrFalse = null ;
- private String rtuAddrInData = null ;
public DriverV202404(){
upCpParams = new ParseParamsForUpV202404() ;
@@ -33,7 +35,6 @@
this.downCpParams.clear();
}
this.reportOrResponse_trueOrFalse = null ;
- this.rtuAddrInData = null ;
}
/**
@@ -60,13 +61,12 @@
String upCode = null ;
try{
CommonV202404 cp = new CommonV202404() ;
- cp.checkHead(upBuffer) ;
+ Boolean p202404TrueUgFalse = cp.protocolType_p206TrueUgFalse(upBuffer) ;
cp.checkTail(upBuffer) ;
- String crcStr = cp.checkCrc_str(upBuffer) ;
+ String crcStr = cp.checkCrc_str(upBuffer, p202404TrueUgFalse) ;
if(crcStr != null){
return new MidResult[]{(new MidResultError(ProtocolConstantV206V202404.protocolName, rtuAddr, "涓ラ噸閿欒锛屼笂琛屾暟鎹瓹RC妫�鏌ュけ璐ワ紝" + crcStr, null))} ;
}
- rtuAddr = cp.parseRtuAddr(upBuffer) ;
upCode = cp.parseCode(upBuffer) ;
if(upCode == null){
return new MidResult[]{(new MidResultError(ProtocolConstantV206V202404.protocolName, rtuAddr, "涓ラ噸閿欒锛屾湭鑳戒粠涓婅鏁版嵁涓В鏋愬嚭鍔熻兘鐮侊紒", null))} ;
@@ -88,6 +88,7 @@
upData.setSubData(dV201) ;
this.upCpParams.setValue(ProtocolConstantV206V202404.protocolName,
+ ProtocolConstantV206V202404.protocolVer,
rtuAddr,
upCode,
upHex,
@@ -101,7 +102,11 @@
@Override
public void callback(Boolean flag) {
reportOrResponse_trueOrFalse = flag ;
- rtuAddrInData = dV201.getRtuAddr() ;
+ //rtuAddrInData = dV201.getRtuAddr() ;
+ }
+ @Override
+ public void notify(NotifyInfo ...infos) {
+ notify.notify(rtuAddr, ProtocolConstantV206V1.protocolName, ProtocolConstantV206V1.protocolVer, infos);
}
});
}
@@ -136,7 +141,8 @@
this.downCpParams.setValue(
RtuResultSendWebUrl,
- ProtocolConstantV206V202404.protocolName,
+ ProtocolConstantV206V202404.protocolName,
+ command.protocolVersion==null?ProtocolConstantV206V202404.protocolVer:command.protocolVersion,
rtuAddr,
command.getId(),
commandCode,
--
Gitblit v1.8.0