| | |
| | | * 获取当前住宅的【主】逆变器列表 |
| | | */ |
| | | public GatewayBean getCurrentHomeMainGateway() { |
| | | List<GatewayBean> list = HDLLinkLocalGateway.getInstance().getGatewayList(); |
| | | if (list.size() > 0) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | GatewayBean gatewayBean = list.get(i); |
| | | if (TextUtils.isEmpty(gatewayBean.getDevice_mac())) { |
| | | continue; |
| | | } |
| | | if (gatewayBean.getMaster().equals(GatewayMasterType.MasterTrue) && gatewayBean.getHomeId().equals(UserConfigManage.getInstance().getHomeId())) { |
| | | //找到返回 |
| | | return gatewayBean; |
| | | } |
| | | return queryCurrentHomeMainGateway(this.getCurrentHomeGatewayList()); |
| | | } |
| | | |
| | | /** |
| | | * 查询当前住宅的【主】逆变器列表 |
| | | */ |
| | | public GatewayBean queryCurrentHomeMainGateway(List<GatewayBean> list) { |
| | | if (list == null || list.size() == 0) { |
| | | return null; |
| | | } |
| | | GatewayBean findGatewayBean = null; |
| | | for (int i = 0; i < list.size(); i++) { |
| | | GatewayBean gatewayBean = list.get(i); |
| | | if (gatewayBean.getMaster().equals(GatewayMasterType.MasterTrue) && gatewayBean.getHomeId().equals(UserConfigManage.getInstance().getHomeId())) { |
| | | //找到返回 |
| | | findGatewayBean = gatewayBean; |
| | | break; |
| | | } |
| | | } |
| | | return null; |
| | | return findGatewayBean; |
| | | } |
| | | |
| | | |