Brandon Ballinger | 181a44d | 2009-04-16 14:31:48 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.speech; |
| 18 | |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 19 | import android.os.Bundle; |
Brandon Ballinger | cdd0ac6 | 2009-05-07 14:24:02 -0700 | [diff] [blame] | 20 | import android.content.Intent; |
Brandon Ballinger | 181a44d | 2009-04-16 14:31:48 -0700 | [diff] [blame] | 21 | import android.speech.IRecognitionListener; |
| 22 | |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 23 | /** |
| 24 | * A Service interface to speech recognition. Call startListening when |
| 25 | * you want to begin capturing audio; RecognitionService will automatically |
| 26 | * determine when the user has finished speaking, stream the audio to the |
| 27 | * recognition servers, and notify you when results are ready. In most of the cases, |
Jean-Michel Trivi | 2a5d9f9 | 2010-03-29 18:31:19 -0700 | [diff] [blame] | 28 | * this class should not be used directly, instead use {@link SpeechRecognizer} for |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 29 | * accessing recognition service. |
| 30 | * {@hide} |
| 31 | */ |
Valentin Kravtsov | 3da3cad | 2010-01-28 14:53:41 +0000 | [diff] [blame] | 32 | oneway interface IRecognitionService { |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 33 | /** |
| 34 | * Starts listening for speech. Please note that the recognition service supports |
| 35 | * one listener only, therefore, if this function is called from two different threads, |
| 36 | * only the latest one will get the notifications |
| 37 | * |
| 38 | * @param recognizerIntent the intent from which the invocation occurred. Additionally, |
| 39 | * this intent can contain extra parameters to manipulate the behavior of the recognition |
| 40 | * client. For more information see {@link RecognizerIntent}. |
Valentin Kravtsov | 3da3cad | 2010-01-28 14:53:41 +0000 | [diff] [blame] | 41 | * @param listener to receive callbacks, note that this must be non-null |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 42 | */ |
| 43 | void startListening(in Intent recognizerIntent, in IRecognitionListener listener); |
Brandon Ballinger | 181a44d | 2009-04-16 14:31:48 -0700 | [diff] [blame] | 44 | |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 45 | /** |
| 46 | * Stops listening for speech. Speech captured so far will be recognized as |
| 47 | * if the user had stopped speaking at this point. The function has no effect unless it |
| 48 | * is called during the speech capturing. |
Valentin Kravtsov | 3da3cad | 2010-01-28 14:53:41 +0000 | [diff] [blame] | 49 | * |
| 50 | * @param listener to receive callbacks, note that this must be non-null |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 51 | */ |
Valentin Kravtsov | 3da3cad | 2010-01-28 14:53:41 +0000 | [diff] [blame] | 52 | void stopListening(in IRecognitionListener listener); |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * Cancels the speech recognition. |
Valentin Kravtsov | 3da3cad | 2010-01-28 14:53:41 +0000 | [diff] [blame] | 56 | * |
| 57 | * @param listener to receive callbacks, note that this must be non-null |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 58 | */ |
Valentin Kravtsov | 3da3cad | 2010-01-28 14:53:41 +0000 | [diff] [blame] | 59 | void cancel(in IRecognitionListener listener); |
Brandon Ballinger | 181a44d | 2009-04-16 14:31:48 -0700 | [diff] [blame] | 60 | } |