From d451118d4be05f180cfe1f99bc5904f74db8cc3f Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期四, 22 二月 2024 15:40:58 +0800
Subject: [PATCH] 引用线上库

---
 HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/socket/TcpSocketBoot.java |   45 +++++++++++++++++++++------------------------
 1 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/socket/TcpSocketBoot.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/socket/TcpSocketBoot.java
index 6705fe2..d721eea 100644
--- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/socket/TcpSocketBoot.java
+++ b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/socket/TcpSocketBoot.java
@@ -30,19 +30,17 @@
 
     private final IClient client;
     private IHeartbeat iHeartbeat;
-
-    public void SetHeartbeat(IHeartbeat iHeartbeat) {
-        this.iHeartbeat = iHeartbeat;
+    public void SetHeartbeat(IHeartbeat iHeartbeat){
+        this.iHeartbeat=iHeartbeat;
     }
-
     /**
      * 褰撳墠鎺ユ敹鍒版暟鎹殑鏃堕棿
      */
-    private long time = System.currentTimeMillis();
+    private  long time=System.currentTimeMillis();
     /**
      * tcp鏄惁宸茬粡杩炴帴
      */
-    private boolean connected = false;
+    private boolean connected=false;
 
     public IClient getClient() {
         return client;
@@ -56,7 +54,7 @@
 
     private final ArrayMap<String, SendListener> sendMap = new ArrayMap<>();
 
-    public TcpSocketBoot(IClient client) {
+    public  TcpSocketBoot(IClient client) {
         TCP_SOCKET_BOOT_LIST.add(this);
         this.client = client;
         initConnectThread();
@@ -68,25 +66,25 @@
     /**
      * 璁板綍鎵�鏈塖ocketBoot
      */
-    final static List<TcpSocketBoot> TCP_SOCKET_BOOT_LIST = new ArrayList<>();
+    final static List<TcpSocketBoot> TCP_SOCKET_BOOT_LIST = new ArrayList();
 
     /**
      * 鏍规嵁IP鍦板潃鍙婄鍙h幏鍙栧綋鍓峴ocketBoot
-     *
      * @param ipAddress
      * @param port
      * @return
      */
-    public static TcpSocketBoot getByEndPoint(String ipAddress, int port) {
-        if (ipAddress == null) {
-            return null;
+    public static TcpSocketBoot getByEndPoint(String ipAddress, int port){
+        if(ipAddress==null){
+            return  null;
         }
-        for (TcpSocketBoot tcpSocketBoot : TCP_SOCKET_BOOT_LIST) {
-            if (ipAddress.equals(tcpSocketBoot.getClient().getOptions().getIp()) && tcpSocketBoot.getClient().getOptions().getPort() == port) {
+        for(TcpSocketBoot tcpSocketBoot : TCP_SOCKET_BOOT_LIST){
+            if(ipAddress.equals(tcpSocketBoot.getClient().getOptions().getIp())&& tcpSocketBoot.getClient().getOptions().getPort()==port)
+            {
                 return tcpSocketBoot;
             }
         }
-        return null;
+        return  null;
     }
 
     /**
@@ -94,14 +92,14 @@
      */
     private synchronized void connect() {
         try {
-            LogUtils.i("TCP杩炴帴锛�" + this.getClient().getOptions().getIp());
+            LogUtils.i("TCP杩炴帴锛�"+this.getClient().getOptions().getIp());
             client.onConnectStatus(ConnectStatus.CONNECTING);
 //            Thread.sleep(700);
             client.connect();
-            LogUtils.i("TCP杩炴帴鎴愬姛锛�" + this.getClient().getOptions().getIp());
-            connected = true;
+            LogUtils.i("TCP杩炴帴鎴愬姛锛�"+this.getClient().getOptions().getIp());
+            connected=true;
             client.onConnectStatus(ConnectStatus.CONNECTED);
-        } catch (Exception e) {
+        }catch(Exception e) {
             LogUtils.e(e.getMessage());
         }
     }
@@ -118,7 +116,7 @@
                 public void run() {
                     while (true) {
                         try {
-                            if (!connected) {
+                            if(connected==false){
                                 Thread.sleep(100);
                                 continue;
                             }
@@ -165,7 +163,7 @@
                             if (connected) {
                                 //璇诲彇鏁版嵁
                                 client.onHandleResponse();
-                                time = System.currentTimeMillis();
+                                time= System.currentTimeMillis();
                             } else {
                                 try {
                                     Thread.sleep(1000);
@@ -198,7 +196,7 @@
                             if (!connected) {
                                 reconect();
                             }
-                            Thread.sleep(5 * 1000);
+                            Thread.sleep(5*1000);
                         } catch (Exception e) {
 
                             LogUtils.e("瀹氭椂杩炴帴绾跨▼寮傚父:" + e.getMessage());
@@ -236,7 +234,6 @@
             });
         }
     }
-
     /**
      * 閲嶆柊杩炴帴
      */
@@ -247,7 +244,6 @@
 
     /**
      * 鍙戦�佹棤闇�鍥炶皟
-     *
      * @param msg 鍙戦�佺殑鏁版嵁
      */
     public void sendMsg(byte[] msg) {
@@ -283,6 +279,7 @@
         }
     }
 
+
 //    /**
 //     * 鏂紑鍏ㄩ儴鐨凩ink缃戝叧杩炴帴
 //     */

--
Gitblit v1.8.0