From 8910275656c9bf398832dc14957a03684a593e96 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期五, 30 八月 2024 15:16:58 +0800
Subject: [PATCH] 2024-08-30 朱宝民 修改配置文件bug
---
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java | 88 ++++++++++++++++++++++++++++++++-----------
1 files changed, 65 insertions(+), 23 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 1538331..8de6bb7 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
@@ -81,12 +81,30 @@
*/
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){
+ String rtuAddrStr = "" + ByteUtilUnsigned.bytes2Short_LE(bs, ProtocolConstantV206V1_0_0.rtuAddr2Index_start) ;
+ 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_LE(bs, index + 3) ;
+ while(rtuAddrStr.length() <= 5){
+ rtuAddrStr = "0" + rtuAddrStr ;
+ }
+ return rtuAddrBCD + rtuAddrStr ;
+ }
+
/**
* 鍒嗘瀽鍔熻兘鐮�
@@ -128,9 +146,41 @@
//DIR = 0
return b ;
}
+ /**
+ * 寰楀埌IC鍗$被鍨嬪悕绉� 锛� 鍗$被鍨�(1:鐢ㄦ埛鍗★紱2锛氱鐞嗗憳鍗★紱3锛氳皟璇曞崱锛�4锛氬紑鍏抽榾鍗★紱5锛氭竻绌哄崱)锛�
+ * @param type 瀛楄妭
+ * @return 鍚嶇О
+ */
+ public static String icCardType(byte type){
+ return switch (type) {
+ case 0 -> "鏃犲崱";
+ case 1 -> "鐢ㄦ埛鍗�";
+ case 2 -> "绠$悊鍛樺崱";
+ case 3 -> "璋冭瘯鍗�";
+ case 4 -> "寮�鍏抽榾鍗�";
+ case 5 -> "娓呯┖鍗�";
+ default -> "鏈煡";
+ };
+ }
/**
* 寰楀埌鍏冲紑闃�绫诲瀷鍚嶇О
+ * 寮�鍏抽榾绫诲瀷(
+ * 1:鍒峰崱寮�闃�锛�
+ * 2:鍒峰崱鍏抽榾锛�
+ * 3:涓績绔欏紑闃�锛�
+ * 4:涓績绔欏叧闃�锛�
+ * 5:浣欓涓嶈冻鍏抽榾锛�
+ * 6:娴侀噺璁℃晠闅滃叧闃�锛�
+ * 7:绱ф�ュ叧闂紱
+ * 8:鐢ㄦ埛杩滅▼寮�闃�锛�
+ * 9:鐢ㄦ埛杩滅▼鍏抽榾锛�
+ * 10:寮�鍏抽榾鍗″叧闃�锛�
+ * 11:寮�鍏抽榾鍗″埛鍗″崱寮�闃�锛�
+ * 12:榛戝悕鍗曞懡浠ゅ叧闃�锛�
+ * 13:杩滅▼瀹氭椂鍏抽榾锛�
+ * 14:杩滅▼瀹氶噺鍏抽榾锛�
+ * )
* @param type 瀛楄妭
* @return 鍚嶇О
*/
@@ -140,34 +190,26 @@
case 2 -> "鍒峰崱鍏抽榾";
case 3 -> "涓績绔欏紑闃�";
case 4 -> "涓績绔欏叧闃�";
- case 5 -> "娆犺垂鍏抽榾";
+ case 5 -> "浣欓涓嶈冻鍏抽榾";
case 6 -> "娴侀噺璁℃晠闅滃叧闃�";
case 7 -> "绱ф�ュ叧闃�";
case 8 -> "鐢ㄦ埛杩滅▼寮�闃�";
case 9 -> "鐢ㄦ埛杩滅▼鍏抽榾";
- case 16 -> "绠¢亾鏃犳按鑷姩鍏抽榾";
+ case 10 -> "寮�鍏抽榾鍗″叧闃�";
+ case 11 -> "寮�鍏抽榾鍗″紑闃�";
+ case 12 -> "榛戝悕鍗曞懡浠ゅ叧闃�";
+ case 13 -> "杩滅▼瀹氭椂鍏抽榾";
+ case 14 -> "杩滅▼瀹氶噺鍏抽榾";
default -> "鏈煡";
};
}
-
- /*
- * 鍒嗘瀽鐗堟湰鍙�
- * @param bs 涓婅瀛楄妭鏁扮粍
- * @return 鐗堟湰鍙�
- * @throws Exception 寮傚父
- public String parseVersion(byte[] bs)throws Exception{
- short ver = ByteUtilUnsigned.byte2Byte(bs, ProtocolConstantV206V1_0_0.versionIndex) ;
- char[] cs = ("" + ver).toCharArray() ;
- StringBuilder vs = new StringBuilder() ;
- for(byte i = 0 ; i < cs.length; i++){
- if(i == 0){
- vs.append(cs[i]) ;
- }else{
- vs.append(".").append(cs[i]) ;
- }
- }
- return vs.toString() ;
+ public static Boolean isCloseValveType(byte type){
+ return switch (type) {
+ case 1, 3, 8, 11 -> false ;
+ case 2, 4, 5, 6, 7, 9, 10, 12, 13, 14 -> true ;
+ default -> null ;
+ };
}
- */
+
}
--
Gitblit v1.8.0