From b35eadd37354ba8b2c1d17d5a744eef5164ba5ad Mon Sep 17 00:00:00 2001 From: Administrator <zhubaomin> Date: 星期五, 29 十二月 2023 14:08:07 +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_0_0/parse/Cd_71_Up.java | 65 ++++++++++++++++++++++++++++++++ 1 files changed, 65 insertions(+), 0 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Up.java new file mode 100644 index 0000000..69e36a4 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Up.java @@ -0,0 +1,65 @@ +package com.dy.common.mw.protocol.p206V1_0_0.parse; + +import com.dy.common.mw.protocol.*; +import com.dy.common.mw.protocol.p206V1_0_0.*; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +@AnnotationCodeUp(ifAny={ + CodeV1_0_1.cd_71 +}) +@SuppressWarnings("unused") +public class Cd_71_Up implements CodeParse { + + private static final Logger log = LogManager.getLogger(Cd_71_Up.class); + + /** + * 鍒嗘瀽涓婅鏁版嵁 + */ + @Override + public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { + ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; + int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; + if(bsLen > 0){ + this.doParse(para.upBuffer, + bsLen, + para.upCode, + para.data) ; + } + log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU鍦板潃=" + para.rtuAddr + ">:\n" + para.data.toString()); + + MidResultFromRtu midRs = new MidResultFromRtu() ; + midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О + midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃 + midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮� + midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡 + midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍 + midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁 + + midRs.reportOrResponse_trueOrFalse = false ;//涓诲姩涓婃姤 + + callback.callback(midRs.reportOrResponse_trueOrFalse); + return new MidResult[]{midRs} ; + } + /** + * 鎵ц鍒嗘瀽 + * @param bs 瀛楄妭鏁扮粍 + * @param bsLen 瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級 + * @param dataCode 鍔熻兘鐮� + * @param data 鏁版嵁 + * @throws Exception 寮傚父 + */ + protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { + DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; + DataCd71Vo cdData = new DataCd71Vo() ; + dV1.dataCd71Vo = cdData ; + cdData.state = bs[ProtocolConstantV206V1_0_0.dataIndex] ; + if(cdData.state == 0){ + cdData.stateName = "闃�闂ㄥ叧闂�" ; + }else if(cdData.state == 1){ + cdData.stateName = "闃�闂ㄦ墦寮�" ; + }else{ + cdData.stateName = "鏈煡" ; + } + } +} -- Gitblit v1.8.0