IRecognitionListener.aidl revision 409895e374108ef4bfa714e21526710ee05e700b
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 17package android.speech; 18 19import android.os.Bundle; 20import android.speech.RecognitionResult; 21 22/** 23 * Listener for speech recognition events, used with RecognitionService. 24 * This gives you both the final recognition results, as well as various 25 * intermediate events that can be used to show visual feedback to the user. 26 * {@hide} 27 */ 28interface IRecognitionListener { 29 /** Called when the endpointer is ready for the user to start speaking. */ 30 void onReadyForSpeech(in Bundle noiseParams); 31 32 /** The user has started to speak. */ 33 void onBeginningOfSpeech(); 34 35 /** The sound level in the audio stream has changed. */ 36 void onRmsChanged(in float rmsdB); 37 38 /** 39 * More sound has been received. Buffer is a byte buffer containing 40 * a sequence of 16-bit shorts. 41 */ 42 void onBufferReceived(in byte[] buffer); 43 44 /** Called after the user stops speaking. */ 45 void onEndOfSpeech(); 46 47 /** 48 * A network or recognition error occurred. The code is defined in 49 * {@link android.speech.RecognitionResult} 50 */ 51 void onError(in int error); 52 53 /** 54 * Called when recognition results are ready. 55 * @param results: an ordered list of the most likely results (N-best list). 56 * @param key: a key associated with the results. The same results can 57 * be retrieved asynchronously later using the key, if available. 58 */ 59 void onResults(in List<RecognitionResult> results, long key); 60} 61