From 162ca0f6633f3aa246a40e8ba3d3e9a54f3a4cb5 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期六, 11 五月 2024 14:45:21 +0800
Subject: [PATCH] 依赖1.0.21 sdk,解决数据乱的问题
---
app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 57 insertions(+), 1 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 d432bff..d364f58 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
@@ -89,6 +89,62 @@
return newList;
}
+ /**
+ * 娣诲姞閫嗗彉鍣ㄥ埌缂撳瓨鍒楄〃閲岄潰鍘�
+ *
+ * @param homeId 鐢电珯id
+ * @param newGatewayBean 閫嗗彉鍣ㄥ璞�
+ */
+ public void addGatewayToLocalCacheMemory(String homeId, GatewayBean newGatewayBean) {
+ if (newGatewayBean == null || TextUtils.isEmpty(homeId)) {
+ return;
+ }
+ List<GatewayBean> list = getCurrentHomeGatewayList(homeId);
+ if (list == null || list.size() == 0) {
+ return;
+ }
+ int index = -1;
+ for (int i = 0; i < list.size(); i++) {
+ GatewayBean gatewayBean = list.get(i);
+ if (gatewayBean.getDevice_mac().equals(newGatewayBean.getDevice_mac())) {
+ index = i;
+ break;
+ }
+ }
+ if (index > 0) {
+ list.remove(index);
+ list.add(index, newGatewayBean);
+
+ }
+ }
+
+ /**
+ * 绉婚櫎缂撳瓨鍒楄〃閲岄潰閫嗗彉鍣�
+ *
+ * @param homeId 鐢电珯id
+ * @param mac 閫嗗彉鍣╩ac
+ */
+ public void removeLocalCacheMemoryGateway(String homeId, String mac) {
+ if (TextUtils.isEmpty(mac)) {
+ return;
+ }
+ List<GatewayBean> list = getCurrentHomeGatewayList(homeId);
+ if (list == null || list.size() == 0) {
+ return;
+ }
+ int index = -1;
+ for (int i = 0; i < list.size(); i++) {
+ GatewayBean gatewayBean = list.get(i);
+ if (gatewayBean.getDevice_mac().equals(mac)) {
+ index = i;
+ break;
+ }
+ }
+ if (index > 0) {
+ list.remove(index);
+ }
+ }
+
/**
* 閫嗗彉鍣ㄤ笂浼犳暟鎹埌浜戠(鍖呮嫭:sid锛宱id)
@@ -284,7 +340,7 @@
public void onSuccess(String str) {
if (cloudCallBeak != null) {
cloudCallBeak.onSuccess(true);
- //涓存椂鐨勯�昏緫锛屼笂浼爋id鍒楄〃鍒颁簯绔紙鍘绘帀锛屽師鍥犳槸鎴戜笂浼犳垚鍔熷悗锛岀綉鍏冲啀娆″叏閲忎笂浼爋id鍒楄〃锛屼細鎶婁箣鍓峯id鍒楄〃瑕嗙洊鎺夛級
+ //涓存椂鐨勯�昏緫锛屼笂浼爋id鍒楄〃鍒颁簯绔�
uploadOidDataToCloud(homeId, list, true, null);
}
}
--
Gitblit v1.8.0