| | |
| | | import android.content.Context; |
| | | |
| | | import com.hdl.hdlhttp.HxHttpConfig; |
| | | import com.hdl.sdk.common.event.DeleteNetworkListener; |
| | | 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.callback.HDLLinkCallBack; |
| | | import com.hdl.sdk.connect.callback.HDLLinkResponseCallBack; |
| | | import com.hdl.sdk.connect.cloud.CallBackListener; |
| | | 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; |
| | |
| | | private static final HDLLink instance = new HDLLink(); |
| | | |
| | | private String appKey, appSecret; |
| | | public DeleteNetworkListener listener; |
| | | |
| | | /** |
| | | * getInstance |
| | |
| | | public synchronized void removeAllTopicsListener(EventListener listener) { |
| | | if (listener == null) return; |
| | | EventDispatcher.getInstance().removeAllTopicsListener(listener); |
| | | } |
| | | |
| | | /** |
| | | * 注册退网主题的监听 |
| | | * |
| | | * @param listener |
| | | */ |
| | | public synchronized void setDeleteNetworkListener(DeleteNetworkListener listener) { |
| | | this.listener = listener; |
| | | } |
| | | |
| | | /***********************三方设备和网关通信之前的认证流程****************************/ |
| | |
| | | .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) { |
| | | 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.checkAppVersion(versionCode, appCode, listener); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 场景详情 |
| | | * |
| | | * @param sids 场景sid列表 |
| | | * @param callBack 回调 |
| | | */ |
| | | public void getScene(List<String> sids, HDLLinkCallBack callBack) { |
| | | HDLSocket.getInstance().getScene(sids, callBack); |
| | | } |
| | | |
| | | /** |
| | | * 场景控制 |
| | | * |
| | | * @param sids 场景sid列表 |