From b63ff58e2c415bae2fb4741aebe710fa3576ff66 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期一, 23 三月 2026 13:11:47 +0800
Subject: [PATCH] 2026年03月23日13:11:38 备份代码
---
app/src/main/java/com/hdl/photovoltaic/utils/BleWifiConfiguratorUtils.java | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/utils/BleWifiConfiguratorUtils.java b/app/src/main/java/com/hdl/photovoltaic/utils/BleWifiConfiguratorUtils.java
index de3d49f..3de6a4a 100644
--- a/app/src/main/java/com/hdl/photovoltaic/utils/BleWifiConfiguratorUtils.java
+++ b/app/src/main/java/com/hdl/photovoltaic/utils/BleWifiConfiguratorUtils.java
@@ -325,8 +325,9 @@
if (bluetoothGatt != null) {
bluetoothGatt.disconnect(); // 鍏堟柇寮�杩炴帴
- bluetoothGatt.close();
- bluetoothGatt = null;
+// bluetoothGatt.close();
+// bluetoothGatt = null;
+ Log.d(TAG, "Connecting to 鍏堟柇寮�鏃ц摑鐗欒繛鎺�");
}
BluetoothDevice device = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(deviceAddress);
// 鑷姩杩炴帴 = false锛岄伩鍏嶇郴缁熺紦瀛樿繛鎺�
@@ -369,9 +370,14 @@
gatt.discoverServices();
} else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
isConnected = false;
+ if (bluetoothGatt != null) {
+ bluetoothGatt.close();
+ bluetoothGatt = null;
+ }
if (connectListener != null) {
callbackHandler.post(() -> connectListener.onDisconnected());
}
+
Log.d(TAG, "Connected to GATT server, onDisconnected");
}//
}
@@ -458,6 +464,7 @@
}
}
}
+
@Override
public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) {
//todo 鍚庨潰鍏肩敤mtc鍒嗗寘鐨勶紝鐩墠榛樿璁剧疆512瀛楄妭
--
Gitblit v1.8.0