From 1f3acf4c29f367e40a3f589b51176ed24e28948f Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 02 九月 2025 17:54:42 +0800
Subject: [PATCH] 2025年09月02日17:54:39
---
app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java | 59 +++++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 47 insertions(+), 12 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 07c8a40..2da40bc 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
@@ -102,13 +102,16 @@
if (list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
GatewayBean gatewayBean = list.get(i);
- if (!getGatewaySpk().contains(gatewayBean.getGatewayType())) {
- continue;
- }
- if (TextUtils.isEmpty(gatewayBean.getDevice_mac())
- || TextUtils.isEmpty(gatewayBean.getSid())
- || TextUtils.isEmpty(gatewayBean.getOid())) {
- continue;
+ if (gatewayBean.isActivate()) {
+ //宸叉縺娲伙紙getGatewayType锛実etDevice_mac锛実etSid锛実etOid锛夋墠鏈夊��
+ if (!getGatewaySpk().contains(gatewayBean.getGatewayType())) {
+ continue;
+ }
+ if (TextUtils.isEmpty(gatewayBean.getDevice_mac())
+ || TextUtils.isEmpty(gatewayBean.getSid())
+ || TextUtils.isEmpty(gatewayBean.getOid())) {
+ continue;
+ }
}
//鐢╤omeId绛涢�夊綋鍓嶄綇瀹呯殑閫嗗彉鍣ㄥ垪琛�
if (gatewayBean.getHomeId().equals(homeId)) {
@@ -137,9 +140,9 @@
try {
List<GatewayBean> newList = new ArrayList<>();
//浜戠鏈夎澶囧垪琛紝鏈湴娌℃湁锛屽嵆HDLLinkLocalGateway.getInstance().getGatewayList()娌℃湁锛岄噷闈細璋冪敤refreshGatewayCacheData()鏂规硶铏氭嫙涓�涓�嗗彉鍣ㄥ疄浣撴坊鍔犳湰鍦板垪琛ㄩ噷闈紱
- List<GatewayBean> list = getCurrentHomeGatewayList(homeId);
- if (list != null && list.size() > 0) {
- newList.addAll(list);
+ List<GatewayBean> localList = getCurrentHomeGatewayList(homeId);
+ if (localList != null && localList.size() > 0) {
+ newList.addAll(localList);
}
//鏈夊缃戯紝浠ヤ簯绔澶囧垪琛ㄤ负鍑�;浜戠娌℃湁锛屾湰鍦板瓨鍦紝鍒欏垹闄ゆ湰鍦帮紱鍚﹀垯锛屾病鏈夊缃戝彧鏈夊眬鍩熺綉锛屼互鏈湴newList鍒楄〃涓轰富,鎼滅储澶氬皯涓澶囧氨鏄剧ず澶氬皯涓�
@@ -149,6 +152,7 @@
CloudInverterDeviceBean cloudInverterDevice = cloudInverterDeviceList.get(i);
for (GatewayBean gatewayBean : newList) {
if (cloudInverterDevice.getOsn().equals(gatewayBean.getDevice_mac())) {
+ //鑾峰彇鏇村叏閫嗗彉鍣ㄨ鎯呭瓧娈�
checkNewList.add(gatewayBean);
break;
}
@@ -246,7 +250,7 @@
if (TextUtils.isEmpty(deviceId)) {
return;
}
- List<GatewayBean> list = getCurrentHomeGatewayList(homeId);
+ List<GatewayBean> list = HDLLinkLocalGateway.getInstance().getGatewayList();
if (list == null || list.size() == 0) {
return;
}
@@ -258,9 +262,10 @@
break;
}
}
- if (index > 0) {
+ if (index > -1) {
list.remove(index);
}
+
}
/**
@@ -1184,6 +1189,32 @@
}
/**
+ * 璁惧娓呯┖杩愯鏁版嵁
+ *
+ * @param mac 缃戝叧mac
+ * @param linkCallBack 鍥炶皟
+ */
+ public void DeviceClearData(String mac, LinkCallBack<Boolean> linkCallBack) {
+ String requestUrl = TopicApi.DEVICE_RUN_DATA_CLEAR;
+ TcpClient.getInstance().sendDataToLinkGateway(mac, requestUrl, null, "", new HDLLinkCallBack() {
+ @Override
+ public void onSuccess(String json) {
+ if (linkCallBack != null) {
+ linkCallBack.onSuccess(true);
+ }
+ }
+
+ @Override
+ public void onError(HDLLinkException e) {
+ if (linkCallBack != null) {
+ linkCallBack.onError(e);
+ }
+ }
+ });
+
+ }
+
+ /**
* 鑾峰彇閫嗗彉鍣ㄥ垪琛�,鏁村悎浜戠閫嗗彉鍣ㄥ垪琛ㄥ拰鏈湴閫嗗彉鍣ㄥ垪琛�(璁惧绫诲瀷鏈�:骞剁綉閫嗗彉鍣紝绂荤嚎閫嗗彉鍣紝璐熻浇涓績璁惧);
* 娉ㄦ剰:鏈夊缃戯紝浠ヤ簯绔澶囧垪琛ㄤ负鍑�;浜戠娌℃湁锛屾湰鍦板瓨鍦紝鍒欏垹闄ゆ湰鍦帮紱鍚﹀垯锛屾病鏈夊缃戝彧鏈夊眬鍩熺綉锛屼互鏈湴涓轰富,鎼滅储澶氬皯涓澶囧氨鏄剧ず澶氬皯涓�
*
@@ -1191,6 +1222,7 @@
* @param cloudCallBeak 杩斿洖閫嗗彉鍣ㄥ垪琛�
*/
public void getCurrentHomeLocalAndCloudGatewayList(String homeId, CloudCallBeak<List<GatewayBean>> cloudCallBeak) {
+// HDLLinkLocalGateway.getInstance().getGatewayList().clear();//鍏堟竻绌轰箣鍓嶉�嗗彉鍣ㄥ垪琛�
searchCurrentHomeGateway(homeId, new GatewayCallBack() {
@Override
public void onSuccess(List<GatewayBean> gatewayBeanList) {
@@ -1342,6 +1374,7 @@
}
}
HdlLogLogic.print("璁惧鏈縺娲�(mac:" + cloudInverterDeviceBean.getOsn() + "))", true);
+ continue;
}
//鑾峰彇杩滅▼璁惧閫氳淇℃伅(鎷垮埌缃戝叧ID锛宮qtt閫氳绉橀挜)
getDeviceRemoteInfo(homeId, cloudInverterDeviceBean.getSpk(), cloudInverterDeviceBean.getOsn(), new CloudCallBeak<DeviceRemoteInfo>() {
@@ -1846,6 +1879,8 @@
}
gatewayBean.setSpk(cloudInverterDeviceBean.getSpk());//璁惧spk
gatewayBean.setActivate(cloudInverterDeviceBean.isActivate());//鏄惁婵�娲昏澶�(true锛氭縺娲伙紱false锛氭湭婵�娲�)
+ gatewayBean.setPopUpgrade(cloudInverterDeviceBean.isPopUpgrade());//鏀硅澶囨槸鍚︽湁寮圭獥鍗囩骇
+ gatewayBean.setSubPopUpgrade(cloudInverterDeviceBean.isSubPopUpgrade());//涓嬫寕璁惧鏄惁鏈夊脊绐楀崌绾�
}
--
Gitblit v1.8.0