From 5bac3017277a90d56ba3e653f380d74025bb7a31 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 24 三月 2026 16:04:11 +0800
Subject: [PATCH] 2026年03月24日16:04:09
---
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..da08be8 100644
--- a/app/src/main/java/com/hdl/photovoltaic/utils/BleWifiConfiguratorUtils.java
+++ b/app/src/main/java/com/hdl/photovoltaic/utils/BleWifiConfiguratorUtils.java
@@ -327,6 +327,7 @@
bluetoothGatt.disconnect(); // 鍏堟柇寮�杩炴帴
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");
}//
}
@@ -423,7 +429,7 @@
}
return;
}
- Log.e(TAG, "onCharacteristicWrite: 鍐欏叆鎴愬姛鍥炲");
+ Log.d(TAG, "onCharacteristicWrite: 鍐欏叆鎴愬姛鍥炲");
if (characteristic.getUuid().equals(charUuid)) {
//鍐欏叆鎴愬姛
if (writeListener != null) {
@@ -435,7 +441,7 @@
@Override
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
- Log.e(TAG, "onCharacteristicChanged: " + characteristic.getUuid());
+ Log.d(TAG, "onCharacteristicChanged: " + characteristic.getUuid());
//鏀跺埌钃濈墮鍥炲鐨勬暟
if (characteristic.getUuid().equals(notifyCharUuid) && writeListener != null) {
byte[] value = characteristic.getValue();
@@ -458,6 +464,7 @@
}
}
}
+
@Override
public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) {
//todo 鍚庨潰鍏肩敤mtc鍒嗗寘鐨勶紝鐩墠榛樿璁剧疆512瀛楄妭
--
Gitblit v1.8.0