From 5e2e1fc7fc23d5fa035608bc415e9eac73ce2e37 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期三, 27 十一月 2024 13:11:20 +0800
Subject: [PATCH] 2024年11月27日13:11:17

---
 app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java |   50 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 46 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 571cc42..f5eb2c4 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
@@ -8,6 +8,8 @@
 import com.google.gson.JsonObject;
 import com.google.gson.reflect.TypeToken;
 import com.hdl.linkpm.sdk.core.exception.HDLException;
+import com.hdl.photovoltaic.bean.InverterBean;
+import com.hdl.photovoltaic.bean.LocalResponse;
 import com.hdl.photovoltaic.bean.PageNumberObject;
 import com.hdl.photovoltaic.config.AppConfigManage;
 import com.hdl.photovoltaic.config.UserConfigManage;
@@ -909,7 +911,7 @@
      * @param mac          缃戝叧mac
      * @param linkCallBack 鍥炶皟
      */
-    public void getGatewayInfo(String mac, LinkCallBack<GatewayBean> linkCallBack) {
+    public void getGatewayInfo(String mac, LinkCallBack<InverterBean> linkCallBack) {
         String requestUrl = TopicApi.GET_GATEWAY_INFO;
         JsonObject json = new JsonObject();
         json.addProperty("device_mac", mac);
@@ -925,11 +927,11 @@
                 }
 
                 Gson gson = new Gson();
-                Type typeOfT = new TypeToken<BaseLocalResponse<GatewayBean>>() {
+                Type typeOfT = new TypeToken<BaseLocalResponse<InverterBean>>() {
                 }.getType();
-                BaseLocalResponse<GatewayBean> baseLocalResponse = gson.fromJson(json, typeOfT);
+                BaseLocalResponse<InverterBean> baseLocalResponse = gson.fromJson(json, typeOfT);
                 if (baseLocalResponse == null || baseLocalResponse.getObjects() == null) {
-                    linkCallBack.onSuccess(new GatewayBean());
+                    linkCallBack.onSuccess(new InverterBean());
                 } else {
                     linkCallBack.onSuccess(baseLocalResponse.getObjects());
                 }
@@ -1644,6 +1646,46 @@
     }
 
     /**
+     * 閫嗗彉鍣ㄥ瘑鐮佺櫥褰�
+     *
+     * @param mac      閫嗗彉鍣╩ac
+     * @param password 閫嗗彉鍣ㄥ瘑鐮�
+     */
+    public void getPasswordVerification(String mac, String password, LinkCallBack<LocalResponse> callBeak) {
+        String requestUrl = TopicApi.DELETING_GATEWAY_password_verifiy;
+        JsonObject json = new JsonObject();
+        json.addProperty("password", password);
+        json.addProperty("mac", mac);
+        TcpClient.getInstance().sendDataToLinkGateway(mac, false, requestUrl, json, "", new HDLLinkCallBack() {
+            @Override
+            public void onSuccess(String msg) {
+                try {
+
+                    Gson gson = new Gson();
+                    LocalResponse localResponse = gson.fromJson(msg, LocalResponse.class);
+                    if (localResponse == null) {
+                        localResponse = new LocalResponse();
+                    }
+                    if (callBeak != null) {
+                        callBeak.onSuccess(localResponse);
+                    }
+                } catch (Exception e) {
+                    if (callBeak != null) {
+                        callBeak.onSuccess(new LocalResponse());
+                    }
+                }
+            }
+
+            @Override
+            public void onError(HDLLinkException e) {
+                if (callBeak != null) {
+                    callBeak.onError(e);
+                }
+            }
+        });
+    }
+
+    /**
      * 鍒锋柊閫嗗彉鍣ㄧ紦瀛樹俊鎭�(鍖呮嫭璁剧疆mqtt绉橀挜锛�
      * 娉�: //鐩殑鏄负浜嗚幏鍙栨嬁鍒扮綉鍏矷D锛宮qtt閫氳绉橀挜绛変俊鎭紝缂撳瓨鏈湴閫嗗彉鍣ㄥ垪琛ㄩ噷闈紝鍙戦�佹暟鎹暟鎹椂鑷姩鍘荤紦瀛樺垪琛ㄩ噷闈㈠幓鏌ユ壘锛�
      * 1:鏈湴瀛樺湪,鏇存柊淇℃伅鍗冲彲;

--
Gitblit v1.8.0