IRecognitionListener.aidl revision 34b234d53f9658ff7206dad6158993a1d197ffa7
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.
49     * TODO: right now, the error code is given in voice search package
50     * (vendor/google/apps/src/com/google/android/voicesearch/speechservice/SpeechServiceListener.java)
51     * we need to find a place to define common error code.
52     */
53    void onError(in int error);
54
55    /**
56     * Called when recognition results are ready.
57     * @param results: an ordered list of the most likely results (N-best list).
58     * @param key: a key associated with the results. The same results can
59     * be retrieved asynchronously later using the key, if available.
60     */
61    void onResults(in List<RecognitionResult> results, long key);
62}
63