|
|
@ -354,7 +354,6 @@ class AgentServiceImpl: NSObject { |
|
|
|
|
|
|
|
|
if self.isRecognizing && !self.isSpeaking && !self.isAiStreaming { |
|
|
if self.isRecognizing && !self.isSpeaking && !self.isAiStreaming { |
|
|
os_log("空闲检测触发自动停止,模式: %{public}@", log: self.logger, type: .info, self.currentRecognitionMode) |
|
|
os_log("空闲检测触发自动停止,模式: %{public}@", log: self.logger, type: .info, self.currentRecognitionMode) |
|
|
BleService.shared.closeCodec() |
|
|
|
|
|
self.stopRecognition() |
|
|
self.stopRecognition() |
|
|
self.sendEvent(name: "auto_stop", data: [ |
|
|
self.sendEvent(name: "auto_stop", data: [ |
|
|
"reason": "idle_timeout", |
|
|
"reason": "idle_timeout", |
|
|
@ -394,7 +393,9 @@ class AgentServiceImpl: NSObject { |
|
|
stopRecognition() |
|
|
stopRecognition() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 接收到唤醒信号,打开编码器 (设备侧) |
|
|
|
|
|
let openResult = BleService.shared.openEncoder() |
|
|
|
|
|
os_log("🎙️ 尝试打开编码器结果: %@", log: logger, type: .info, openResult ? "成功" : "失败") |
|
|
wasMusicPlayingBeforeRecognition = MusicService.shared.isPlaying |
|
|
wasMusicPlayingBeforeRecognition = MusicService.shared.isPlaying |
|
|
|
|
|
|
|
|
// 如果音乐正在播放,则暂停 |
|
|
// 如果音乐正在播放,则暂停 |
|
|
@ -472,7 +473,8 @@ class AgentServiceImpl: NSObject { |
|
|
MusicService.shared.resume() |
|
|
MusicService.shared.resume() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 关闭编码器 (设备侧) |
|
|
|
|
|
BleService.shared.closeCodec() |
|
|
// 重置识别模式 |
|
|
// 重置识别模式 |
|
|
currentRecognitionMode = "normal" |
|
|
currentRecognitionMode = "normal" |
|
|
|
|
|
|
|
|
|