From 24ea247fa736f51a3f813736fce3199435e35c86 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期四, 02 一月 2025 13:52:35 +0800 Subject: [PATCH] 2025年01月02日13:52:34 --- app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 47 insertions(+), 8 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..bc70bde 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;//鐢ㄦ潵鎵撳嵃鐨� @@ -425,12 +428,18 @@ break; //閫嗗彉鍣ㄤ互澶綉閰嶇疆 case HDLUniMP.UNI_EVENT_REPLY_DEVICE_ETHERNET_SET: { - uniGetAndSetNetwork(mode_type, data, TopicApi.DELETING_GATEWAY_ETHERNET_EDIT, callback); + if (callback != null) { + uniSuccessCallback(type, "", callback); + } + //uniGetAndSetNetwork(mode_type, data, TopicApi.DELETING_GATEWAY_ETHERNET_EDIT, callback); } break; //閫嗗彉鍣ㄤ互澶綉鑾峰彇 case HDLUniMP.UNI_EVENT_REPLY_DEVICE_ETHERNET_GET: { - uniGetAndSetNetwork(mode_type, data, TopicApi.DELETING_GATEWAY_ETHERNET_GET, callback); + if (callback != null) { + uniSuccessCallback(type, "", callback); + } + //uniGetAndSetNetwork(mode_type, data, TopicApi.DELETING_GATEWAY_ETHERNET_GET, callback); } break; @@ -764,6 +773,8 @@ } catch (Exception e) { uniSuccessCallback(type, json, callback); } + long endTime = System.currentTimeMillis() - startTime; + Log.d("====鑰楁椂鏃堕棿====", String.valueOf(endTime)); } } } @@ -811,7 +822,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 +851,7 @@ //region ******uni鎺ュ彛鏂规硶****** /** - * link杩涜瀵嗙爜楠岃瘉 + * link杩涜鏈湴瀵嗙爜鐧诲綍楠岃瘉 */ private void uniCheckPasswordVerification(String type, Object data, DCUniMPJSCallback callback) { String password = getKeyValue("password", getKeyValue("data", data)); @@ -2365,8 +2376,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 +2387,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 +2398,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 +2797,14 @@ //HdlLogLogic.print("uni---鍙戦��---ModBus---" + Arrays.toString(modBusBean.getData()), true); //鍙戦�乵odbus鍗忚 - HDLModBusConnect.getInstance().Send(modBusBean.getMac(), modBusBean.getData(), new ModbusCallBack() { + long startTime = System.currentTimeMillis(); + HDLModBusConnect.getInstance().asyncSend(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