From 0efa4dfdfad5647abb73d38deb3e8ab5f444e5cb Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 20 三月 2026 17:29:33 +0800
Subject: [PATCH] 2026年03月20日17:29:31
---
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