From 68f05e341e1c54e2facd333d7ea0da849e8df8ab Mon Sep 17 00:00:00 2001 From: "sangho.lee" Date: Mon, 27 Nov 2023 15:49:21 +0900 Subject: [PATCH] Support ASR's requesrType at SpeechRecognizer #2447 --- .../speechrecognizer/SpeechRecognizerAggregator.kt | 9 ++++++++- .../SpeechRecognizerAggregatorInterface.kt | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/nugu-android-helper/src/main/java/com/skt/nugu/sdk/platform/android/speechrecognizer/SpeechRecognizerAggregator.kt b/nugu-android-helper/src/main/java/com/skt/nugu/sdk/platform/android/speechrecognizer/SpeechRecognizerAggregator.kt index 8a44579c8..cb1458d3e 100644 --- a/nugu-android-helper/src/main/java/com/skt/nugu/sdk/platform/android/speechrecognizer/SpeechRecognizerAggregator.kt +++ b/nugu-android-helper/src/main/java/com/skt/nugu/sdk/platform/android/speechrecognizer/SpeechRecognizerAggregator.kt @@ -19,6 +19,7 @@ import android.os.Handler import android.os.Looper import com.skt.nugu.sdk.agent.asr.ASRAgentInterface import com.skt.nugu.sdk.agent.asr.EndPointDetectorParam +import com.skt.nugu.sdk.agent.asr.RequestType import com.skt.nugu.sdk.agent.asr.WakeupInfo import com.skt.nugu.sdk.agent.asr.audio.AudioEndPointDetector import com.skt.nugu.sdk.agent.asr.audio.AudioFormat @@ -65,6 +66,7 @@ class SpeechRecognizerAggregator( var epdParam: EndPointDetectorParam? = null, var service: String? = null, var startListeningCallback: ASRAgentInterface.StartRecognitionCallback? = null, + var requestType: RequestType?, var initiator: ASRAgentInterface.Initiator ) @@ -218,6 +220,7 @@ class SpeechRecognizerAggregator( epdParam, null, listeningCallback, + null, ASRAgentInterface.Initiator.WAKE_UP_WORD ) @@ -275,6 +278,7 @@ class SpeechRecognizerAggregator( pendingStartListeningParam?.epdParam, pendingStartListeningParam?.service, pendingStartListeningParam?.startListeningCallback, + pendingStartListeningParam?.requestType, pendingStartListeningParam?.initiator ?: ASRAgentInterface.Initiator.TAP ) pendingStartListeningParam = null @@ -322,6 +326,7 @@ class SpeechRecognizerAggregator( epdParam: EndPointDetectorParam?, service: String?, callback: ASRAgentInterface.StartRecognitionCallback?, + requestType: RequestType?, initiator: ASRAgentInterface.Initiator ) { Logger.d( @@ -342,7 +347,7 @@ class SpeechRecognizerAggregator( } Logger.d(TAG, "[startListening] will be started after trigger stopped.") - this.pendingStartListeningParam = StartListeningParam(wakeupInfo, epdParam, service, callback, initiator) + this.pendingStartListeningParam = StartListeningParam(wakeupInfo, epdParam, service, callback, requestType, initiator) isTriggerStoppingByStartListening = true keywordDetector?.stopDetect() } @@ -359,6 +364,7 @@ class SpeechRecognizerAggregator( epdParam, service, callback, + requestType, initiator ) } @@ -372,6 +378,7 @@ class SpeechRecognizerAggregator( epdParam : EndPointDetectorParam?, service: String?, callback: ASRAgentInterface.StartRecognitionCallback?, + requestType: RequestType?, initiator: ASRAgentInterface.Initiator ) { val inputStream = audioProvider.acquireAudioInputStream(speechProcessor) diff --git a/nugu-android-helper/src/main/java/com/skt/nugu/sdk/platform/android/speechrecognizer/SpeechRecognizerAggregatorInterface.kt b/nugu-android-helper/src/main/java/com/skt/nugu/sdk/platform/android/speechrecognizer/SpeechRecognizerAggregatorInterface.kt index 76bc3eed4..87ab85654 100644 --- a/nugu-android-helper/src/main/java/com/skt/nugu/sdk/platform/android/speechrecognizer/SpeechRecognizerAggregatorInterface.kt +++ b/nugu-android-helper/src/main/java/com/skt/nugu/sdk/platform/android/speechrecognizer/SpeechRecognizerAggregatorInterface.kt @@ -17,6 +17,7 @@ package com.skt.nugu.sdk.platform.android.speechrecognizer import com.skt.nugu.sdk.agent.asr.ASRAgentInterface import com.skt.nugu.sdk.agent.asr.EndPointDetectorParam +import com.skt.nugu.sdk.agent.asr.RequestType import com.skt.nugu.sdk.agent.asr.WakeupInfo import com.skt.nugu.sdk.agent.asr.audio.AudioFormat import com.skt.nugu.sdk.agent.sds.SharedDataStream @@ -132,6 +133,7 @@ interface SpeechRecognizerAggregatorInterface { * @param wakeupInfo the wakeup info of wakeup word for input * @param epdParam the epd params * @param service the service payload(json formatted string) for ASR + * @param requestType the type for ASR * @param initiator the initiator */ fun startListening( @@ -139,6 +141,7 @@ interface SpeechRecognizerAggregatorInterface { epdParam: EndPointDetectorParam? = null, service: String? = null, callback: ASRAgentInterface.StartRecognitionCallback? = null, + requestType: RequestType? = null, initiator: ASRAgentInterface.Initiator )