From 18f9dc6d0f15cad4a74e68fcf87b1a9aa83b5e66 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期四, 18 七月 2024 14:28:28 +0800 Subject: [PATCH] 实现协议中各种命令结果日志数据库永久更新保存功能 --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlParse.java | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlParse.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlParse.java index 5336505..028f991 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlParse.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlParse.java @@ -3,6 +3,7 @@ import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataAlarmVo; import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataStateVo; import com.dy.common.util.ByteUtil; +import com.dy.common.util.ByteUtilUnsigned; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -34,11 +35,29 @@ DataStateVo avo = new DataStateVo() ; byte b = bs[index] ; avo.icCard = (byte)((b & 0x4) >> 2) ; - avo.working = (byte)((b & 0x10) >> 4) ; + avo.valveState = (byte)((b & 0x10) >> 4) ; avo.powerType = (byte)((b & 0x40) >> 6) ; return avo ; } + /** + * 鍒嗘瀽IC鍗$紪鍙� + * @param bs 涓婅瀛楄妭鏁扮粍 + * @param index 鍚浣� + * @return 鎺у埗鍣ㄥ湴鍧� + * @throws Exception 寮傚父 + */ + public static String parseIcCardNo(byte[] bs, int index)throws Exception{ + String rtuAddrStr = "" + ByteUtilUnsigned.bytes2Short_LE(bs, index) ; + String rtuAddrBCD = "" + ByteUtil.BCD2Long_LE(bs, index + 2, index + 7) ; + while(rtuAddrStr.length() < 5){ + rtuAddrStr = "0" + rtuAddrStr ; + } + return rtuAddrBCD + rtuAddrStr ; + } + + + public static String parseTp(byte[] bs, short index){ String dt = "" ; try{ -- Gitblit v1.8.0