From 53af97c5cf578d8feab2b22faa79e3b7a61f4ca8 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 11 七月 2024 21:39:31 +0800
Subject: [PATCH] 1、通信中间件增加机构tag; 2、生成新模块pipIrr-mwTest-rtu
---
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java
index f3f8dfc..d0f7034 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java
@@ -1035,6 +1035,31 @@
return fromIndex ;
}
+ /**
+ * 鍗佸叚杩涘埗杞瓧鑺傛暟缁�
+ * @param hex the hex string
+ * @return 杩斿洖 byte[]
+ */
+ public static int hex2Bytes_LE(String hex, byte[] bs, int fromIndex) {
+ if (hex == null || hex.equals("")) {
+ return fromIndex;
+ }
+ hex = hex.toUpperCase(Locale.ENGLISH);
+ int length = hex.length() / 2;
+ char[] hexChars = hex.toCharArray();
+ byte[] d = new byte[length];
+ for (int i = 0; i < length; i++) {
+ int pos = i * 2;
+ d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
+ }
+ for(int i = 0 ; i < d.length; i++){
+ bs[fromIndex++] = d[(d.length - 1) - i] ;
+ }
+ return fromIndex ;
+ }
+
+
+
private static final char[] HEX_CHAR = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
// /**
// * 灏哹yte[]杞崲涓�16杩涘埗瀛楃涓�
--
Gitblit v1.8.0