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/uni/HDLUniMP.java | 2 +
app/src/main/java/com/hdl/photovoltaic/other/HdlBluetoothLogic.java | 4 ++
app/src/main/java/com/hdl/photovoltaic/internet/api/TopicApi.java | 2 +
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java | 55 +++++++++++++++++++++++++++
4 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/internet/api/TopicApi.java b/app/src/main/java/com/hdl/photovoltaic/internet/api/TopicApi.java
index d23aa48..6a23dd2 100644
--- a/app/src/main/java/com/hdl/photovoltaic/internet/api/TopicApi.java
+++ b/app/src/main/java/com/hdl/photovoltaic/internet/api/TopicApi.java
@@ -246,6 +246,8 @@
public static final String NATIVE_MODBUS_DOWN_SLAVE_REPLY = "/user/%s/custom/native/inverter/down_reply/slaveoid/%s";
public static final String DELETING_GATEWAY_password_verifiy = "/user/%s/custom/native/inverter/password_verifiy";
+ public static final String GATEWAY_Bluetooth_Get = "/user/%s/custom/bluetooth/get";//缃戝叧钃濈墮鑾峰彇
+ public static final String GATEWAY_Bluetooth_Set = "/user/%s/custom/bluetooth/set";//缃戝叧钃濈墮璁剧疆
}
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlBluetoothLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlBluetoothLogic.java
index 5609602..4ea75b5 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlBluetoothLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlBluetoothLogic.java
@@ -142,6 +142,7 @@
this.configurator.release();
}
+
/**
* 鑾峰彇鏉冮檺鐘舵��( 鏉冮檺妫�鏌ョ粨鏋滃姣�)
* 妫�鏌ユ槸鍚︽嫢鏈夊繀瑕佺殑杩愯鏃舵潈闄愶紙Android 12+ 闇�鍔ㄦ�佺敵璇锋柊鏉冮檺锛�
@@ -167,4 +168,7 @@
}
return true;
}
+
+
+
}
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 -
diff --git a/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java b/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java
index 2cb170c..9b4939a 100644
--- a/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java
+++ b/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java
@@ -167,6 +167,8 @@
public final static String UNI_EVENT_REPLY_BLUETOOTH_Send = "uni_send_data_to_device";//鍙戦�佹暟鎹粰璁惧
public final static String UNI_EVENT_REPLY_BLUETOOTH_status_check = "uni_check_bluetooth_status";//妫�鏌ヨ摑鐗欒繛鎺ョ姸鎬�
public final static String UNI_EVENT_REPLY_BLUETOOTH_Release = "uni_release_bluetooth_resource";//閲婃斁钃濈墮璧勬簮
+ public final static String UNI_EVENT_REPLY_BLUETOOTH_Bms_Device_Bluetooth_Get = "device_bluetooth_get";//钃濈墮鐘舵�佽幏鍙栵紙BMS璁惧锛�
+ public final static String UNI_EVENT_REPLY_BLUETOOTH_Bms_Device_Bluetooth_Set = "device_bluetooth_set";//钃濈墮璁剧疆寮�鍚�/鍏抽棴锛圔MS璁惧锛�
//endregioD
//region --------銆愬師鐢熴�戜富鍔ㄥ彂閫佸埌銆愬皬绋嬪簭銆�--------
--
Gitblit v1.8.0