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 | |
| 19 | import android.os.Bundle; |
| 20 | |
| 21 | /** |
Valentin Kravtsov | 3da3cad | 2010-01-28 14:53:41 +0000 | [diff] [blame] | 22 | * Listener for speech recognition events, used with RecognitionService. |
Brandon Ballinger | 181a44d | 2009-04-16 14:31:48 -0700 | [diff] [blame] | 23 | * This gives you both the final recognition results, as well as various |
| 24 | * intermediate events that can be used to show visual feedback to the user. |
| 25 | * {@hide} |
| 26 | */ |
Valentin Kravtsov | 3da3cad | 2010-01-28 14:53:41 +0000 | [diff] [blame] | 27 | oneway interface IRecognitionListener { |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 28 | /** |
| 29 | * Called when the endpointer is ready for the user to start speaking. |
| 30 | * |
| 31 | * @param params parameters set by the recognition service. Reserved for future use. |
| 32 | */ |
| 33 | void onReadyForSpeech(in Bundle params); |
Brandon Ballinger | 181a44d | 2009-04-16 14:31:48 -0700 | [diff] [blame] | 34 | |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 35 | /** |
| 36 | * The user has started to speak. |
| 37 | */ |
Brandon Ballinger | 181a44d | 2009-04-16 14:31:48 -0700 | [diff] [blame] | 38 | void onBeginningOfSpeech(); |
| 39 | |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 40 | /** |
| 41 | * The sound level in the audio stream has changed. |
| 42 | * |
| 43 | * @param rmsdB the new RMS dB value |
| 44 | */ |
Brandon Ballinger | 181a44d | 2009-04-16 14:31:48 -0700 | [diff] [blame] | 45 | void onRmsChanged(in float rmsdB); |
| 46 | |
| 47 | /** |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 48 | * More sound has been received. |
| 49 | * |
| 50 | * @param buffer the byte buffer containing a sequence of 16-bit shorts. |
Brandon Ballinger | 181a44d | 2009-04-16 14:31:48 -0700 | [diff] [blame] | 51 | */ |
| 52 | void onBufferReceived(in byte[] buffer); |
| 53 | |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 54 | /** |
| 55 | * Called after the user stops speaking. |
| 56 | */ |
Brandon Ballinger | 181a44d | 2009-04-16 14:31:48 -0700 | [diff] [blame] | 57 | void onEndOfSpeech(); |
| 58 | |
Mitsuru Oshima | 34b234d | 2009-05-28 19:37:56 -0700 | [diff] [blame] | 59 | /** |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 60 | * A network or recognition error occurred. |
| 61 | * |
Jean-Michel Trivi | 2a5d9f9 | 2010-03-29 18:31:19 -0700 | [diff] [blame] | 62 | * @param error code is defined in {@link SpeechRecognizer} |
Mitsuru Oshima | 34b234d | 2009-05-28 19:37:56 -0700 | [diff] [blame] | 63 | */ |
| 64 | void onError(in int error); |
Brandon Ballinger | 181a44d | 2009-04-16 14:31:48 -0700 | [diff] [blame] | 65 | |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 66 | /** |
Mitsuru Oshima | 34b234d | 2009-05-28 19:37:56 -0700 | [diff] [blame] | 67 | * Called when recognition results are ready. |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 68 | * |
| 69 | * @param results a Bundle containing the most likely results (N-best list). |
Brandon Ballinger | 181a44d | 2009-04-16 14:31:48 -0700 | [diff] [blame] | 70 | */ |
Valentin Kravtsov | 79896bd | 2010-01-15 11:56:03 +0000 | [diff] [blame] | 71 | void onResults(in Bundle results); |
| 72 | |
| 73 | /** |
| 74 | * Called when recognition partial results are ready. |
| 75 | * |
| 76 | * @param results a Bundle containing the current most likely result. |
| 77 | */ |
| 78 | void onPartialResults(in Bundle results); |
Valentin Kravtsov | 3da3cad | 2010-01-28 14:53:41 +0000 | [diff] [blame] | 79 | |
| 80 | /** |
| 81 | * Reserved for adding future events. |
| 82 | * |
| 83 | * @param eventType the type of the occurred event |
| 84 | * @param params a Bundle containing the passed parameters |
| 85 | */ |
| 86 | void onEvent(in int eventType, in Bundle params); |
Brandon Ballinger | 181a44d | 2009-04-16 14:31:48 -0700 | [diff] [blame] | 87 | } |