From db29d92c6974d50f0ebb9328834c44a69c6054bb Mon Sep 17 00:00:00 2001
From: panlili2024 <14743743+panlili2024@user.noreply.gitee.com>
Date: 星期三, 05 三月 2025 15:28:37 +0800
Subject: [PATCH] 更新版本

---
 HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/cloud/HdlCloudController.java |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 111 insertions(+), 0 deletions(-)

diff --git a/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/cloud/HdlCloudController.java b/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/cloud/HdlCloudController.java
index e7dff9c..b47fd7c 100644
--- a/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/cloud/HdlCloudController.java
+++ b/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/cloud/HdlCloudController.java
@@ -1,6 +1,15 @@
 package com.hdl.sdk.connect.cloud;
 
 import com.hdl.hdlhttp.HxHttp;
+import com.hdl.hdlhttp.HxHttpBuilder;
+import com.hdl.sdk.connect.bean.response.UpdateInfo;
+import com.hdl.sdk.connect.cloud.bean.AiLoginInfo;
+import com.hdl.sdk.connect.cloud.bean.GatewayInfo;
+import com.hdl.sdk.connect.cloud.listener.GatewayListListener;
+import com.hdl.sdk.connect.cloud.listener.GatewayListener;
+import com.hdl.sdk.connect.cloud.listener.SibichiListener;
+
+import java.util.List;
 
 import io.reactivex.rxjava3.disposables.Disposable;
 
@@ -35,4 +44,106 @@
                 });
     }
 
+    /**
+     * 妫�鏌pp鏄惁鏇存柊
+     *
+     * @return
+     */
+    public static Disposable checkAppVersion(String versionCode, String appCode, CheckAppVersionListener listener) {
+        return HxHttp.builder()
+                .url(HdlCloudApi.BASE_CHINA_URL + HdlCloudApi.CHECK_APP_VERSION_URL)
+                .params("version", versionCode)
+                .params("appCode", appCode)
+                .params("releaseSystem", "Android")
+                .build()
+                .post()
+                .subscribeWith(new HDLResponse<UpdateInfo>() {
+                    @Override
+                    public void onResponse(UpdateInfo response) {
+                        listener.onSuccess(response);
+                    }
+
+                    @Override
+                    public void onFailure(HDLException e) {
+                        listener.onError(e);
+                    }
+                });
+    }
+
+    /**
+     * 鑾峰彇鎬濆繀椹皌oken
+     *
+     * @return
+     */
+    public static Disposable getSibichiToken(String homeId, String clientId, SibichiListener listener) {
+        return HxHttp.builder()
+                .url(HdlCloudApi.GET_SIBICHI_TOKEN)
+                .params("homeId", homeId)
+                .params("clientId", clientId)
+                .build()
+                .post()
+                .subscribeWith(new HDLResponse<AiLoginInfo>() {
+                    @Override
+                    public void onResponse(AiLoginInfo response) {
+                        listener.onSuccess(response);
+                    }
+
+                    @Override
+                    public void onFailure(HDLException e) {
+                        listener.onError(e);
+                    }
+                });
+    }
+
+    /**
+     * 鑾峰彇涓荤綉鍏�
+     */
+    public static Disposable syncMainGateway(String homeId, GatewayListener listener) {
+        return syncGatewayList(homeId, new GatewayListListener() {
+            @Override
+            public void onSuccess(List<GatewayInfo> info) {
+                if (listener != null) {
+                    if (info == null || info.isEmpty()) {
+                        listener.onError(new HDLException(-5000, "鎼滅储缃戝叧澶辫触"));
+                    } else {
+                        listener.onSuccess(info.get(0));
+                    }
+                }
+
+            }
+
+            @Override
+            public void onError(HDLException e) {
+                if (listener != null) {
+                    listener.onError(e);
+                }
+            }
+        });
+    }
+
+    /**
+     * 鍚屾鑾峰彇缃戝叧鍒楄〃
+     */
+    public static Disposable syncGatewayList(String homeId, GatewayListListener listener) {
+        HxHttpBuilder httpBuilder = HxHttp.builder()
+                .params("homeId", homeId)
+                .url(HdlCloudApi.GET_GATEWAY_LIST);
+        return httpBuilder.build().post().subscribeWith(new HDLResponse<List<GatewayInfo>>() {
+            @Override
+            public void onResponse(List<GatewayInfo> response) {
+                if (listener != null) {
+                    listener.onSuccess(response);
+                }
+            }
+
+            @Override
+            public void onFailure(HDLException e) {
+                if (listener != null) {
+                    listener.onError(e);
+                }
+            }
+        });
+    }
+
+
 }

--
Gitblit v1.8.0