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 | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 55 insertions(+), 0 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 76f8c2f..299d138 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -1110,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;
}
}
@@ -1121,6 +1131,51 @@
}
/**
+ * 鑾峰彇璁惧钃濈墮鐘舵��,璁剧疆钃濈墮寮�寮�鍚垨鑰呭叧闂�
+ *
+ * @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);
+ }
+ }
+ });
+ }
+
+ /**
* Uni(鍙栨秷/鏆傚仠)AI鑱婂ぉ瀵硅瘽
*
* @param callback -
--
Gitblit v1.8.0