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/cloud/HdlCloudController.java |   84 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 84 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 8f05dcf..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,7 +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;
 
@@ -62,4 +70,80 @@
                 });
     }
 
+    /**
+     * 鑾峰彇鎬濆繀椹皌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