OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 [DartPackage="mojo_services", JavaPackage="org.chromium.mojo.speech_recognizer"] | 5 [DartPackage="mojo_services", |
| 6 JavaPackage="org.chromium.mojo.speech_recognizer"] |
6 module speech_recognizer; | 7 module speech_recognizer; |
7 | 8 |
8 enum Error { | 9 enum Error { |
9 NETWORK_TIMEOUT = 1, | 10 NETWORK_TIMEOUT = 1, |
10 NETWORK = 2, | 11 NETWORK = 2, |
11 AUDIO = 3, | 12 AUDIO = 3, |
12 SERVER = 4, | 13 SERVER = 4, |
13 CLIENT = 5, | 14 CLIENT = 5, |
14 SPEECH_TIMEOUT = 6, | 15 SPEECH_TIMEOUT = 6, |
15 NO_MATCH = 7, | 16 NO_MATCH = 7, |
16 RECOGNIZER_BUSY = 8, | 17 RECOGNIZER_BUSY = 8, |
17 INSUFFICIENT_PERMISSIONS = 9 | 18 INSUFFICIENT_PERMISSIONS = 9, |
18 }; | 19 }; |
19 | 20 |
20 struct UtteranceCandidate { | 21 struct UtteranceCandidate { |
21 // Utterance text candidate returned by speech recognition service. | 22 // Utterance text candidate returned by speech recognition service. |
22 string text; | 23 string text; |
23 | 24 |
24 // Confidence score in [0,1]. | 25 // Confidence score in [0,1]. |
25 float confidence_score; | 26 float confidence_score; |
26 }; | 27 }; |
27 | 28 |
28 union ResultOrError { | 29 union ResultOrError { |
29 Error error_code; | 30 Error error_code; |
30 array<UtteranceCandidate> results; | 31 array<UtteranceCandidate> results; |
31 }; | 32 }; |
32 | 33 |
33 // |SpeechRecognizerService| provides access to a speech recognition service. | 34 // |SpeechRecognizerService| provides access to a speech recognition service. |
34 // It is responsible for reading microphone input, deciding when the user is | 35 // It is responsible for reading microphone input, deciding when the user is |
35 // done speaking, and performing speech recognition on the result. | 36 // done speaking, and performing speech recognition on the result. |
36 [ServiceName="speech_recognizer::SpeechRecognizerService"] | 37 [ServiceName="speech_recognizer::SpeechRecognizerService"] |
37 interface SpeechRecognizerService { | 38 interface SpeechRecognizerService { |
38 // Starts listening to the user. When listening has finished or an error | 39 // Starts listening to the user. When listening has finished or an error |
39 // occurs, returns |result_or_error|. Any call to Listen() made while another | 40 // occurs, returns |result_or_error|. Any call to Listen() made while another |
40 // is in progress will immediately return an error. | 41 // is in progress will immediately return an error. |
41 Listen() => (ResultOrError result_or_error); | 42 Listen() => (ResultOrError result_or_error); |
42 | 43 |
43 // Stops the SpeechRecognizer from listening and finishes any previous call | 44 // Stops the SpeechRecognizer from listening and finishes any previous call |
44 // to Listen() causing it to return. | 45 // to Listen() causing it to return. |
45 StopListening(); | 46 StopListening(); |
46 }; | 47 }; |
OLD | NEW |