From b2abd25927c39e849e592f1abdc08879d8d35245 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期三, 07 五月 2025 09:48:39 +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/p206V1/DriverV1.java | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 48 insertions(+), 4 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/DriverV1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/DriverV1.java index 2d4b816..b6a4038 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/DriverV1.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/DriverV1.java @@ -1,9 +1,12 @@ package com.dy.common.mw.protocol.p206V1; import com.dy.common.mw.protocol.*; +import com.dy.common.mw.protocol.p206V1.parse.TransparentDown; import com.dy.common.util.DateTime; -@AnnotationDriver(enable = true, name= ProtocolConstantV206V1.protocolName) +@AnnotationDriver(enable = true, + name= ProtocolConstantV206V1.protocolName, + version= ProtocolConstantV206V1.protocolVer) public class DriverV1 extends Driver { private static String scanRootPackage = "com.dy.common.mw.protocol.p206V1" ; @@ -57,6 +60,7 @@ this.clear(); boolean isFail = false ; String upCode = null ; + Object[] codeDataGrp = {null}; try{ CommonV1 cp = new CommonV1() ; Boolean p206TrueUgFalse = cp.protocolType_p206TrueUgFalse(upBuffer) ; @@ -98,23 +102,24 @@ }else{ return codeParse.parse(isLowPower, this.upCpParams, new CodeParseCallback(){ @Override - public void callback(Boolean flag) { + public void callback(Boolean flag, Object codeData) { reportOrResponse_trueOrFalse = flag ; rtuAddrInData = dV1.getRtuAddr() ; + codeDataGrp[0] = codeData ; } @Override public void notify(NotifyInfo ...infos) { + notify.notify(rtuAddr, ProtocolConstantV206V1.protocolName, ProtocolConstantV206V1.protocolVer, infos); } }); } - } catch (Exception e) { isFail = true ; return new MidResult[]{(new MidResultError(ProtocolConstantV206V1.protocolName, rtuAddr, "涓ラ噸閿欒锛屽垎鏋怰tu鏁版嵁鍑洪敊锛佹暟鎹负锛�" + upHex + (e.getMessage() == null?"":("锛屽嚭閿欎俊鎭細" + e.getMessage())), e))} ; } finally{ if(upCode != null){ //CRC楠岃瘉澶辫触鏃讹紝upCode涓簄ull锛屾鏃朵笉杩涜鍥炶皟 - callback.callback(rtuAddr, upCode, CodeV1.getCodeName(upCode), upHex, reportOrResponse_trueOrFalse, isFail, rtuAddr); + callback.callback(rtuAddr, upCode, CodeV1.getCodeName(upCode), upHex, reportOrResponse_trueOrFalse, isFail, rtuAddr, codeDataGrp[0]); } } } @@ -164,5 +169,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(ProtocolConstantV206V1.protocolName, null, "涓ラ噸閿欒锛屽懡浠や腑rtu杩斿洖鍛戒护缁撴灉鍙戝悜鐩殑鍦皐eb URL涓虹┖锛屼笉鑳芥瀯寤轰换浣曞懡浠わ紒", null))} ; + } + String rtuAddr = command.getRtuAddr() ; + if(rtuAddr == null || rtuAddr.trim().equals("")){ + return new MidResult[]{(new MidResultError(ProtocolConstantV206V1.protocolName, null, "涓ラ噸閿欒锛屽懡浠や腑Rtu鍦板潃涓虹┖锛屼笉鑳芥瀯寤轰换浣曞懡浠わ紒", null))} ; + } + try { + String commandCode = command.getCode() ; + + this.downCpParams.setValue( + RtuResultSendWebUrl, + ProtocolConstantV206V1.protocolName, + command.protocolVersion==null?ProtocolConstantV206V1.protocolVer:command.protocolVersion, + rtuAddr, + command.getId(), + commandCode, + command.getParam(), + command.getAttachment()); + + if(commandCode == null){ + return new MidResult[]{(new MidResultError(ProtocolConstantV206V1.protocolName, rtuAddr, "涓ラ噸閿欒锛屽懡浠や腑鍔熻兘鐮佷负绌猴紝涓嶈兘鏋勫缓浠讳綍鍛戒护锛�", null))} ; + }else{ + return new TransparentDown().parse(isLowPower, this.downCpParams, null); + } + } catch (Exception e) { + return new MidResult[]{(new MidResultError(ProtocolConstantV206V1.protocolName, rtuAddr, "涓ラ噸閿欒锛屾瀯閫犱笅琛屾暟鎹嚭閿欙紒鍛戒护涓猴細" + command.toString(), e))} ; + } + } } \ No newline at end of file -- Gitblit v1.8.0