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/HDLLink.java | 127 ++++++++++++++++++++++++++++------------- 1 files changed, 86 insertions(+), 41 deletions(-) diff --git a/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/HDLLink.java b/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/HDLLink.java index 83f0ec7..b89fe9e 100644 --- a/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/HDLLink.java +++ b/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/HDLLink.java @@ -4,9 +4,10 @@ import com.hdl.hdlhttp.HxHttpConfig; import com.hdl.sdk.common.event.DeleteNetworkListener; +import com.hdl.sdk.common.event.EventDispatcher; +import com.hdl.sdk.common.event.EventListener; import com.hdl.sdk.common.utils.LogUtils; -import com.hdl.sdk.common.utils.ThreadToolUtils; -import com.hdl.sdk.connect.bean.request.DeviceAuthRequest; +import com.hdl.sdk.connect.bean.request.AuthenticateRequest; import com.hdl.sdk.connect.bean.request.DeviceControlRequest; import com.hdl.sdk.connect.bean.request.ListSidRequest; import com.hdl.sdk.connect.bean.request.ListUploadRequest; @@ -16,19 +17,15 @@ import com.hdl.sdk.connect.cloud.CheckAppVersionListener; import com.hdl.sdk.connect.cloud.HdlCloudApi; import com.hdl.sdk.connect.cloud.HdlCloudController; -import com.hdl.sdk.connect.cloud.interceptor.EncryptInterceptor; -import com.hdl.sdk.connect.cloud.interceptor.SmartHeaderInterceptor; +import com.hdl.sdk.connect.cloud.listener.GatewayListener; +import com.hdl.sdk.connect.cloud.listener.SibichiListener; +import com.hdl.sdk.connect.config.HDLCloudConfig; import com.hdl.sdk.connect.config.HDLLinkConfig; -import com.hdl.sdk.common.event.EventDispatcher; -import com.hdl.sdk.common.event.EventListener; -import com.hdl.sdk.connect.bean.request.AuthenticateRequest; import com.hdl.sdk.connect.socket.HDLAuthSocket; import com.hdl.sdk.connect.socket.HDLSocket; import java.util.List; -import java.util.concurrent.TimeUnit; -import io.reactivex.rxjava3.disposables.Disposable; import okhttp3.logging.HttpLoggingInterceptor; /** @@ -120,6 +117,10 @@ HDLLinkConfig.getInstance().setNetworkName(networkName); } + public String getParentOid() { + return HDLLinkConfig.getInstance().getParentOid(); + } + /** * 寮�濮嬬洃鍚拰鍙戣捣鍏ョ綉鍙婅璇佽姹� * @@ -153,6 +154,7 @@ */ public void UploadDeviceAuth(String mac, String result, String message, String auth_code, HDLLinkCallBack callBack) { HDLSocket.getInstance().UploadDeviceAuth(mac, result, message, auth_code, callBack); + } /** @@ -163,51 +165,59 @@ * @param spk 璁惧spk * @param callBack 缁撴灉鍥炶皟 */ - public void applyDeviceSecret(Context context, String appKey, String appSecret, String supplier, String mac, String spk, CallBackListener callBack) { + public void applyDeviceSecret(String supplier, String mac, String spk, CallBackListener callBack) { LogUtils.i("鐢宠璁惧瀵嗛挜"); - HxHttpConfig.getInstance().init(context, HdlCloudApi.BASE_CHINA_URL) - .addInterceptor( - new EncryptInterceptor(), - new SmartHeaderInterceptor()); - this.appKey = appKey; - this.appSecret = appSecret; - - HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(); - httpLoggingInterceptor.level(HttpLoggingInterceptor.Level.BODY); - - HxHttpConfig.getInstance() - //.addInterceptor(new HttpCacheInterceptor()) - .addInterceptor(httpLoggingInterceptor).ignoreSSL(); - HdlCloudController.applyDeviceSecret(supplier, mac, spk, callBack); } /** * 妫�娴嬫洿鏂� * - * @param appKey appKey - * @param appSecret appSecret * @param versionCode 褰撳墠鐗堟湰 * @param appCode appCode * @param listener 缁撴灉鍥炶皟 */ - public void checkAppVersion(Context context, String appKey, String appSecret, String versionCode, String appCode, CheckAppVersionListener listener) { + public void checkAppVersion(String versionCode, String appCode, CheckAppVersionListener listener) { LogUtils.i("妫�娴嬫洿鏂�"); - HxHttpConfig.getInstance().init(context, HdlCloudApi.BASE_CHINA_URL) - .addInterceptor( - new EncryptInterceptor(), - new SmartHeaderInterceptor()); - this.appKey = appKey; - this.appSecret = appSecret; + HdlCloudController.checkAppVersion(versionCode, appCode, listener); + } + + /** + * 鍒濆鍖栦簯绔� + */ + public void initCloud(Context context, String appKey, String appSecret) { + + HDLCloudConfig.getInstance().init(context, appKey, appSecret, HdlCloudApi.BASE_CHINA_URL); + + HxHttpConfig.getInstance().ignoreSSL(); HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(); httpLoggingInterceptor.level(HttpLoggingInterceptor.Level.BODY); + HxHttpConfig.getInstance().addInterceptor(httpLoggingInterceptor); - HxHttpConfig.getInstance() - //.addInterceptor(new HttpCacheInterceptor()) - .addInterceptor(httpLoggingInterceptor).ignoreSSL(); + } - HdlCloudController.checkAppVersion(versionCode, appCode, listener); + /** + * 鑾峰彇鎬濆繀椹皌oken + * + * @param homeId homeId + * @param clientId clientId + * @param listener 缁撴灉鍥炶皟 + */ + public void getSibichiToken(String homeId, String clientId, SibichiListener listener) { + LogUtils.i("鑾峰彇鎬濆繀椹皌oken"); + HdlCloudController.getSibichiToken(homeId, clientId, listener); + } + + /** + * 鑾峰彇涓荤綉鍏充俊鎭� + * + * @param homeId homeId + * @param listener 缁撴灉鍥炶皟 + */ + public void syncMainGateway(String homeId, GatewayListener listener) { + LogUtils.i("鑾峰彇涓荤綉鍏充俊鎭�"); + HdlCloudController.syncMainGateway(homeId, listener); } /** @@ -248,14 +258,14 @@ } /** - * 鑾峰彇鍔熻兘鍒楄〃 + * 鑾峰彇璁惧鍒楄〃 */ public void getFunctionList(HDLLinkCallBack callBack) { HDLSocket.getInstance().getFunctionList(callBack); } /** - * 鑾峰彇鍔熻兘灞炴�� + * 鑾峰彇璁惧鍔熻兘灞炴�� * * @param sids * @param callBack @@ -324,14 +334,49 @@ /** * 涓婃姤sid鍒楄〃 * - * @param requestList sid鍒楄〃 - * @param callBack 鍥炶皟 + * @param requestList sid鍒楄〃 + * @param callBack 鍥炶皟 */ public void UploadSidList(List<ListSidRequest> requestList, HDLLinkCallBack callBack) { HDLSocket.getInstance().UploadSidList(requestList, callBack); } /** + * 鑾峰彇鎴块棿鍒楄〃 + */ + public void getRoomList(HDLLinkCallBack callBack) { + HDLSocket.getInstance().getRoomList(callBack); + } + + /** + * 鎴块棿缁戝畾鍏崇郴鍒楄〃鑾峰彇 + * + * @param uid 鎴块棿uid鍒楄〃 + * @param callBack 鍥炶皟 + */ + public void getRoomBindList(List<String> uid, HDLLinkCallBack callBack) { + HDLSocket.getInstance().getRoomBindList(uid, callBack); + } + + /** + * 鑾峰彇鑷姩鍖栧垪琛� + */ + public void getLogicList(HDLLinkCallBack callBack) { + HDLSocket.getInstance().getLogicList(callBack); + } + + /** + * 饩冨姩鍖栧惎饨ょ饨� + * + * @param sid 鑷姩鍖杝id + * @param enable true=鍚饯 false=绂佲饯 + * @param callBack 鍥炶皟 + */ + public void editEnableLogic(String sid, boolean enable, HDLLinkCallBack callBack) { + HDLSocket.getInstance().editEnableLogic(sid, enable, callBack); + } + + /** * 閫氱敤UDP鍙戦�佹寚浠� * 1绉掓病鍝嶅簲灏辫浠栭噸鏂板彂閫�,閲嶈瘯3娆� * -- Gitblit v1.8.0