From d676b0b4ad2444a9342a0ee1a27f2583745a8c90 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 27 十二月 2024 11:55:18 +0800
Subject: [PATCH] 2024年12月27日11:55:15
---
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java | 43 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
index 1d0295e..e0327e1 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -13,6 +13,7 @@
import android.os.SystemClock;
import android.provider.Settings;
import android.text.TextUtils;
+import android.util.Log;
import androidx.core.app.ActivityCompat;
@@ -141,6 +142,8 @@
if (!HDLUniMP.UNI_APP_ID.equals(appId)) {
return;
}
+ long startTime = System.currentTimeMillis();
+ Log.d("===寮�濮嬫椂闂�===", String.valueOf(startTime));
String type = getKeyValue("type", data);//灏忕被
String logTag = getKeyValue("logTag", data);//鏍囪uni鎸囦护
String mode_type = "澶х被-" + topic + "---" + "灏忕被-" + type;//鐢ㄦ潵鎵撳嵃鐨�
@@ -764,6 +767,8 @@
} catch (Exception e) {
uniSuccessCallback(type, json, callback);
}
+ long endTime = System.currentTimeMillis() - startTime;
+ Log.d("====鑰楁椂鏃堕棿====", String.valueOf(endTime));
}
}
}
@@ -811,7 +816,7 @@
public void openUniMP(String path, JSONObject jsonObject) {
JSONObject json = this.createdJSONObject(jsonObject, true);
HDLUniMPSDKManager.getInstance().openUniMP(HDLUniMP.UNI_APP_ID, path, json, HdlUniLogic.this);
- HdlLogLogic.print("uni---缁勮uni鍙戦�佹暟鎹牸寮�---" + json, false);
+// HdlLogLogic.print("uni---缁勮uni鍙戦�佹暟鎹牸寮�---" + json, false);
}
/**
@@ -840,7 +845,7 @@
//region ******uni鎺ュ彛鏂规硶******
/**
- * link杩涜瀵嗙爜楠岃瘉
+ * link杩涜鏈湴瀵嗙爜鐧诲綍楠岃瘉
*/
private void uniCheckPasswordVerification(String type, Object data, DCUniMPJSCallback callback) {
String password = getKeyValue("password", getKeyValue("data", data));
@@ -2365,8 +2370,9 @@
HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(homeId, new CloudCallBeak<List<GatewayBean>>() {
@Override
public void onSuccess(List<GatewayBean> list) {
+ List<GatewayBean> newList = sortLogic(list);
if (callback != null) {
- uniSuccessCallback(type, list, callback);
+ uniSuccessCallback(type, newList, callback);
}
//EventBus浜嬩欢鍒嗗彂,杩涘叆浣忓畢寮�濮嬭闃呬富棰�
BaseEventBus baseEventBus = new BaseEventBus();
@@ -2375,7 +2381,7 @@
baseEventBus.setData(homeId);
EventBus.getDefault().post(baseEventBus);
//杩涙潵浣忓畢璇︽儏閮借涓婁紶涓�娆id鍒楄〃鍒颁簯绔�;
- HdlDeviceLogic.getInstance().uploadOidDataToCloud(homeId, list, false, null);
+ HdlDeviceLogic.getInstance().uploadOidDataToCloud(homeId, newList, false, null);
}
@Override
@@ -2386,6 +2392,31 @@
}
});
+ }
+
+ /**
+ * 杩涜鎺掑簭锛堥�嗗彉鍣�-璐熻浇涓績锛�
+ *
+ * @param list 婧愭暟鎹�
+ * @return 杩斿洖鍒楄〃
+ */
+ private List<GatewayBean> sortLogic(List<GatewayBean> list) {
+ if (list == null || list.size() == 0) {
+ return new ArrayList<>();
+ }
+ List<GatewayBean> newList = new ArrayList<>();
+ List<GatewayBean> inverterList = new ArrayList<>();
+ List<GatewayBean> lcList = new ArrayList<>();
+ for (int i = 0; i < list.size(); i++) {
+ if (list.get(i).getSpk().equals(HdlDeviceLogic.getInstance().INVERTER_DEVICE_SPK)) {
+ inverterList.add(list.get(i));
+ } else {
+ lcList.add(list.get(i));
+ }
+ }
+ newList.addAll(inverterList);
+ newList.addAll(lcList);
+ return newList;
}
/**
@@ -2760,12 +2791,14 @@
//HdlLogLogic.print("uni---鍙戦��---ModBus---" + Arrays.toString(modBusBean.getData()), true);
//鍙戦�乵odbus鍗忚
+ long startTime = System.currentTimeMillis();
HDLModBusConnect.getInstance().Send(modBusBean.getMac(), modBusBean.getData(), new ModbusCallBack() {
@Override
public void onSuccess(int[] data) {
uniSuccessCallback(type, data, callback);
// HdlLogLogic.print("uni---鎺ユ敹---ModBus---" + Arrays.toString(data), true);
-
+ long endTime = System.currentTimeMillis() - startTime;
+ Log.d("====Mobus鑰楁椂鏃堕棿====", String.valueOf(endTime));
}
@Override
--
Gitblit v1.8.0