From e7648e2c8136eb09cb900e1098696c789f89ad2c Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 28 Aug 2025 20:48:43 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=E6=A0=87=E8=AE=B0=E4=B8=BA=E5=8E=9F=E5=AD=90=E6=80=A7=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/yunqiinnovation/ble_service/BleService.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/local_plugins/ble_service/android/src/main/kotlin/com/yunqiinnovation/ble_service/BleService.kt b/local_plugins/ble_service/android/src/main/kotlin/com/yunqiinnovation/ble_service/BleService.kt index 9b6ee6307..6847f3e6a 100644 --- a/local_plugins/ble_service/android/src/main/kotlin/com/yunqiinnovation/ble_service/BleService.kt +++ b/local_plugins/ble_service/android/src/main/kotlin/com/yunqiinnovation/ble_service/BleService.kt @@ -89,6 +89,7 @@ object BleService { // 扫描相关 private lateinit var scanHandler: Handler private val scanResults = ArrayList() + @Volatile private var isScanning = false // 是否是ota模式 From 5170daecfaa61bcaa03761982c7d7c83cba9759d Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 28 Aug 2025 20:49:18 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=8E=9F=E5=AD=90?= =?UTF-8?q?=E6=80=A7=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/yunqiinnovation/ble_service/BleService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local_plugins/ble_service/android/src/main/kotlin/com/yunqiinnovation/ble_service/BleService.kt b/local_plugins/ble_service/android/src/main/kotlin/com/yunqiinnovation/ble_service/BleService.kt index 6847f3e6a..dc8389a0e 100644 --- a/local_plugins/ble_service/android/src/main/kotlin/com/yunqiinnovation/ble_service/BleService.kt +++ b/local_plugins/ble_service/android/src/main/kotlin/com/yunqiinnovation/ble_service/BleService.kt @@ -354,7 +354,7 @@ object BleService { } catch (e: Exception) { Log.e(TAG, "启动扫描失败: ${e.message}", e) // Log.i(TAG, "liwei---------startScan 10") -// isScanning = false + isScanning = false return false } } From d29a60b41bdef3e53f74815dd6143fdb72c3bf2e Mon Sep 17 00:00:00 2001 From: fdp <1286779656@qq.com> Date: Thu, 28 Aug 2025 21:20:39 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E5=81=9C=E6=AD=A2opus=EF=BC=8C=E5=88=9A=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E5=90=8E=E5=BB=B6=E9=95=BF=E8=8E=B7=E5=8F=96=E7=94=B5?= =?UTF-8?q?=E9=87=8F=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/modules/home/controllers/home_controller.dart | 8 ++++++-- .../Sources/agent_service/AgentServiceImpl.swift | 2 +- .../azure_speech/Sources/tools/MicrophoneCapture.swift | 4 ++-- .../ios/ble_service/Sources/ble_service/BleService.swift | 3 ++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/modules/home/controllers/home_controller.dart b/lib/modules/home/controllers/home_controller.dart index d3a95129e..4e63d2c82 100644 --- a/lib/modules/home/controllers/home_controller.dart +++ b/lib/modules/home/controllers/home_controller.dart @@ -145,12 +145,16 @@ class HomeController extends GetxController { update(); if (!wasConnected && isNowConnected) { - await _bleManager.fetchDeviceInfo(); + // 连接成功后等待1秒再获取设备信息 + Future.delayed(const Duration(seconds: 1), () async { + await _bleManager.fetchDeviceInfo(); + }); + // 连接成功后立即刷新一次电池信息 Future.delayed(const Duration(milliseconds: 500), () { _refreshBatteryInfo(); }); - + // 连接成功后检查OTA升级 Future.delayed(const Duration(seconds: 2), () { _checkOtaUpgrade(); diff --git a/local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift b/local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift index 347838118..e070c9db3 100644 --- a/local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift +++ b/local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift @@ -431,7 +431,7 @@ class AgentServiceImpl: NSObject { } stopIdleCheck() - +BleService.shared.closeCodec() // 重置识别模式 currentRecognitionMode = "normal" diff --git a/local_plugins/azure_speech/ios/azure_speech/Sources/tools/MicrophoneCapture.swift b/local_plugins/azure_speech/ios/azure_speech/Sources/tools/MicrophoneCapture.swift index 434dd0cd9..d6479f87d 100644 --- a/local_plugins/azure_speech/ios/azure_speech/Sources/tools/MicrophoneCapture.swift +++ b/local_plugins/azure_speech/ios/azure_speech/Sources/tools/MicrophoneCapture.swift @@ -51,9 +51,9 @@ class MicrophoneCapture: NSObject { // 设置音频会话参数 try audioSession.setCategory(.playAndRecord, mode: .videoChat, - options: [//.allowBluetooth, + options: [//.allowBluetooth, // 允许蓝牙耳机,占用hfp链路 // .allowAirPlay, - .allowBluetoothA2DP, + .allowBluetoothA2DP,// 允许蓝牙耳机,不占用hfp链路 .mixWithOthers, .defaultToSpeaker ]) diff --git a/local_plugins/ble_service/ios/ble_service/Sources/ble_service/BleService.swift b/local_plugins/ble_service/ios/ble_service/Sources/ble_service/BleService.swift index ea066e7d2..f7972197a 100644 --- a/local_plugins/ble_service/ios/ble_service/Sources/ble_service/BleService.swift +++ b/local_plugins/ble_service/ios/ble_service/Sources/ble_service/BleService.swift @@ -644,7 +644,8 @@ private var cmdReplyType: UInt8 = 0 } /// 关闭编解码器并停止录制 - func closeCodec() -> Bool { + /// - Returns: 操作是否成功 + public func closeCodec() -> Bool { os_log("关闭编解码并停止录制...", log: logger, type: .info) // 停止录制 From cf7568ad5eceed26eacf82b94c5627467a3637c5 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 28 Aug 2025 21:51:00 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=B8=8A=E4=BC=A0q=E9=9F=B3=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/qq_music/QPlayAutoManager.swift | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/local_plugins/qq_music/ios/qq_music/Sources/qq_music/QPlayAutoManager.swift b/local_plugins/qq_music/ios/qq_music/Sources/qq_music/QPlayAutoManager.swift index 8782d68c0..cfe893384 100644 --- a/local_plugins/qq_music/ios/qq_music/Sources/qq_music/QPlayAutoManager.swift +++ b/local_plugins/qq_music/ios/qq_music/Sources/qq_music/QPlayAutoManager.swift @@ -358,7 +358,7 @@ import QPlayAutoSDK return } -// if isLoginOK { + if isLoginOK { // 已登录,检查连接状态 if isConnected { // 已连接,直接执行操作 @@ -380,20 +380,21 @@ import QPlayAutoSDK } } } -// } else { -// // 未登录,先登录 -// print("QPlayAutoManager: 未登录,尝试登录...") -// performLogin { [weak self] success in -// guard let self = self else { return } -// if success { -// print("QPlayAutoManager: 登录成功,执行操作") -// operation() -// } else { -// print("QPlayAutoManager: 登录失败,无法执行操作") -// onFailure?(.loginFailed) -// } -// } -// } + } else { + // 未登录,先登录 + print("QPlayAutoManager: 未登录,尝试登录...") + performLogin { [weak self] success in + guard let self = self else { return } + if success { + print("QPlayAutoManager: 登录成功,执行操作") + operation() + } else { + print("QPlayAutoManager: 登录失败,无法执行操作") + onFailure?(.loginFailed) + stop() + } + } + } } private func performLogin(completion: @escaping (Bool) -> Void) {