From db21de901bb1bbc6ec66b59e7b0766d0d2c5c6cc Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 16 七月 2019 13:54:44 +0800
Subject: [PATCH] 20190716 1.提供声必可SDK,部分数据处理调整; 2.演示DemoAPP,地热和新风页面调整;

---
 hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/StringUtil.java |   46 +++++++++++++++-------------------------------
 1 files changed, 15 insertions(+), 31 deletions(-)

diff --git a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/StringUtil.java b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/StringUtil.java
index 1a66699..6e81c1c 100644
--- a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/StringUtil.java
+++ b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/StringUtil.java
@@ -85,38 +85,7 @@
     }
 
 
-    public static float byteToFloat(byte b1, byte b2, byte b3, byte b4){
-        byte[] mByte = new byte[4];
-        mByte[0] = b1;
-        mByte[1] = b2;
-        mByte[2] = b3;
-        mByte[3] = b4;
-        return byteArrayToFloat(mByte);
-    }
 
-    // 浠巄yte鏁扮粍鐨刬ndex澶勭殑杩炵画4涓瓧鑺傝幏寰椾竴涓猧nt
-    public static int getInt(byte[] arr) {
-        return 	(0xff000000 	& (arr[0] << 24))  |
-                (0x00ff0000 	& (arr[1] << 16))  |
-                (0x0000ff00 	& (arr[2] << 8))   |
-                (0x000000ff 	&  arr[3]);
-    }
-
-    // float杞崲涓篵yte[4]鏁扮粍
-    public static byte[] getByteArray(float f) {
-        int intbits = Float.floatToIntBits(f);//灏唂loat閲岄潰鐨勪簩杩涘埗涓茶В閲婁负int鏁存暟
-        return getByteArray(intbits);
-    }
-
-    // 浠巄yte鏁扮粍鐨刬ndex澶勭殑杩炵画4涓瓧鑺傝幏寰椾竴涓猣loat
-    public static float byteArrayToFloat(byte[] arr) {
-        try {
-            return Float.intBitsToFloat(getInt(arr));
-        } catch (Exception e) {
-            e.printStackTrace();
-            return 0;
-        }
-    }
 
 //    private byte[] formatStyleHDLResponse(String responsePart1, String responsePart2, int maxLen) throws UnsupportedEncodingException {
 //        String responsePart3 = HDL_END_STR;
@@ -191,5 +160,20 @@
 //        return;
 //    }
 
+    //-------------------------------------------------------
+    //瀛楄妭鏁扮粍杞浆hex瀛楃涓诧紝鍙�夐暱搴�
+    public static String ByteArrToHex(byte[] inBytArr, int offset, int byteCount) {
+        StringBuilder strBuilder = new StringBuilder();
+        int j = byteCount;
+        for (int i = offset; i < j; i++) {
+            strBuilder.append(Byte2Hex(Byte.valueOf(inBytArr[i])));
+        }
+        return strBuilder.toString();
+    }
 
+    //-------------------------------------------------------
+    //1瀛楄妭杞�2涓狧ex瀛楃
+    public static String Byte2Hex(Byte inByte) {
+        return String.format("%02x", new Object[]{inByte}).toUpperCase();
+    }
 }

--
Gitblit v1.8.0