From 2c7615cd73dfa6a7ca4df975430d2217524513d2 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期四, 28 九月 2023 11:38:28 +0800 Subject: [PATCH] 2023年09月28日11:38:24 --- app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java | 65 +++++++++++++++++++++++++++++++- 1 files changed, 62 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java index 0f57fad..820d6b8 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java @@ -57,8 +57,8 @@ GatewayBean gatewayBean = list.get(i); if (gatewayBean.getMaster().equals("true") && gatewayBean.getHomeId().equals(UserConfigManage.getInstance().getHomeId())) { - if("0101050217BBC400".equals(gatewayBean.getOid()))//娴嬭瘯鏃惰繃婊ゆ帀鏃犳晥鐨勶紝鍚庨潰杩欏姞浠g爜瑕佸垹闄� - continue; +// if ("0101050217BBC400".equals(gatewayBean.getOid()))//娴嬭瘯鏃惰繃婊ゆ帀鏃犳晥鐨勶紝杩欒鍚庨潰浠g爜瑕佸垹闄� +// continue; newList.add(gatewayBean); } } @@ -318,6 +318,64 @@ } /** + * 缃戝叧鏃堕棿璇诲彇 + * + * @param mac 璁惧mac + * @param linkCallBack 鍥炶皟update + */ + public void getGatewayTime(String mac, LinkCallBack<Boolean> linkCallBack) { + String requestUrl = TopicApi.GET_GATEWAY_TIME; + TcpClient.getInstance().sendDataToLinkGateway(mac, requestUrl, null, "", new HDLLinkCallBack() { + @Override + public void onSuccess(String msg) { + if (linkCallBack != null) { + linkCallBack.onSuccess(true); + } + } + + @Override + public void onError(HDLLinkException e) { + if (linkCallBack != null) { + linkCallBack.onError(e); + } + } + }); + + } + + /** + * 缃戝叧鏃堕棿淇敼 + * + * @param mac 璁惧mac + * @param linkCallBack 鍥炶皟update + */ + public void editGatewayTime(String mac, JsonObject jsonObject, LinkCallBack<Boolean> linkCallBack) { + String requestUrl = TopicApi.SET_GATEWAY_TIME_EDIT; +// JsonObject json = new JsonObject(); +// json.addProperty("master", "true"); +// "objects": { +// "date": "2020-08-15", +// "time": "17:25:20" +// } + TcpClient.getInstance().sendDataToLinkGateway(mac, requestUrl, jsonObject, "", new HDLLinkCallBack() { + @Override + public void onSuccess(String msg) { + if (linkCallBack != null) { + linkCallBack.onSuccess(true); + } + } + + @Override + public void onError(HDLLinkException e) { + if (linkCallBack != null) { + linkCallBack.onError(e); + } + } + }); + + } + + /** * 缂栬緫缃戝叧鍙傛暟 * * @param mac 璁惧mac @@ -344,7 +402,6 @@ }); } - /** * 鑾峰彇缃戝叧璇︽儏淇℃伅 @@ -490,11 +547,13 @@ HDLLinkLocalGateway.getInstance().getGatewayList().clear(); for (int i = 0; i < list.size(); i++) { CloudInverterDeviceBean cloudInverterDeviceBean = list.get(i); + //浜戠瀵硅薄鏁版嵁浜ゆ崲鍒版湰鍦板璞� GatewayBean gatewayBean = new GatewayBean(); gatewayBean.setOid(cloudInverterDeviceBean.getOid()); gatewayBean.setSid(cloudInverterDeviceBean.getSid()); gatewayBean.setGatewayId(cloudInverterDeviceBean.getGatewayId()); gatewayBean.setOnline(cloudInverterDeviceBean.isOnline()); + gatewayBean.setDevice_mac(cloudInverterDeviceBean.getOsn());//璁惧mac gatewayBean.setDevice_name(cloudInverterDeviceBean.getGatewayName()); gatewayBean.setHomeId(UserConfigManage.getInstance().getHomeId()); gatewayBean.setLocalEncrypt(true); -- Gitblit v1.8.0