| | |
| | | import com.hdl.hdlhttp.HxHttp; |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.photovoltaic.bean.HttpResponsePack; |
| | | import com.hdl.photovoltaic.bean.LocalResponse; |
| | | import com.hdl.photovoltaic.config.AppConfigManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.internet.HttpClient; |
| | |
| | | import com.hdl.sdk.link.common.exception.HDLLinkCode; |
| | | import com.hdl.sdk.link.common.exception.HDLLinkException; |
| | | import com.hdl.sdk.link.core.bean.gateway.GatewayBean; |
| | | import com.hdl.sdk.link.core.bean.request.BaseLocalRequest; |
| | | import com.hdl.sdk.link.core.bean.response.BaseLocalResponse; |
| | | import com.hdl.sdk.link.core.callback.GatewayCallBack; |
| | | import com.hdl.sdk.link.core.callback.HDLLinkCallBack; |
| | | import com.hdl.sdk.link.gateway.HDLLinkLocalGateway; |
| | |
| | | */ |
| | | public class HdlDeviceLogic { |
| | | 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 (gatewayBean.getMaster().equals("true") |
| | | && gatewayBean.getHomeId().equals(UserConfigManage.getInstance().getHomeId())) { |
| | | if("0101050217BBC400".equals(gatewayBean.getOid()))//测试时过滤掉无效的,后面这加代码要删除 |
| | | continue; |
| | | newList.add(gatewayBean); |
| | | } |
| | | } |
| | | } |
| | | return newList; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前对象 |
| | |
| | | * @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()); |
| | |
| | | return; |
| | | } |
| | | Gson gson = new Gson(); |
| | | Type typeOfT = new TypeToken<List<OidBean>>() { |
| | | Type typeOfT = new TypeToken<BaseLocalResponse<List<OidBean>>>() { |
| | | }.getType(); |
| | | List<OidBean> list = gson.fromJson(json, typeOfT); |
| | | if (linkCallBack != null) { |
| | | linkCallBack.onSuccess(list); |
| | | BaseLocalResponse<List<OidBean>> baseLocalResponse = gson.fromJson(json, typeOfT); |
| | | |
| | | if (linkCallBack == null) { |
| | | return; |
| | | } |
| | | if (baseLocalResponse == null || baseLocalResponse.getObjects() == null) { |
| | | linkCallBack.onSuccess(new ArrayList<>()); |
| | | } else { |
| | | linkCallBack.onSuccess(baseLocalResponse.getObjects()); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | for (int i = 0; i < removeSidList.size(); i++) { |
| | | //获取本地的毫米波 |
| | | //获取本地的逆变器 |
| | | removeInverter(removeSidList.get(i)); |
| | | } |
| | | |