From a6c0ac0f20d1d91fbe1fe591a6a9ca46f82399f5 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期五, 23 二月 2024 16:37:16 +0800
Subject: [PATCH] 使用新的依赖库的名称

---
 HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/connect/HDLConnectHelper.java |   63 ++++++++++++++++++++++++++++++-
 1 files changed, 60 insertions(+), 3 deletions(-)

diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/connect/HDLConnectHelper.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/connect/HDLConnectHelper.java
index 9fc5d40..8bdc067 100644
--- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/connect/HDLConnectHelper.java
+++ b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/connect/HDLConnectHelper.java
@@ -21,6 +21,8 @@
 import com.hdl.sdk.link.gateway.HDLLinkLocalGateway;
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
@@ -323,19 +325,26 @@
                                     String requestTopic = linkRequest.getCloudTopic();
                                     byte[] encryBytes = null;
                                     GatewayBean gatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(mac);
-                                    if (gatewayBean != null && getGatewayTypeList().contains(gatewayBean.getGatewayType())) {
-                                        //閫嗗彉鍣ㄨ繙绋媘qtt绉橀挜涓嶄竴鏍�
+                                    if (gatewayBean != null && getMillimeterTypeList().contains(gatewayBean.getGatewayType())) {
+                                        /**
+                                         * 姣背娉㈣繖杈硅幏鍙栨暟鎹殑鏃跺��  宸茬粡璁剧疆浜嗕富浠庡瘑閽ヨ繘鍘讳簡 杩欒竟涓嶄綔澶勭悊
+                                         */
                                         encryBytes = EncryptUtil.encryBytes(linkRequest.getCloudSendBytes(), gatewayBean.getAesKey());
                                     } else {
                                         encryBytes = EncryptUtil.encryBytes(linkRequest.getCloudSendBytes(), HDLLinkConfig.getInstance().getAesKey());
                                     }
                                     if (MqttRecvClient.getInstance() != null) {
                                         MqttRecvClient.getInstance().send(requestTopic, encryBytes);
+                                        if (HDLConnectHelper.isInverterTopic(linkRequest.getCloudTopic())) {
+                                            LogUtils.i("杩滅▼鍙戦�佹暟鎹細" + linkRequest.getCloudTopic() + "\r\n" + Arrays.toString(byteArrayConvertIntArray(linkRequest.getCloudSendBytes())));
+                                        } else {
+                                            LogUtils.i("杩滅▼鍙戦�佹暟鎹細" + linkRequest.getCloudTopic() + "\r\n" + new String(linkRequest.getCloudSendBytes()));
+                                        }
                                     }
-                                    LogUtils.i("杩滅▼鍙戦�佹暟鎹細" + linkRequest.getCloudTopic() + "\r\n" + new String(linkRequest.getCloudSendBytes()));
                                 }
                                 //鏈湴TCP
                                 else {
+                                    linkRequest.setEncrypt(false);// 2024骞�01鏈�31鏃�16:34:22 榛樿鏄庢枃閫氳,鍥犱负鍒涘缓鐢电珯,缁戝畾閫嗗彉鍣ㄦ椂锛岄渶瑕佽缃弬鏁扮粰閫嗗彉鍣�,杩欐椂鍊欒繕娌℃湁绉橀挜;
                                     if (!linkRequest.getTopic().endsWith("heartbeat")) {//蹇冭烦涓婚鏁版嵁杩囧锛岃繃婊や笅
                                         LogUtils.i("鏈湴鍙戦�佹暟鎹細\r\n" + new String(linkRequest.getSendBytes()));
                                     }
@@ -408,6 +417,8 @@
         }
     }
 
+
+
     /**
      * 鏀寔姣背绫诲瀷
      *
@@ -418,6 +429,24 @@
 //        typeList.add("sensor.mmv_sleep");//鐫$湢姣背娉pk
 //        typeList.add("sensor.mmv_pose");//濮挎�佹绫虫尝spk
         typeList.add("energy.hdl_inverter");//閫嗗彉鍣╯pk
+        typeList.add("sensor.mmv_sleep");//鐫$湢姣背娉pk
+        typeList.add("sensor.mmv_pose");//濮挎�佹绫虫尝spk
+        typeList.add("sensor.hdl_mmw_pose");//Wi-Fi姣背娉T鐗堟湰
+        return typeList;
+    }
+
+    public static List<String> getMillimeterTypeList() {
+        List<String> typeList = new ArrayList<>();
+//        typeList.add("AGATEWAY");//缃戝叧
+        typeList.add("sensor.mmv_sleep");//鐫$湢姣背娉pk
+        typeList.add("sensor.mmv_pose");//濮挎�佹绫虫尝spk
+        typeList.add("sensor.hdl_mmw_pose");//Wi-Fi姣背娉T鐗堟湰
+        return typeList;
+    }
+
+    public static List<String> getNewMillimeterTypeList() {
+        List<String> typeList = new ArrayList<>();
+        typeList.add("sensor.hdl_mmw_pose");//Wi-Fi姣背娉T鐗堟湰
         return typeList;
     }
 
@@ -433,4 +462,32 @@
             listener = null;
         }
     }
+
+
+
+    public static boolean isInverterTopic(String topic) {
+        if (TextUtils.isEmpty(topic)) {
+            return false;
+        }
+        return topic.endsWith("custom/native/inverter/down_reply")
+                || topic.endsWith("custom/native/inverter/down")
+                || topic.endsWith("custom/native/inverter/up");
+    }
+
+    /**
+     * byte鏁扮粍杞崲鎴恑nt鏁扮粍(涓轰簡鎵撳嵃鍑烘棤绗﹀彿鐨刡tye鏁扮粍鏁版嵁)
+     *
+     * @param bytes 鏁扮粍
+     * @return
+     */
+    public static Integer[] byteArrayConvertIntArray(byte[] bytes) {
+        if (bytes == null || bytes.length == 0) {
+            return new Integer[]{};
+        }
+        Integer[] arr = new Integer[bytes.length];
+        for (int i = 0; i < bytes.length; i++) {
+            arr[i] = bytes[i] & 0xff;
+        }
+        return arr;
+    }
 }

--
Gitblit v1.8.0