From cfbe5dd2160d4d2fc67eccb253848b4534741f78 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期五, 05 七月 2024 13:29:21 +0800 Subject: [PATCH] 2024年07月05日13:29:13 --- app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java | 34 ++++++++++++++++------------------ 1 files changed, 16 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java index fb7681f..2da73f9 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java @@ -157,11 +157,12 @@ list.remove(index); } } + /** * 绉婚櫎缂撳瓨鍒楄〃閲岄潰閫嗗彉鍣� * - * @param homeId 鐢电珯id - * @param deviceId 閫嗗彉鍣╠eviceId + * @param homeId 鐢电珯id + * @param deviceId 閫嗗彉鍣╠eviceId */ public void removeLocalCacheMemoryGatewayToDeviceId(String homeId, String deviceId) { if (TextUtils.isEmpty(deviceId)) { @@ -493,22 +494,7 @@ @Override public void onFailure(HDLException e) { - //娣诲姞閫嗗彉鍣ㄥけ璐ュ悗鍒濆鍖栭�嗗彉鍣� - HdlLogLogic.print("娣诲姞閫嗗彉鍣ㄥけ璐ュ悗寮�濮嬪垵濮嬪寲閫嗗彉鍣�-->", true); - for (int i = 0; i < list.size(); i++) { - GatewayBean gatewayBean = list.get(i); - HdlDeviceLogic.getInstance().initializeInverter(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() { - @Override - public void onSuccess(Boolean obj) { - HdlLogLogic.print("鍒濆鍖栭�嗗彉鍣ㄦ垚鍔�-->mac:" + gatewayBean.getDevice_mac(), true); - } - @Override - public void onError(HDLLinkException e) { - HdlLogLogic.print("鍒濆鍖栭�嗗彉鍣ㄥけ璐�-->mac:" + gatewayBean.getDevice_mac(), true); - } - }); - } if (cloudCallBeak != null) { cloudCallBeak.onFailure(e); } @@ -1068,7 +1054,19 @@ HdlDeviceLogic.getInstance().getCloudInverterDeviceList(homeId, new CloudCallBeak<List<CloudInverterDeviceBean>>() { @Override public void onSuccess(List<CloudInverterDeviceBean> list) { - ///鎯呭喌1:鏈夊眬鍩熺綉锛屾湁澶栫綉锛� + List<String> removeSidList = new ArrayList<>(); + for (int j = 0; j < HDLLinkLocalGateway.getInstance().getGatewayList().size(); j++) { + GatewayBean gatewayBean = HDLLinkLocalGateway.getInstance().getGatewayList().get(j); + if (!querySidInverter(list, gatewayBean.getSid())) { + //鏈湴鏈夛紝浜戠娌℃湁,鍒犻櫎鏈湴锛� + removeSidList.add(gatewayBean.getSid()); + } + } + for (int i = 0; i < removeSidList.size(); i++) { + //鍒犻櫎鏈湴鐨勯�嗗彉鍣� + removeLocalInverter(removeSidList.get(i)); + } + //鎯呭喌1:鏈夊眬鍩熺綉锛屾湁澶栫綉锛� setDeviceRemoteInfo(list, homeId, cloudCallBeak); } -- Gitblit v1.8.0