From ce83a2fb54a9526fd76aa3ef8ba79c33940921fc Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 27 三月 2026 16:13:44 +0800
Subject: [PATCH] 2026年03月27日16:13:41
---
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java | 63 +++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 1 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 578f42a..299d138 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -42,6 +42,7 @@
import com.hdl.photovoltaic.config.AppConfigManage;
import com.hdl.photovoltaic.config.UserConfigManage;
import com.hdl.photovoltaic.enums.LogoutType;
+import com.hdl.photovoltaic.enums.PowerStationType;
import com.hdl.photovoltaic.internet.HttpClient;
import com.hdl.photovoltaic.internet.HttpServer.MyNanoHttpServer;
import com.hdl.photovoltaic.internet.TcpClient;
@@ -1109,6 +1110,16 @@
}
break;
+ case HDLUniMP.UNI_EVENT_REPLY_BLUETOOTH_Bms_Device_Bluetooth_Get: {
+ //鑾峰彇钃濈墮鐘舵�侊紙BMS璁惧锛�
+ this.uniGetOrSetDeviceBluetooth(mode_type, data, TopicApi.GATEWAY_Bluetooth_Get, callback);
+ }
+ break;
+ case HDLUniMP.UNI_EVENT_REPLY_BLUETOOTH_Bms_Device_Bluetooth_Set: {
+ //钃濈墮璁剧疆寮�鍚�/鍏抽棴锛圔MS璁惧锛�
+ this.uniGetOrSetDeviceBluetooth(mode_type, data, TopicApi.GATEWAY_Bluetooth_Set, callback);
+ }
+ break;
}
}
@@ -1117,6 +1128,51 @@
HdlLogLogic.print("uni---鍙戦��---" + e.getMessage(), true);
}
+ }
+
+ /**
+ * 鑾峰彇璁惧钃濈墮鐘舵��,璁剧疆钃濈墮寮�寮�鍚垨鑰呭叧闂�
+ *
+ * @param callback -
+ */
+ private void uniGetOrSetDeviceBluetooth(String type, Object data, String TopicApi, DCUniMPJSCallback callback) {
+ String mac = getKeyValue("mac", getKeyValue("data", data));
+ JsonArray jsonArray = new JsonArray();
+ JsonObject jObject = null;
+ String attribute_data = getKeyValue("attribute_data", getKeyValue("data", data));
+ if (!TextUtils.isEmpty(attribute_data)) {
+ try {
+ jObject = new Gson().fromJson(attribute_data, JsonObject.class);
+ } catch (Exception ignored) {
+ jObject = new JsonObject();
+ }
+ }
+ jsonArray.add(jObject);
+ TcpClient.getInstance().sendDataToLinkGateway(mac, true, TopicApi, jsonArray, "", new HDLLinkCallBack() {
+ @Override
+ public void onSuccess(String s) {
+ if (callback != null) {
+ try {
+ if (s.startsWith("{")) {
+ uniSuccessCallback(type, new Gson().fromJson(s, JsonObject.class), callback);
+ } else if (s.startsWith("[")) {
+ uniSuccessCallback(type, new Gson().fromJson(s, JsonArray.class), callback);
+ } else {
+ uniSuccessCallback(type, s, callback);
+ }
+ } catch (Exception e) {
+ uniSuccessCallback(type, s, callback);
+ }
+ }
+ }
+
+ @Override
+ public void onError(HDLLinkException e) {
+ if (callback != null) {
+ uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
+ }
+ }
+ });
}
/**
@@ -2787,8 +2843,13 @@
*/
private void uniGetCurrentHomeLocalAndCloudGatewayList(String type, Object data, DCUniMPJSCallback callback) {
String homeId = getKeyValue("homeId", getKeyValue("data", data));
+ String plantType = getKeyValue("plantType", getKeyValue("data", data));
+ if (plantType.equals("bms")) {
+ plantType = PowerStationType.BMS;
+ }
+// plantType = PowerStationType.BMS;//妯℃嫙娴嬭瘯
// UserConfigManage.getInstance().setHomeId(homeId);
- HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(homeId, new CloudCallBeak<List<GatewayBean>>() {
+ HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(homeId, plantType, new CloudCallBeak<List<GatewayBean>>() {
@Override
public void onSuccess(List<GatewayBean> list) {
List<GatewayBean> newList = sortLogic(list);
--
Gitblit v1.8.0