From c11d709a36f61948676c0f28613d3cbd97e8851f Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期四, 21 三月 2024 13:08:45 +0800
Subject: [PATCH] s2024年03月21日13:08:39

---
 app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java |    9 +++++----
 1 files changed, 5 insertions(+), 4 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 1066f02..90a3a1e 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
@@ -568,7 +568,7 @@
     public void editGatewayParam(String mac, LinkCallBack<Boolean> linkCallBack) {
         String requestUrl = TopicApi.SET_GATEWAY_EDIT;
         JsonObject json = new JsonObject();
-        json.addProperty("master", GatewayMasterType.MasterFalse);
+        json.addProperty("master", GatewayMasterType.MasterTrue);
         TcpClient.getInstance().sendDataToLinkGateway(mac, requestUrl, json, "", new HDLLinkCallBack() {
             @Override
             public void onSuccess(String msg) {
@@ -628,16 +628,16 @@
      */
     public void initializeGateway(String mac, LinkCallBack<Boolean> linkCallBack) {
         String requestUrl = TopicApi.GATEWAY_INITIALIZE_REMOTE;
-        JsonObject sendJsonObj = new JsonObject();
         JsonObject jObject = new JsonObject();
         jObject.addProperty("device_mac", mac);
-        sendJsonObj.add("objects", jObject);
-        TcpClient.getInstance().sendDataToLinkGateway(mac, requestUrl, sendJsonObj, "", new HDLLinkCallBack() {
+        jObject.addProperty("reset_factory", "true");//涓篺alse鎴栨棤姝ゅ瓧娈碉紝鍒欎负"娓呴櫎鏁版嵁"
+        TcpClient.getInstance().sendDataToLinkGateway(mac, requestUrl, jObject, "", new HDLLinkCallBack() {
             @Override
             public void onSuccess(String json) {
                 if (linkCallBack != null) {
                     linkCallBack.onSuccess(true);
                 }
+                HdlLogLogic.print("鍒濆鍖栭�嗗彉鍣ㄦ垚鍔�-->mac:" + mac, true);
             }
 
             @Override
@@ -645,6 +645,7 @@
                 if (linkCallBack != null) {
                     linkCallBack.onError(e);
                 }
+                HdlLogLogic.print("鍒濆鍖栭�嗗彉鍣ㄥけ璐�-->mac:" + mac + "--->" + e.getMsg() + "(" + e.getCode() + ")", true);
             }
         });
 

--
Gitblit v1.8.0