From 70c1ba24af27ba64e1d9ad50eb722541212ed8b6 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期五, 30 六月 2023 17:26:54 +0800 Subject: [PATCH] 2023年06月30日17:26:51 --- app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java | 40 ++++++++++++++++++++++++++++++++-------- 1 files changed, 32 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java index 54a63fe..4e7f0d6 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java @@ -10,12 +10,14 @@ import com.hdl.photovoltaic.internet.api.HttpApi; import com.hdl.photovoltaic.listener.BaseSuccessFailureCallBeak; import com.hdl.photovoltaic.listener.CloudCallBeak; +import com.hdl.photovoltaic.ui.bean.CloudInverterDeviceBean; import com.hdl.photovoltaic.ui.bean.HouseInfoBean; import com.hdl.photovoltaic.ui.bean.HouseIdBean; import com.hdl.sdk.link.common.exception.HDLLinkException; import com.hdl.sdk.link.core.bean.gateway.GatewayBean; import com.hdl.sdk.link.core.callback.GatewayCallBack; import com.hdl.sdk.link.core.config.HDLLinkConfig; +import com.hdl.sdk.link.gateway.HDLLinkLocalGateway; import java.util.ArrayList; import java.util.List; @@ -257,13 +259,19 @@ HttpClient.getInstance().requestHttp(requestUrl, json.toString(), true, true, new BaseSuccessFailureCallBeak() { @Override public void onSuccess(HttpResponsePack httpResponsePack) { - if (httpResponsePack != null && httpResponsePack.getData() != null) { - Gson gson = new Gson(); - String jsonStr = gson.toJson(httpResponsePack.getData()); - HouseInfoBean houseInfoBean = gson.fromJson(jsonStr, HouseInfoBean.class); + try { + if (httpResponsePack != null && httpResponsePack.getData() != null) { + Gson gson = new Gson(); + String jsonStr = gson.toJson(httpResponsePack.getData()); + HouseInfoBean houseInfoBean = gson.fromJson(jsonStr, HouseInfoBean.class); + if (cloudCallBeak != null) { + cloudCallBeak.onSuccess(houseInfoBean); + } + } + } catch (Exception exception) { if (cloudCallBeak != null) { - cloudCallBeak.onSuccess(houseInfoBean); + cloudCallBeak.onFailure(exception); } } } @@ -510,9 +518,9 @@ */ public void switchHouse(HouseIdBean houseIdBean) { String oidHomeId = UserConfigManage.getInstance().getHomeId(); - if (houseIdBean.getHomeId().equals(oidHomeId)) { - return; - } +// if (houseIdBean.getHomeId().equals(oidHomeId)) { +// return; +// } //鍒犻櫎鏃х殑浣忓畢鏂囦欢澶� HdlFileLogic.getInstance().deleteDirectory(HdlFileLogic.getInstance().getCurrentHomeRootPath()); //閲嶆柊璁剧疆浣忓畢id @@ -523,6 +531,19 @@ HdlFileLogic.getInstance().createDirectory(); //閰嶇疆鏈湴閫氫俊鐨勪俊鎭� initLocalLinkSdk(); + +// HdlDeviceLogic.getInstance().getInverterDeviceList(UserConfigManage.getInstance().getHomeId(), new CloudCallBeak<CloudInverterDeviceBean>() { +// @Override +// public void onSuccess(CloudInverterDeviceBean obj) { +// +// +// } +// +// @Override +// public void onFailure(Exception exception) { +// +// } +// }); HdlDeviceLogic.getInstance().searchGateway(new GatewayCallBack() { @Override public void onSuccess(List<GatewayBean> gatewayBeanList) { @@ -535,6 +556,8 @@ } }); + + } /** @@ -544,6 +567,7 @@ HDLLinkConfig.getInstance().setHomeId(UserConfigManage.getInstance().getHomeId()); HDLLinkConfig.getInstance().setLocalSecret(UserConfigManage.getInstance().getLocalSecret()); + } -- Gitblit v1.8.0