| | |
| | | } |
| | | |
| | | /** |
| | | * 添加【设备列表】到本地缓存 |
| | | * |
| | | * @param list -设备列表 |
| | | */ |
| | | public void setListDevice(List<CloudInverterDeviceBean> list) { |
| | | try { |
| | | if (list == null || list.size() == 0) { |
| | | return; |
| | | } |
| | | if (this.mListDevice.size() == 0) { |
| | | this.mListDevice.addAll(list); |
| | | return; |
| | | } |
| | | for (int i = 0; i < list.size(); i++) { |
| | | this.setSingleDevice(list.get(i)); |
| | | } |
| | | } catch (Exception ignored) { |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取设备列表(安装商) |
| | | * |
| | | * @param searchTxt 搜索内容 |
| | |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加【设备列表】到本地缓存 |
| | | * |
| | | * @param list -设备列表 |
| | | */ |
| | | public void setListDevice(List<CloudInverterDeviceBean> list) { |
| | | try { |
| | | if (list == null || list.size() == 0) { |
| | | return; |
| | | } |
| | | if (this.mListDevice.size() == 0) { |
| | | this.mListDevice.addAll(list); |
| | | return; |
| | | } |
| | | for (int i = 0; i < list.size(); i++) { |
| | | this.setSingleDevice(list.get(i)); |
| | | } |
| | | } catch (Exception ignored) { |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 修改设备名称逆变器BMS电池包 |
| | | * 描述: 修改设备名称,支持逆变器,BMS,电池包设备名称修改 |
| | | * |
| | | * @param homeId 住宅id |
| | | * @param deviceType 设备类型(INV:逆变器,BMS:BMS控制盒,BATTERY:电池单元) |
| | | * @param deviceId 设备id(deviceType = INV 是逆变器deviceId;deviceType = BMS 是BMS的deviceOidId;deviceType = BATTERY 是电池包的deviceOidId) |
| | | * @param cloudCallBeak 回调update |
| | | */ |
| | | public void setRename(String homeId, String deviceType, String deviceId, String name, CloudCallBeak<Boolean> cloudCallBeak) { |
| | | String requestUrl = HttpApi.POST_Device_Rename; |
| | | JsonObject json = new JsonObject(); |
| | | json.addProperty("homeId", homeId); |
| | | json.addProperty("name", name); |
| | | json.addProperty("deviceType", deviceType);//设备类型(INV:逆变器,BMS:BMS控制盒,BATTERY:电池单元) |
| | | json.addProperty("deviceId", deviceId);//设备id(deviceType = INV 是逆变器deviceId;deviceType = BMS 是BMS的deviceOidId;deviceType = BATTERY 是电池包的deviceOidId) |
| | | // json.addProperty("zoneType", "password");//区域 |
| | | HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String str) { |
| | | |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(true); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onFailure(e); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置网关远程参数 |
| | |
| | | * @param cloudCallBeak 返回逆变器列表 |
| | | */ |
| | | public void getCurrentHomeLocalAndCloudGatewayList(String homeId, CloudCallBeak<List<GatewayBean>> cloudCallBeak) { |
| | | HdlDeviceLogic.getInstance().searchCurrentHomeGateway(homeId,new GatewayCallBack() { |
| | | HdlDeviceLogic.getInstance().searchCurrentHomeGateway(homeId, new GatewayCallBack() { |
| | | @Override |
| | | public void onSuccess(List<GatewayBean> gatewayBeanList) { |
| | | //局域网有2种情况(1:有局域网,有外网;2:有局域网,没有外网); |
| | |
| | | * |
| | | * @param gatewayCallBack - |
| | | */ |
| | | public void searchCurrentHomeGateway(String homeId,GatewayCallBack gatewayCallBack) { |
| | | public void searchCurrentHomeGateway(String homeId, GatewayCallBack gatewayCallBack) { |
| | | List<String> spks = this.getGatewaySpk(); |
| | | //网关搜索 |
| | | HDLLinkLocalGateway.getInstance().refreshGatewayByHomeIdAndSpk(homeId, spks, true, gatewayCallBack); |
| | |
| | | * @param deviceMac 设备mac, |
| | | * @param callBeak 返回 true=本地连接;false=远程; |
| | | */ |
| | | public void isLocalConnect(String homeId,String deviceMac, CloudCallBeak<Boolean> callBeak) { |
| | | searchCurrentHomeGateway(homeId,new GatewayCallBack() { |
| | | public void isLocalConnect(String homeId, String deviceMac, CloudCallBeak<Boolean> callBeak) { |
| | | searchCurrentHomeGateway(homeId, new GatewayCallBack() { |
| | | @Override |
| | | public void onSuccess(List<GatewayBean> gatewayBeanList) { |
| | | if (gatewayBeanList == null || gatewayBeanList.size() == 0) { |