From 3b47201d878ba8ff973b84baf15942475688e964 Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期五, 15 十二月 2023 16:04:28 +0800 Subject: [PATCH] 合并第一个版本 --- HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/connect/HDLConnectHelper.java | 40 +++++++++++++++++++++++++++------------- 1 files changed, 27 insertions(+), 13 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 549d298..61564cc 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 @@ -114,7 +114,7 @@ /** * 鍙兘杩斿洖code灞炴�у彲鑳芥病鏈� 娌℃湁鐨勮瘽鐩存帴鎴愬姛 鏈夌殑璇濆彧鏈�200鎵嶄細鎴愬姛 */ - if (code == null || code == 200 || code == 0) { + if (code == null || code.intValue() == 200 || code.intValue() == 0) { notifySucceed(msg); } else { notifyFailure(ErrorUtils.getByCode(code)); @@ -325,8 +325,10 @@ 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()); @@ -334,20 +336,12 @@ 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 { if (!linkRequest.getTopic().endsWith("heartbeat")) {//蹇冭烦涓婚鏁版嵁杩囧锛岃繃婊や笅 - if (HDLConnectHelper.isInverterTopic(linkRequest.getTopic())) { - LogUtils.i("鏈湴鍙戦�佹暟鎹細\r\n" + Arrays.toString(byteArrayConvertIntArray(linkRequest.getSendBytes()))); - } else { - LogUtils.i("鏈湴鍙戦�佹暟鎹細\r\n" + new String(linkRequest.getSendBytes())); - } + LogUtils.i("鏈湴鍙戦�佹暟鎹細\r\n" + new String(linkRequest.getSendBytes())); } HDLTcpConnect.getTcpSocketBoot(ipAddress).sendMsg(EncryptUtil.getEncryBytes(linkRequest)); } @@ -419,6 +413,7 @@ } + /** * 鏀寔姣背绫诲瀷 * @@ -429,6 +424,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; } @@ -446,6 +459,7 @@ } + public static boolean isInverterTopic(String topic) { if (TextUtils.isEmpty(topic)) { return false; -- Gitblit v1.8.0