From 9281643d18bc2e0aaffed3c5f216d1df12d68424 Mon Sep 17 00:00:00 2001 From: wuzeyu <1223318623@qq.com> Date: 星期四, 18 一月 2024 09:44:19 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.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/CommonV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java index c1b8d7f..e9677bb 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java @@ -82,11 +82,29 @@ public String parseRtuAddr(byte[] bs)throws Exception{ String rtuAddrBCD = "" + ByteUtil.BCD2Long_BE(bs, ProtocolConstantV206V1_0_0.rtuAddr1Index_start, ProtocolConstantV206V1_0_0.rtuAddr1Index_end) ; String rtuAddrStr = "" + ByteUtilUnsigned.bytes2Short_BE(bs, ProtocolConstantV206V1_0_0.rtuAddr2Index_start) ; - while(rtuAddrStr.length() < 4){ + while(rtuAddrStr.length() < 5){ rtuAddrStr = "0" + rtuAddrStr ; } return rtuAddrBCD + rtuAddrStr ; } + + + /** + * 鍒嗘瀽Rtu鍦板潃 + * @param bs 涓婅瀛楄妭鏁扮粍 + * @param index 鍚浣� + * @return 鎺у埗鍣ㄥ湴鍧� + * @throws Exception 寮傚父 + */ + public String parseRtuAddr(byte[] bs, int index)throws Exception{ + String rtuAddrBCD = "" + ByteUtil.BCD2Long_BE(bs, index, index + 2) ; + String rtuAddrStr = "" + ByteUtilUnsigned.bytes2Short_BE(bs, index + 3) ; + while(rtuAddrStr.length() < 5){ + rtuAddrStr = "0" + rtuAddrStr ; + } + return rtuAddrBCD + rtuAddrStr ; + } + /** * 鍒嗘瀽鍔熻兘鐮� @@ -145,6 +163,7 @@ case 7 -> "绱ф�ュ叧闃�"; case 8 -> "鐢ㄦ埛杩滅▼寮�闃�"; case 9 -> "鐢ㄦ埛杩滅▼鍏抽榾"; + case 16 -> "绠¢亾鏃犳按鑷姩鍏抽榾"; default -> "鏈煡"; }; } -- Gitblit v1.8.0