|
|
@ -100,7 +100,7 @@ class AgentServiceImpl: NSObject { |
|
|
|
|
|
|
|
|
private let timerQueue = DispatchQueue(label: "com.example.idleTimer.queue") |
|
|
private let timerQueue = DispatchQueue(label: "com.example.idleTimer.queue") |
|
|
private var idleTimer: DispatchSourceTimer? |
|
|
private var idleTimer: DispatchSourceTimer? |
|
|
private let maxIdleSeconds: TimeInterval = 10 |
|
|
private let maxIdleSeconds: TimeInterval = 5 |
|
|
var micCapture: MicrophoneCapture! |
|
|
var micCapture: MicrophoneCapture! |
|
|
// 语音识别模式 |
|
|
// 语音识别模式 |
|
|
public var currentRecognitionMode: String = "normal" |
|
|
public var currentRecognitionMode: String = "normal" |
|
|
@ -311,6 +311,9 @@ class AgentServiceImpl: NSObject { |
|
|
LocationService.shared.getCurrentLocation() { location in |
|
|
LocationService.shared.getCurrentLocation() { location in |
|
|
// self.locationInfo = location |
|
|
// self.locationInfo = location |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
checkAdnSetAudioSession() |
|
|
|
|
|
|
|
|
return isInitialized |
|
|
return isInitialized |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -387,6 +390,11 @@ class AgentServiceImpl: NSObject { |
|
|
return true |
|
|
return true |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private func checkAdnSetAudioSession() { |
|
|
|
|
|
let audioSourceType: AzureAsrHelper.AudioSourceType = BleService.shared.isConnected() ? .external : .microphone |
|
|
|
|
|
azureAsrHelper?.performAudioStart(audioSourceType: audioSourceType, audioDataCallback: nil) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private func startIdleCheckForMode(mode: String) { |
|
|
private func startIdleCheckForMode(mode: String) { |
|
|
stopIdleCheck() |
|
|
stopIdleCheck() |
|
|
guard isRecognizing else { return } |
|
|
guard isRecognizing else { return } |
|
|
|