From 134209ad70f82051da3ce63471df0cc8f778e57d Mon Sep 17 00:00:00 2001 From: panlili2024 <14743743+panlili2024@user.noreply.gitee.com> Date: 星期三, 05 三月 2025 14:30:19 +0800 Subject: [PATCH] 增加source屏扫码绑定住宅接口 --- HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/socket/HDLSocket.java | 32 +++++++++++++++++++------------- 1 files changed, 19 insertions(+), 13 deletions(-) diff --git a/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/socket/HDLSocket.java b/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/socket/HDLSocket.java index 0149de2..2147f3e 100644 --- a/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/socket/HDLSocket.java +++ b/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/socket/HDLSocket.java @@ -46,6 +46,7 @@ import com.hdl.sdk.socket.listener.ConnectStatusListener; import com.hdl.sdk.socket.listener.SendListener; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ScheduledExecutorService; @@ -480,25 +481,30 @@ @Override public void heartbeat() { - if (HDLLinkConfig.getInstance().getDeviceInfoBean() == null || HDLLinkConfig.getInstance().getDeviceInfoBean().getOID() == null) { - LogUtils.i("DeviceInfoBean涓虹┖锛岄渶瑕佽缃墠鑳芥甯稿績璺�"); - return; - } - String time = String.valueOf(System.currentTimeMillis()); JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("id", IdUtils.getUUId()); jsonObject.addProperty("time_stamp", time); + if (HDLLinkConfig.getInstance().getDeviceInfoBean().getOID() == null) { + //涓嶈蛋浠庢満鍏ョ綉锛岄�氳繃gatewayId鍙戦�� + if (HDLLinkConfig.getInstance().getGatewayId() == null) { + return; + } + String topic = String.format(TopicConstant.HEARTBEAT, HDLLinkConfig.getInstance().getGatewayId()); + LinkRequest message = new LinkRequest(topic, + jsonObject.toString()); + sendMsg(message.getSendBytes(), null, null, null); - if (HDLLinkConfig.getInstance().getRequestBean() != null) { - jsonObject.addProperty("mac", HDLLinkConfig.getInstance().getRequestBean().getMAC()); + } else { + if (HDLLinkConfig.getInstance().getRequestBean() != null) { + jsonObject.addProperty("mac", HDLLinkConfig.getInstance().getRequestBean().getMAC()); + } + //璧颁粠鏈哄叆缃戯紝閫氳繃oid鍙戦�� + String topic = String.format(TopicConstant.HEARTBEAT, HDLLinkConfig.getInstance().getDeviceInfoBean().getOID()); + LinkRequest message = new LinkRequest(topic, + jsonObject.toString()); + sendMsg(message.getSendBytes(), null, null, null); } - - String topic = String.format(TopicConstant.HEARTBEAT, HDLLinkConfig.getInstance().getDeviceInfoBean().getOID()); - - LinkRequest message = new LinkRequest(topic, - jsonObject.toString()); - sendMsg(message.getSendBytes(), null, null, null); } }); } -- Gitblit v1.8.0