| | |
| | | private static volatile HdlDeviceLogic sHdlDeviceLogic; |
| | | |
| | | /** |
| | | * 获取当前住宅的逆变器列表 |
| | | */ |
| | | public List<GatewayBean> getGatewayList() { |
| | | List<GatewayBean> newList = new ArrayList<>(); |
| | | 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.getHomeId()) |
| | | && gatewayBean.getHomeId().equals(UserConfigManage.getInstance().getHomeId())) { |
| | | newList.add(gatewayBean); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return newList; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取当前对象 |
| | | * |
| | | * @return HdlDeviceLogic |
| | |
| | | * @param sid - |
| | | * @param oid - |
| | | * @param name - |
| | | * @param cloudCallBeak |
| | | * @param cloudCallBeak - |
| | | */ |
| | | public void addInverterDeviceToCloud(String mac, String spk, String sid, String oid, String name, CloudCallBeak<Boolean> cloudCallBeak) { |
| | | |
| | |
| | | * @param mac 设备mac |
| | | * @param linkCallBack 回调update |
| | | */ |
| | | public void steGatewayParam(String mac, LinkCallBack<Boolean> linkCallBack) { |
| | | public void setGatewayRemoteParam(String mac, LinkCallBack<Boolean> linkCallBack) { |
| | | String requestUrl = TopicApi.SET_GATEWAY_REMOTE_EDIT; |
| | | JsonObject json = new JsonObject(); |
| | | json.addProperty("homeId", UserConfigManage.getInstance().getHomeId()); |
| | |
| | | @Override |
| | | public void onSuccess(List<CloudInverterDeviceBean> list) { |
| | | if (list == null || list.size() == 0) { |
| | | // //云端没有绑定逆变器,清空本地列表; |
| | | // //云端没有绑定逆变器,以本地为主; |
| | | // HDLLinkLocalGateway.getInstance().getGatewayList().clear(); |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(true); |
| | |
| | | } |
| | | } |
| | | for (int i = 0; i < removeSidList.size(); i++) { |
| | | //获取本地的毫米波 |
| | | //获取本地的逆变器 |
| | | removeInverter(removeSidList.get(i)); |
| | | } |
| | | |
| | |
| | | HdlDeviceLogic.getInstance().getCloudInverterDeviceList(UserConfigManage.getInstance().getHomeId(), new CloudCallBeak<List<CloudInverterDeviceBean>>() { |
| | | @Override |
| | | public void onSuccess(List<CloudInverterDeviceBean> list) { |
| | | if (list == null) { |
| | | if (list == null || list.size() == 0) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(true); |
| | | } |
| | | return; |
| | | } |
| | | if (list.size() <= 0) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(true); |
| | | } |
| | | return; |
| | | } |
| | | //清楚本地网关列表 |
| | | HDLLinkLocalGateway.getInstance().getGatewayList().clear(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | CloudInverterDeviceBean cloudInverterDeviceBean = list.get(i); |
| | |
| | | gatewayBean.setHomeId(UserConfigManage.getInstance().getHomeId()); |
| | | gatewayBean.setLocalEncrypt(true); |
| | | gatewayBean.setMaster("true"); |
| | | //添加网关 |
| | | HDLLinkLocalGateway.getInstance().getGatewayList().add(gatewayBean); |
| | | } |
| | | if (cloudCallBeak != null) { |