| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 逆变器上传数据到云端(包括:sid,oid) |
| | |
| | | public void onSuccess(String str) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(true); |
| | | //临时的逻辑,上传oid列表到云端(去掉,原因是我上传成功后,网关再次全量上传oid列表,会把之前oid列表覆盖掉) |
| | | //临时的逻辑,上传oid列表到云端 |
| | | uploadOidDataToCloud(homeId, list, true, null); |
| | | } |
| | | } |