From 0752b8900365704ba8d3e60a5afc66394628e2a4 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期一, 18 十二月 2023 16:20:14 +0800 Subject: [PATCH] 2023年12月18日16:20:08 --- app/src/main/java/com/hdl/photovoltaic/other/HdlOtaLogic.java | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 43 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlOtaLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlOtaLogic.java index 52b2f7e..88134a4 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlOtaLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlOtaLogic.java @@ -16,6 +16,7 @@ import com.hdl.linkpm.sdk.ota.bean.DeviceFirmwareBean; import com.hdl.linkpm.sdk.ota.bean.GatewayDriverBean; import com.hdl.photovoltaic.HDLApp; +import com.hdl.photovoltaic.config.AppConfigManage; import com.hdl.photovoltaic.config.UserConfigManage; import com.hdl.photovoltaic.internet.HttpClient; import com.hdl.photovoltaic.internet.HttpServer.MyNanoHttpServer; @@ -30,7 +31,9 @@ import com.hdl.photovoltaic.utils.Md5Utils; import com.hdl.sdk.link.common.exception.HDLLinkException; import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; +import com.hdl.sdk.link.core.bean.gateway.GatewayBean; import com.hdl.sdk.link.core.callback.HDLLinkCallBack; +import com.hdl.sdk.link.gateway.HDLLinkLocalGateway; import org.apache.commons.io.FileUtils; import org.greenrobot.eventbus.EventBus; @@ -378,13 +381,13 @@ //endregion + /** - * 璁剧疆缁堟涓嬭浇鏂囦欢鎸囦护 + * 鍙栨秷缁堟涓嬭浇鏂囦欢鎸囦护 */ - public void setStopDriversDownload() { + public void stopDownloadUpgradeFile() { this.stopDownload = true; } - /** * 鍚戜簯绔幏鍙栥�愯澶囧崌绾ф枃浠�(椹卞姩,鍥轰欢)涓嬭浇銆戝崌绾ф枃浠� * @@ -451,6 +454,43 @@ }); } + /** + * 鍙栨秷鍗囩骇椹卞姩,鍥轰欢鏂囦欢鎸囦护 + * + * @param mac 璁惧mac + * @param linkCallBack 鍥炶皟update + */ + public void cancelUpgrade(String mac, LinkCallBack<Boolean> linkCallBack) { + String requestUrl = TopicApi.SET_GATEWAY_REMOTE_EDIT; +// JsonObject json = new JsonObject(); +// json.addProperty("homeId", UserConfigManage.getInstance().getHomeId()); +// json.addProperty("server_addr", AppConfigManage.getUserRegionUrl()); +// json.addProperty("local_secret", UserConfigManage.getInstance().getLocalSecret()); +// //瑙e瘑璐熻浇鏁版嵁(鍐欏瘑閽ョ粰缃戝叧涓�瀹氭槸鏄庢枃锛屽洜涓洪偅鏃剁綉鍏宠繕娌℃湁瀵嗛挜) +// TcpClient.getInstance().sendDataToLinkGateway(mac, false, requestUrl, json, "", new HDLLinkCallBack() { +// @Override +// public void onSuccess(String msg) { +// GatewayBean gatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(mac); +// if (gatewayBean != null) { +// if (!TextUtils.isEmpty(UserConfigManage.getInstance().getLocalSecret())) { +// gatewayBean.setLocalEncrypt(true); +// } +// } +// if (linkCallBack != null) { +// linkCallBack.onSuccess(true); +// } +// +// } +// +// @Override +// public void onError(HDLLinkException e) { +// if (linkCallBack != null) { +// linkCallBack.onError(e); +// } +// } +// }); + } + /** * 鍚姩鏈湴鏈嶅姟 -- Gitblit v1.8.0