mac
2024-04-29 e4cb9970046ef8e7392368a051cae2ab5c84799a
app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
@@ -67,6 +67,11 @@
        return sHdlDeviceLogic;
    }
    public static final String kWp = "kWp";
    public static final String kWh = "kW.h";
    public static final String kW = "kW";
    /**
     * 获取当前住宅的逆变器列表(包括从的逆变器)
@@ -87,6 +92,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    逆变器mac
     */
    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);
        }
    }
@@ -284,7 +345,7 @@
            public void onSuccess(String str) {
                if (cloudCallBeak != null) {
                    cloudCallBeak.onSuccess(true);
                    //临时的逻辑,上传oid列表到云端(去掉,原因是我上传成功后,网关再次全量上传oid列表,会把之前oid列表覆盖掉)
                    //临时的逻辑,上传oid列表到云端
                    uploadOidDataToCloud(homeId, list, true, null);
                }
            }