blob: e77851b0e40529668ba229506849c79b658900f0 [file] [log] [blame]
Brandon Ballinger181a44d2009-04-16 14:31:48 -07001/*
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;
20
21/**
Valentin Kravtsov3da3cad2010-01-28 14:53:41 +000022 * Listener for speech recognition events, used with RecognitionService.
Brandon Ballinger181a44d2009-04-16 14:31:48 -070023 * 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 Kravtsov3da3cad2010-01-28 14:53:41 +000027oneway interface IRecognitionListener {
Valentin Kravtsov79896bd2010-01-15 11:56:03 +000028 /**
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 Ballinger181a44d2009-04-16 14:31:48 -070034
Valentin Kravtsov79896bd2010-01-15 11:56:03 +000035 /**
36 * The user has started to speak.
37 */
Brandon Ballinger181a44d2009-04-16 14:31:48 -070038 void onBeginningOfSpeech();
39
Valentin Kravtsov79896bd2010-01-15 11:56:03 +000040 /**
41 * The sound level in the audio stream has changed.
42 *
43 * @param rmsdB the new RMS dB value
44 */
Brandon Ballinger181a44d2009-04-16 14:31:48 -070045 void onRmsChanged(in float rmsdB);
46
47 /**
Valentin Kravtsov79896bd2010-01-15 11:56:03 +000048 * More sound has been received.
49 *
50 * @param buffer the byte buffer containing a sequence of 16-bit shorts.
Brandon Ballinger181a44d2009-04-16 14:31:48 -070051 */
52 void onBufferReceived(in byte[] buffer);
53
Valentin Kravtsov79896bd2010-01-15 11:56:03 +000054 /**
55 * Called after the user stops speaking.
56 */
Brandon Ballinger181a44d2009-04-16 14:31:48 -070057 void onEndOfSpeech();
58
Mitsuru Oshima34b234d2009-05-28 19:37:56 -070059 /**
Valentin Kravtsov79896bd2010-01-15 11:56:03 +000060 * A network or recognition error occurred.
61 *
Jean-Michel Trivi2a5d9f92010-03-29 18:31:19 -070062 * @param error code is defined in {@link SpeechRecognizer}
Mitsuru Oshima34b234d2009-05-28 19:37:56 -070063 */
64 void onError(in int error);
Brandon Ballinger181a44d2009-04-16 14:31:48 -070065
Valentin Kravtsov79896bd2010-01-15 11:56:03 +000066 /**
Mitsuru Oshima34b234d2009-05-28 19:37:56 -070067 * Called when recognition results are ready.
Valentin Kravtsov79896bd2010-01-15 11:56:03 +000068 *
69 * @param results a Bundle containing the most likely results (N-best list).
Brandon Ballinger181a44d2009-04-16 14:31:48 -070070 */
Valentin Kravtsov79896bd2010-01-15 11:56:03 +000071 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 Kravtsov3da3cad2010-01-28 14:53:41 +000079
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 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +000086 @UnsupportedAppUsage
Valentin Kravtsov3da3cad2010-01-28 14:53:41 +000087 void onEvent(in int eventType, in Bundle params);
Brandon Ballinger181a44d2009-04-16 14:31:48 -070088}