Merge "Add restore logic when daemon get signal" into tizen
[platform/core/uifw/stt.git] / include / stt.h
1 /*
2  * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
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 #ifndef __STT_H__
18 #define __STT_H__
19
20 #include <tizen.h>
21
22 /**
23  * @file stt.h
24  */
25
26 /**
27 * @addtogroup CAPI_UIX_STT_MODULE
28 * @{
29 */
30
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35
36 /**
37  * @brief Enumerations for error codes.
38  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
39 */
40 typedef enum {
41         STT_ERROR_NONE                          = TIZEN_ERROR_NONE,             /**< Successful */
42         STT_ERROR_OUT_OF_MEMORY                 = TIZEN_ERROR_OUT_OF_MEMORY,    /**< Out of Memory */
43         STT_ERROR_IO_ERROR                      = TIZEN_ERROR_IO_ERROR,         /**< I/O error */
44         STT_ERROR_INVALID_PARAMETER             = TIZEN_ERROR_INVALID_PARAMETER,/**< Invalid parameter */
45         STT_ERROR_TIMED_OUT                     = TIZEN_ERROR_TIMED_OUT,        /**< No answer from the daemon */
46         STT_ERROR_RECORDER_BUSY                 = TIZEN_ERROR_RESOURCE_BUSY,    /**< Device or resource busy */
47         STT_ERROR_OUT_OF_NETWORK                = TIZEN_ERROR_NETWORK_DOWN,     /**< Network is down */
48         STT_ERROR_PERMISSION_DENIED             = TIZEN_ERROR_PERMISSION_DENIED,/**< Permission denied */
49         STT_ERROR_NOT_SUPPORTED                 = TIZEN_ERROR_NOT_SUPPORTED,    /**< STT NOT supported */
50         STT_ERROR_INVALID_STATE                 = TIZEN_ERROR_STT | 0x01,       /**< Invalid state */
51         STT_ERROR_INVALID_LANGUAGE              = TIZEN_ERROR_STT | 0x02,       /**< Invalid language */
52         STT_ERROR_ENGINE_NOT_FOUND              = TIZEN_ERROR_STT | 0x03,       /**< No available engine  */
53         STT_ERROR_OPERATION_FAILED              = TIZEN_ERROR_STT | 0x04,       /**< Operation failed  */
54         STT_ERROR_NOT_SUPPORTED_FEATURE         = TIZEN_ERROR_STT | 0x05,       /**< Not supported feature of current engine */
55         STT_ERROR_NO_SPEECH                     = TIZEN_ERROR_STT | 0x06,       /**< No speech while recording */
56         STT_ERROR_IN_PROGRESS_TO_READY          = TIZEN_ERROR_STT | 0x07,       /**< Progress to ready is not finished */
57         STT_ERROR_IN_PROGRESS_TO_RECORDING      = TIZEN_ERROR_STT | 0x08,       /**< Progress to recording is not finished */
58         STT_ERROR_IN_PROGRESS_TO_PROCESSING     = TIZEN_ERROR_STT | 0x09,       /**< Progress to processing is not finished */
59         STT_ERROR_RECORDING_TIMED_OUT           = TIZEN_ERROR_STT | 0x10,       /**< Recording timed out */
60         STT_ERROR_SERVICE_RESET                 = TIZEN_ERROR_STT | 0x11        /**< Service reset */
61 } stt_error_e;
62
63 /**
64  * @brief Definition for free form dictation and default type.
65  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
66 */
67 #define STT_RECOGNITION_TYPE_FREE               "stt.recognition.type.FREE"
68
69 /**
70  * @brief Definition for continuous free dictation.
71  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
72 */
73 #define STT_RECOGNITION_TYPE_FREE_PARTIAL       "stt.recognition.type.FREE.PARTIAL"
74
75 /**
76  * @brief Definition for search.
77  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
78 */
79 #define STT_RECOGNITION_TYPE_SEARCH             "stt.recognition.type.SEARCH"
80
81 /**
82  * @brief Definition for web search.
83  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
84 */
85 #define STT_RECOGNITION_TYPE_WEB_SEARCH         "stt.recognition.type.WEB_SEARCH"
86
87 /**
88  * @brief Definition for map.
89  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
90 */
91 #define STT_RECOGNITION_TYPE_MAP                "stt.recognition.type.MAP"
92
93 /**
94  * @brief Definition for none message.
95  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
96 */
97 #define STT_RESULT_MESSAGE_NONE                 "stt.result.message.none"
98
99 /**
100  * @brief Definition for failed recognition because the speech started too soon.
101  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
102 */
103 #define STT_RESULT_MESSAGE_ERROR_TOO_SOON       "stt.result.message.error.too.soon"
104
105 /**
106  * @brief Definition for failed recognition because the speech is too short.
107  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
108 */
109 #define STT_RESULT_MESSAGE_ERROR_TOO_SHORT      "stt.result.message.error.too.short"
110
111 /**
112  * @brief Definition for failed recognition because the speech is too long.
113  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
114 */
115 #define STT_RESULT_MESSAGE_ERROR_TOO_LONG       "stt.result.message.error.too.long"
116
117 /**
118  * @brief Definition for failed recognition because the speech is too quiet to listen.
119  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
120 */
121 #define STT_RESULT_MESSAGE_ERROR_TOO_QUIET      "stt.result.message.error.too.quiet"
122
123 /**
124  * @brief Definition for failed recognition because the speech is too loud to listen.
125  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
126 */
127 #define STT_RESULT_MESSAGE_ERROR_TOO_LOUD       "stt.result.message.error.too.loud"
128
129 /**
130  * @brief Definition for failed recognition because the speech is too fast to listen.
131  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
132 */
133 #define STT_RESULT_MESSAGE_ERROR_TOO_FAST       "stt.result.message.error.too.fast"
134
135
136 /**
137  * @brief Enumeration for state.
138  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
139 */
140 typedef enum {
141         STT_STATE_CREATED       = 0,            /**< 'CREATED' state */
142         STT_STATE_READY         = 1,            /**< 'READY' state */
143         STT_STATE_RECORDING     = 2,            /**< 'RECORDING' state */
144         STT_STATE_PROCESSING    = 3             /**< 'PROCESSING' state*/
145 } stt_state_e;
146
147 /**
148  * @brief Enumeration for result event.
149  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
150 */
151 typedef enum {
152         STT_RESULT_EVENT_FINAL_RESULT = 0,      /**< Event when the recognition full or last result is ready  */
153         STT_RESULT_EVENT_PARTIAL_RESULT,        /**< Event when the recognition partial result is ready  */
154         STT_RESULT_EVENT_ERROR                  /**< Event when the recognition has failed */
155 } stt_result_event_e;
156
157 /**
158  * @brief Enumeration for result time callback event.
159  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
160 */
161 typedef enum {
162         STT_RESULT_TIME_EVENT_BEGINNING = 0,    /**< Event when the token is beginning type */
163         STT_RESULT_TIME_EVENT_MIDDLE = 1,       /**< Event when the token is middle type */
164         STT_RESULT_TIME_EVENT_END = 2           /**< Event when the token is end type */
165 } stt_result_time_event_e;
166
167 /**
168  * @brief Enumeration for silence detection type.
169  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
170 */
171 typedef enum {
172         STT_OPTION_SILENCE_DETECTION_FALSE = 0, /**< Silence detection type - False */
173         STT_OPTION_SILENCE_DETECTION_TRUE = 1,  /**< Silence detection type - True */
174         STT_OPTION_SILENCE_DETECTION_AUTO = 2   /**< Silence detection type - Auto */
175 } stt_option_silence_detection_e;
176
177 /**
178  * @brief A structure of STT handler.
179  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
180 */
181 typedef struct stt_s *stt_h;
182
183 /**
184  * @brief Called to get the engine information.
185  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
186  *
187  * @param[in] engine_id Engine id
188  * @param[in] engine_name Engine name
189  * @param[in] user_data User data passed from the stt_setting_foreach_supported_engines()
190  *
191  * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
192  * @pre stt_foreach_supported_engines() will invoke this callback.
193  *
194  * @see stt_foreach_supported_engines()
195 */
196 typedef bool(*stt_supported_engine_cb)(stt_h stt, const char* engine_id, const char* engine_name, void* user_data);
197
198 /**
199  * @brief Called when STT gets the recognition result from the engine.
200  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
201  *
202  * @remarks After stt_stop() is called, silence is detected from recording, or partial result is occured,
203  *      this function is called.
204  *
205  * @param[in] stt The STT handle
206  * @param[in] event The result event
207  * @param[in] data Result texts
208  * @param[in] data_count Result text count
209  * @param[in] msg Engine message (e.g. #STT_RESULT_MESSAGE_NONE, #STT_RESULT_MESSAGE_ERROR_TOO_SHORT)
210  * @param[in] user_data The user data passed from the callback registration function
211  *
212  * @pre stt_stop() will invoke this callback if you register it using stt_set_result_cb().
213  * @post If this function is called and event is #STT_RESULT_EVENT_FINAL_RESULT, the STT state will be #STT_STATE_READY.
214  *
215  * @see stt_stop()
216  * @see stt_set_recognition_result_cb()
217  * @see stt_unset_recognition_result_cb()
218 */
219 typedef void (*stt_recognition_result_cb)(stt_h stt, stt_result_event_e event, const char** data, int data_count,
220                                           const char* msg, void *user_data);
221
222 /**
223  * @brief Called when STT get the result time stamp in free partial type.
224  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
225  *
226  * @param[in] stt The STT handle
227  * @param[in] index The result index
228  * @param[in] event The token event
229  * @param[in] text The result text
230  * @param[in] start_time The start time of result text
231  * @param[in] end_time The end time of result text
232  * @param[in] user_data The user data passed from the foreach function
233  *
234  * @return @c true to continue with the next iteration of the loop \n @c false to break out of the loop
235  *
236  * @pre stt_recognition_result_cb() should be called.
237  *
238  * @see stt_recognition_result_cb()
239 */
240 typedef bool (*stt_result_time_cb)(stt_h stt, int index, stt_result_time_event_e event, const char* text,
241                                    long start_time, long end_time, void* user_data);
242
243 /**
244  * @brief Called when the state of STT is changed.
245  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
246  *
247  * @param[in] stt The STT handle
248  * @param[in] previous A previous state
249  * @param[in] current A current state
250  * @param[in] user_data The user data passed from the callback registration function
251  *
252  * @pre An application registers this callback using stt_set_state_changed_cb() to detect changing state.
253  *
254  * @see stt_set_state_changed_cb()
255  * @see stt_unset_state_changed_cb()
256 */
257 typedef void (*stt_state_changed_cb)(stt_h stt, stt_state_e previous, stt_state_e current, void* user_data);
258
259 /**
260  * @brief Called when an error occurs.
261  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
262  *
263  * @param[in] stt The STT handle
264  * @param[in] reason The error type (e.g. #STT_ERROR_OUT_OF_NETWORK, #STT_ERROR_IO_ERROR)
265  * @param[in] user_data The user data passed from the callback registration function
266  *
267  * @pre An application registers this callback using stt_set_error_cb() to detect error.
268  *
269  * @see stt_set_error_cb()
270  * @see stt_unset_error_cb()
271 */
272 typedef void (*stt_error_cb)(stt_h stt, stt_error_e reason, void *user_data);
273
274 /**
275  * @brief Called to retrieve the supported languages.
276  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
277  * @remarks The language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code. For example, "ko_KR" for Korean, "en_US" for American English.
278  *
279  * @param[in] stt The STT handle
280  * @param[in] language The language
281  * @param[in] user_data The user data passed from the foreach function
282  *
283  * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
284  * @pre stt_foreach_supported_languages() will invoke this callback.
285  *
286  * @see stt_foreach_supported_languages()
287 */
288 typedef bool (*stt_supported_language_cb)(stt_h stt, const char* language, void* user_data);
289
290 /**
291  * @brief Called when the default language is changed.
292  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
293  *
294  * @param[in] stt The STT handle
295  * @param[in] previous_language A previous language
296  * @param[in] current_language A current language
297  * @param[in] user_data The user data passed from the callback registration function
298  *
299  * @see stt_set_default_language_changed_cb()
300 */
301 typedef void (*stt_default_language_changed_cb)(stt_h stt, const char* previous_language,
302                                                 const char* current_language, void* user_data);
303
304 /**
305  * @brief Called when the engine is changed.
306  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
307  *
308  * @param[in] stt The STT handle
309  * @param[in] engine_id Engine id
310  * @param[in] language The default language
311  * @param[in] support_silence Whether the silence detection is supported or not
312  * @param[in] need_credential The necessity of credential
313  * @param[in] user_data The user data passed from the callback registration function
314  *
315  * @see stt_set_engine_changed_cb()
316 */
317 typedef bool (*stt_engine_changed_cb)(stt_h stt, const char* engine_id, const char* language,
318                                                 bool support_silence, bool need_credential, void* user_data);
319
320 /**
321  * @brief Creates a STT handle.
322  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
323  * @privlevel public
324  * @privilege %http://tizen.org/privilege/recorder
325  *
326  * @remarks If the function succeeds, @a stt handle must be released with stt_destroy().
327  *
328  * @param[out] stt The STT handle
329  *
330  * @return 0 on success, otherwise a negative error value
331  * @retval #STT_ERROR_NONE Successful
332  * @retval #STT_ERROR_OUT_OF_MEMORY Out of memory
333  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
334  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
335  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
336  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
337  *
338  * @post If this function is called, the STT state will be #STT_STATE_CREATED.
339  *
340  * @see stt_destroy()
341 */
342 int stt_create(stt_h* stt);
343
344 /**
345  * @brief Destroys a STT handle.
346  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
347  * @privlevel public
348  * @privilege %http://tizen.org/privilege/recorder
349  *
350  * @param[in] stt The STT handle
351  *
352  * @return 0 on success, otherwise a negative error value
353  * @retval #STT_ERROR_NONE Successful
354  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
355  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
356  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
357  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
358  *
359  * @see stt_create()
360 */
361 int stt_destroy(stt_h stt);
362
363 /**
364  * @brief Retrieves supported engine information using a callback function.
365  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
366  * @privlevel public
367  * @privilege %http://tizen.org/privilege/recorder
368  *
369  * @param[in] stt The STT handle
370  * @param[in] callback The callback function to invoke
371  * @param[in] user_data The user data to be passed to the callback function
372  *
373  * @return 0 on success, otherwise a negative error value
374  * @retval #STT_ERROR_NONE Success
375  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
376  * @retval #STT_ERROR_INVALID_STATE STT Not initialized
377  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
378  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
379  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
380  *
381  * @pre The state should be #STT_STATE_CREATED.
382  * @post This function invokes stt_supported_engine_cb() repeatedly for getting engine information.
383  *
384  * @see stt_supported_engine_cb()
385 */
386 int stt_foreach_supported_engines(stt_h stt, stt_supported_engine_cb callback, void* user_data);
387
388 /**
389  * @brief Gets the current engine id.
390  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
391  * @privlevel public
392  * @privilege %http://tizen.org/privilege/recorder
393  *
394  * @remarks If the function is success, @a engine_id must be released using free().
395  *
396  * @param[in] stt The STT handle
397  * @param[out] engine_id Engine id
398  *
399  * @return 0 on success, otherwise a negative error value
400  * @retval #STT_ERROR_NONE Success
401  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
402  * @retval #STT_ERROR_INVALID_STATE STT Not initialized
403  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
404  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
405  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
406  *
407  * @pre The state should be #STT_STATE_CREATED.
408  *
409  * @see stt_set_engine()
410 */
411 int stt_get_engine(stt_h stt, char** engine_id);
412
413 /**
414  * @brief Sets the engine id.
415  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
416  * @privlevel public
417  * @privilege %http://tizen.org/privilege/recorder
418  *
419  * @param[in] stt The STT handle
420  * @param[in] engine_id Engine id
421  *
422  * @return 0 on success, otherwise a negative error value
423  * @retval #STT_ERROR_NONE Success
424  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
425  * @retval #STT_ERROR_INVALID_STATE STT Not initialized
426  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
427  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
428  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
429  *
430  * @pre The state should be #STT_STATE_CREATED.
431  *
432  * @see stt_get_engine()
433 */
434 int stt_set_engine(stt_h stt, const char* engine_id);
435
436 /**
437  * @brief Sets the app credential.
438  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
439  * @privlevel public
440  * @privilege %http://tizen.org/privilege/recorder
441  *
442  * @param[in] stt The STT handle
443  * @param[in] credential The app credential
444  *
445  * @return 0 on success, otherwise a negative error value
446  * @retval #STT_ERROR_NONE Success
447  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
448  * @retval #STT_ERROR_INVALID_STATE Invalid state
449  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
450  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
451  *
452  * @pre The state should be #STT_STATE_CREATED or #STT_STATE_READY.
453  *
454  * @see stt_start()
455 */
456
457 int stt_set_credential(stt_h stt, const char* credential);
458
459 /**
460  * @brief Sets the private data to stt engine.
461  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
462  *
463  * @param[in] stt The STT handle
464  * @param[in] key The field name of private data
465  * @param[in] data The data for set
466  *
467  * @return 0 on success, otherwise a negative error value
468  * @retval #STT_ERROR_NONE Successful
469  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
470  * @retval #STT_ERROR_INVALID_STATE Invalid state
471  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
472  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
473  * @retval #STT_ERROR_TIMED_OUT No answer from the daemon
474  *
475  * @pre The state should be #STT_STATE_READY.
476  *
477  * @see stt_get_private_data()
478 */
479 int stt_set_private_data(stt_h stt, const char* key, const char* data);
480
481 /**
482  * @brief Gets the private data from stt engine.
483  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
484  *
485  * @param[in] stt The STT handle
486  * @param[in] key The field name of private data
487  * @param[out] data The data field of private data
488  *
489  * @remarks The @a data must be released using free() when it is no longer required.
490  *
491  * @return 0 on success, otherwise a negative error value
492  * @retval #STT_ERROR_NONE Successful
493  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
494  * @retval #STT_ERROR_INVALID_STATE Invalid state
495  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
496  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
497  * @retval #STT_ERROR_TIMED_OUT No answer from the daemon
498  *
499  * @pre The state should be #STT_STATE_READY.
500  *
501  * @see stt_set_private_data()
502 */
503 int stt_get_private_data(stt_h stt, const char* key, char** data);
504
505 /**
506  * @brief Connects the daemon asynchronously.
507  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
508  * @privlevel public
509  * @privilege %http://tizen.org/privilege/recorder
510  *
511  * @param[in] stt The STT handle
512  *
513  * @return 0 on success, otherwise a negative error value
514  * @retval #STT_ERROR_NONE Successful
515  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
516  * @retval #STT_ERROR_INVALID_STATE Invalid state
517  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
518  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
519  *
520  * @pre The state should be #STT_STATE_CREATED.
521  * @post If this function is successful, the STT state will be #STT_STATE_READY. \n
522  *      If this function is failed, the error callback is called. (e.g. #STT_ERROR_ENGINE_NOT_FOUND)
523  *
524  * @see stt_unprepare()
525 */
526 int stt_prepare(stt_h stt);
527
528 /**
529  * @brief Disconnects the daemon.
530  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
531  * @privlevel public
532  * @privilege %http://tizen.org/privilege/recorder
533  *
534  * @param[in] stt The STT handle
535  *
536  * @return 0 on success, otherwise a negative error value
537  * @retval #STT_ERROR_NONE Successful
538  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
539  * @retval #STT_ERROR_INVALID_STATE Invalid state
540  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
541  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
542  *
543  * @pre The state should be #STT_STATE_READY.
544  * @post If this function is called, the STT state will be #STT_STATE_CREATED.
545  *
546  * @see stt_prepare()
547 */
548 int stt_unprepare(stt_h stt);
549
550 /**
551  * @brief Retrieves all supported languages of current engine using callback function.
552  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
553  * @privlevel public
554  * @privilege %http://tizen.org/privilege/recorder
555  *
556  * @param[in] stt The STT handle
557  * @param[in] callback The callback function to invoke
558  * @param[in] user_data The user data to be passed to the callback function
559  *
560  * @return 0 on success, otherwise a negative error value
561  * @retval #STT_ERROR_NONE Successful
562  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
563  * @retval #STT_ERROR_OUT_OF_MEMORY Out of memory
564  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
565  * @retval #STT_ERROR_ENGINE_NOT_FOUND No available engine
566  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
567  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
568  *
569  * @post This function invokes stt_supported_language_cb() repeatedly for getting languages.
570  *
571  * @see stt_supported_language_cb()
572  * @see stt_get_default_language()
573 */
574 int stt_foreach_supported_languages(stt_h stt, stt_supported_language_cb callback, void* user_data);
575
576 /**
577  * @brief Gets the default language set by the user.
578  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
579  * @privlevel public
580  * @privilege %http://tizen.org/privilege/recorder
581  * @remarks The language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code. \n
582  * For example, "ko_KR" for Korean, "en_US" for American English. \n
583  * If the function succeeds, @a language must be released using free() when it is no longer required.
584  *
585  * @param[in] stt The STT handle
586  * @param[out] language The language
587  *
588  * @return 0 on success, otherwise a negative error value
589  * @retval #STT_ERROR_NONE Successful
590  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
591  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
592  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
593  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
594  *
595  * @see stt_foreach_supported_languages()
596 */
597 int stt_get_default_language(stt_h stt, char** language);
598
599 /**
600  * @brief Gets the current STT state.
601  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
602  * @privlevel public
603  * @privilege %http://tizen.org/privilege/recorder
604  *
605  * @param[in] stt The STT handle
606  * @param[out] state The current STT state
607  *
608  * @return 0 on success, otherwise a negative error value
609  * @retval #STT_ERROR_NONE Successful
610  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
611  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
612  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
613  *
614  * @see stt_start()
615  * @see stt_stop()
616  * @see stt_cancel()
617  * @see stt_state_changed_cb()
618 */
619 int stt_get_state(stt_h stt, stt_state_e* state);
620
621 /**
622  * @brief Gets the current error message.
623  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
624  * @privlevel public
625  * @privilege %http://tizen.org/privilege/recorder
626  * @remarks This function should be called during an stt error callback. If not, the error as operation failure will be returned. \n
627  * If the function succeeds, @a err_msg must be released using free() when it is no longer required.
628  *
629  * @param[in] stt The STT handle
630  * @param[out] err_msg The current error message
631  *
632  * @return 0 on success, otherwise a negative error value
633  * @retval #STT_ERROR_NONE Successful
634  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
635  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
636  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
637  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
638  *
639  * @see stt_set_error_cb()
640  * @see stt_unset_error_cb()
641 */
642 int stt_get_error_message(stt_h stt, char** err_msg);
643
644 /**
645  * @brief Checks whether the recognition type is supported.
646  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
647  * @privlevel public
648  * @privilege %http://tizen.org/privilege/recorder
649  *
650  * @param[in] stt The STT handle
651  * @param[in] type The type for recognition (e.g. #STT_RECOGNITION_TYPE_FREE, #STT_RECOGNITION_TYPE_FREE_PARTIAL)
652  * @param[out] support The result status @c true = supported, @c false = not supported
653  *
654  * @return 0 on success, otherwise a negative error value
655  * @retval #STT_ERROR_NONE Successful
656  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
657  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
658  * @retval #STT_ERROR_INVALID_STATE Invalid state
659  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
660  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
661  *
662  * @pre The state should be #STT_STATE_READY.
663 */
664 int stt_is_recognition_type_supported(stt_h stt, const char* type, bool* support);
665
666 /**
667  * @brief Sets the silence detection.
668  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
669  * @privlevel public
670  * @privilege %http://tizen.org/privilege/recorder
671  *
672  * @param[in] stt The STT handle
673  * @param[in] type The option type
674  *
675  * @return 0 on success, otherwise a negative error value
676  * @retval #STT_ERROR_NONE Successful
677  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
678  * @retval #STT_ERROR_INVALID_STATE Invalid state
679  * @retval #STT_ERROR_NOT_SUPPORTED_FEATURE Not supported feature of current engine
680  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
681  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
682  *
683  * @pre The state should be #STT_STATE_READY.
684 */
685 int stt_set_silence_detection(stt_h stt, stt_option_silence_detection_e type);
686
687 /**
688  * @brief Sets the sound to start recording.
689  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
690  * @privlevel public
691  * @privilege %http://tizen.org/privilege/recorder
692  *
693  * @remarks Sound file type should be wav type.
694  *
695  * @param[in] stt The STT handle
696  * @param[in] filename The sound file path
697  *
698  * @return 0 on success, otherwise a negative error value
699  * @retval #STT_ERROR_NONE Successful
700  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
701  * @retval #STT_ERROR_INVALID_STATE Invalid state
702  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
703  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
704  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
705  *
706  * @pre The state should be #STT_STATE_READY.
707 */
708 int stt_set_start_sound(stt_h stt, const char* filename);
709
710 /**
711  * @brief Unsets the sound to start recording.
712  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
713  * @privlevel public
714  * @privilege %http://tizen.org/privilege/recorder
715  *
716  * @param[in] stt The STT handle
717  *
718  * @return 0 on success, otherwise a negative error value
719  * @retval #STT_ERROR_NONE Successful
720  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
721  * @retval #STT_ERROR_INVALID_STATE Invalid state
722  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
723  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
724  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
725  *
726  * @pre The state should be #STT_STATE_READY.
727 */
728 int stt_unset_start_sound(stt_h stt);
729
730 /**
731  * @brief Sets the sound to stop recording.
732  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
733  * @privlevel public
734  * @privilege %http://tizen.org/privilege/recorder
735  *
736  * @remarks Sound file type should be wav type.
737  *
738  * @param[in] stt The STT handle
739  * @param[in] filename The sound file path
740  *
741  * @return 0 on success, otherwise a negative error value
742  * @retval #STT_ERROR_NONE Successful
743  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
744  * @retval #STT_ERROR_INVALID_STATE Invalid state
745  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
746  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
747  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
748  *
749  * @pre The state should be #STT_STATE_READY.
750 */
751 int stt_set_stop_sound(stt_h stt, const char* filename);
752
753 /**
754  * @brief Unsets the sound to stop recording.
755  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
756  * @privlevel public
757  * @privilege %http://tizen.org/privilege/recorder
758  *
759  * @param[in] stt The STT handle
760  *
761  * @return 0 on success, otherwise a negative error value
762  * @retval #STT_ERROR_NONE Successful
763  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
764  * @retval #STT_ERROR_INVALID_STATE Invalid state
765  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
766  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
767  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
768  *
769  * @pre The state should be #STT_STATE_READY.
770 */
771 int stt_unset_stop_sound(stt_h stt);
772
773 /**
774  * @brief Starts recording and recognition asynchronously.
775  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
776  * @privlevel public
777  * @privilege %http://tizen.org/privilege/recorder
778  *
779  * @remarks This function starts recording in the daemon and sending recording data to engine. \n
780  * This work continues until stt_stop(), stt_cancel() or silence detected by engine.
781  *
782  * @param[in] stt The STT handle
783  * @param[in] language The language selected from stt_foreach_supported_languages()
784  * @param[in] type The type for recognition (e.g. #STT_RECOGNITION_TYPE_FREE, #STT_RECOGNITION_TYPE_FREE_PARTIAL)
785  *
786  * @return 0 on success, otherwise a negative error value
787  * @retval #STT_ERROR_NONE Successful
788  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
789  * @retval #STT_ERROR_INVALID_STATE Invalid state
790  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
791  * @retval #STT_ERROR_RECORDER_BUSY Recorder busy
792  * @retval #STT_ERROR_INVALID_LANGUAGE Invalid language
793  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
794  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
795  * @retval #STT_ERROR_IN_PROGRESS_TO_RECORDING Progress to recording is not finished
796  *
797  * @pre The state should be #STT_STATE_READY.
798  * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
799  * If this function succeeds, the STT state will be #STT_STATE_RECORDING.
800  * If you call this function again before state changes, you will receive STT_ERROR_IN_PROGRESS_TO_RECORDING.
801  *
802  * @see stt_stop()
803  * @see stt_cancel()
804  * @see stt_state_changed_cb()
805 */
806 int stt_start(stt_h stt, const char* language, const char* type);
807
808 /**
809  * @brief Finishes the recording and starts recognition processing in engine asynchronously.
810  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
811  * @privlevel public
812  * @privilege %http://tizen.org/privilege/recorder
813  *
814  * @param[in] stt The STT handle
815  *
816  * @return 0 on success, otherwise a negative error value
817  * @retval #STT_ERROR_NONE Successful
818  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
819  * @retval #STT_ERROR_INVALID_STATE Invalid state
820  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
821  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
822  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
823  * @retval #STT_ERROR_IN_PROGRESS_TO_READY Progress to ready is not finished
824  * @retval #STT_ERROR_IN_PROGRESS_TO_RECORDING Progress to recording is not finished
825  * @retval #STT_ERROR_IN_PROGRESS_TO_PROCESSING Progress to processing is not finished
826  *
827  * @pre The state should be #STT_STATE_RECORDING.
828  * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
829  * If this function succeeds, the STT state will be #STT_STATE_PROCESSING. \n
830  * If you call this function again before state changes, you will receive STT_ERROR_IN_PROGRESS_TO_PROCESSING.
831  * After processing of engine, stt_result_cb() is called.
832  *
833  * @see stt_start()
834  * @see stt_cancel()
835  * @see stt_state_changed_cb()
836 */
837 int stt_stop(stt_h stt);
838
839 /**
840  * @brief Cancels processing recognition and recording asynchronously.
841  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
842  * @privlevel public
843  * @privilege %http://tizen.org/privilege/recorder
844  *
845  * @remarks This function cancels recording and engine cancels recognition processing. \n
846  * After successful cancel, stt_state_changed_cb() is called otherwise if error is occurred, stt_error_cb() is called.
847  *
848  * @param[in] stt The STT handle
849  *
850  * @return 0 on success, otherwise a negative error value
851  * @retval #STT_ERROR_NONE Successful
852  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
853  * @retval #STT_ERROR_INVALID_STATE Invalid state
854  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
855  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
856  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
857  * @retval #STT_ERROR_IN_PROGRESS_TO_READY Progress to ready is not finished
858  * @retval #STT_ERROR_IN_PROGRESS_TO_RECORDING Progress to recording is not finished
859  * @retval #STT_ERROR_IN_PROGRESS_TO_PROCESSING Progress to processing is not finished
860  *
861  * @pre The state should be #STT_STATE_RECORDING or #STT_STATE_PROCESSING.
862  * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
863  * If this function succeeds, the STT state will be #STT_STATE_READY.
864  * If you call this function again before state changes, you will receive STT_ERROR_IN_PROGRESS_TO_READY.
865  *
866  * @see stt_start()
867  * @see stt_stop()
868  * @see stt_state_changed_cb()
869 */
870 int stt_cancel(stt_h stt);
871
872 /**
873  * @brief Gets the microphone volume during recording.
874  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
875  * @privlevel public
876  * @privilege %http://tizen.org/privilege/recorder
877  *
878  * @param[in] stt The STT handle
879  * @param[out] volume Recording volume
880  *
881  * @return 0 on success, otherwise a negative error value
882  * @retval #STT_ERROR_NONE Successful
883  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
884  * @retval #STT_ERROR_INVALID_STATE Invalid state
885  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
886  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
887  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
888  *
889  * @pre The state should be #STT_STATE_RECORDING.
890  *
891  * @see stt_start()
892 */
893 int stt_get_recording_volume(stt_h stt, float* volume);
894
895 /**
896  * @brief Retrieves the time stamp of the current recognition result using the callback function.
897  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
898  * @privlevel public
899  * @privilege %http://tizen.org/privilege/recorder
900  *
901  * @remarks This function should be called in stt_recognition_result_cb().
902  *      After stt_recognition_result_cb(), result data is NOT valid.
903  *
904  * @param[in] stt The STT handle
905  * @param[in] callback The callback function to invoke
906  * @param[in] user_data The user data to be passed to the callback function
907  *
908  * @return 0 on success, otherwise a negative error value
909  * @retval #STT_ERROR_NONE Successful
910  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
911  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
912  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
913  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
914  *
915  * @pre This function should be called in stt_recognition_result_cb().
916  * @post This function invokes stt_result_time_cb() repeatedly for getting time information.
917  *
918  * @see stt_result_time_cb()
919  * @see stt_recognition_result_cb()
920 */
921 int stt_foreach_detailed_result(stt_h stt, stt_result_time_cb callback, void* user_data);
922
923 /**
924  * @brief Registers a callback function to get the recognition result.
925  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
926  * @privlevel public
927  * @privilege %http://tizen.org/privilege/recorder
928  *
929  * @param[in] stt The STT handle
930  * @param[in] callback The callback function to register
931  * @param[in] user_data The user data to be passed to the callback function
932  *
933  * @return 0 on success, otherwise a negative error value
934  * @retval #STT_ERROR_NONE Successful
935  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
936  * @retval #STT_ERROR_INVALID_STATE Invalid state
937  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
938  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
939  *
940  * @pre The state should be #STT_STATE_CREATED.
941  *
942  * @see stt_recognition_result_cb()
943  * @see stt_unset_recognition_result_cb()
944 */
945 int stt_set_recognition_result_cb(stt_h stt, stt_recognition_result_cb callback, void* user_data);
946
947 /**
948  * @brief Unregisters the callback function.
949  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
950  * @privlevel public
951  * @privilege %http://tizen.org/privilege/recorder
952  *
953  * @param[in] stt The STT handle
954  *
955  * @return 0 on success, otherwise a negative error value
956  * @retval #STT_ERROR_NONE Successful
957  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
958  * @retval #STT_ERROR_INVALID_STATE Invalid state
959  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
960  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
961  *
962  * @pre The state should be #STT_STATE_CREATED.
963  *
964  * @see stt_set_recognition_result_cb()
965 */
966 int stt_unset_recognition_result_cb(stt_h stt);
967
968 /**
969  * @brief Registers a callback function to be called when STT state changes.
970  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
971  * @privlevel public
972  * @privilege %http://tizen.org/privilege/recorder
973  *
974  * @param[in] stt The STT handle
975  * @param[in] callback The callback function to register
976  * @param[in] user_data The user data to be passed to the callback function
977  *
978  * @return 0 on success, otherwise a negative error value
979  * @retval #STT_ERROR_NONE Successful
980  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
981  * @retval #STT_ERROR_INVALID_STATE Invalid state
982  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
983  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
984  *
985  * @pre The state should be #STT_STATE_CREATED.
986  *
987  * @see stt_state_changed_cb()
988  * @see stt_unset_state_changed_cb()
989 */
990 int stt_set_state_changed_cb(stt_h stt, stt_state_changed_cb callback, void* user_data);
991
992 /**
993  * @brief Unregisters the callback function.
994  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
995  * @privlevel public
996  * @privilege %http://tizen.org/privilege/recorder
997  *
998  * @param[in] stt The STT handle
999  *
1000  * @return 0 on success, otherwise a negative error value
1001  * @retval #STT_ERROR_NONE Successful
1002  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
1003  * @retval #STT_ERROR_INVALID_STATE Invalid state
1004  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1005  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
1006  *
1007  * @pre The state should be #STT_STATE_CREATED.
1008  *
1009  * @see stt_set_state_changed_cb()
1010 */
1011 int stt_unset_state_changed_cb(stt_h stt);
1012
1013 /**
1014  * @brief Registers a callback function to be called when an error occurred.
1015  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1016  * @privlevel public
1017  * @privilege %http://tizen.org/privilege/recorder
1018  *
1019  * @param[in] stt The STT handle
1020  * @param[in] callback The callback function to register
1021  * @param[in] user_data The user data to be passed to the callback function
1022  *
1023  * @return 0 on success, otherwise a negative error value
1024  * @retval #STT_ERROR_NONE Successful
1025  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
1026  * @retval #STT_ERROR_INVALID_STATE Invalid state
1027  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1028  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
1029  *
1030  * @pre The state should be #STT_STATE_CREATED.
1031  *
1032  * @see stt_error_cb()
1033  * @see stt_unset_error_cb()
1034 */
1035 int stt_set_error_cb(stt_h stt, stt_error_cb callback, void* user_data);
1036
1037 /**
1038  * @brief Unregisters the callback function.
1039  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1040  * @privlevel public
1041  * @privilege %http://tizen.org/privilege/recorder
1042  *
1043  * @param[in] stt The STT handle
1044  *
1045  * @return 0 on success, otherwise a negative error value
1046  * @retval #STT_ERROR_NONE Successful
1047  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
1048  * @retval #STT_ERROR_INVALID_STATE Invalid state
1049  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1050  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
1051  *
1052  * @pre The state should be #STT_STATE_CREATED.
1053  *
1054  * @see stt_set_error_cb()
1055 */
1056 int stt_unset_error_cb(stt_h stt);
1057
1058 /**
1059  * @brief Registers a callback function to detect the default language change.
1060  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1061  * @privlevel public
1062  * @privilege %http://tizen.org/privilege/recorder
1063  *
1064  * @param[in] stt The STT handle
1065  * @param[in] callback The callback function to register
1066  * @param[in] user_data The user data to be passed to the callback function
1067  *
1068  * @return 0 on success, otherwise a negative error value
1069  * @retval #STT_ERROR_NONE Successful
1070  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
1071  * @retval #STT_ERROR_INVALID_STATE Invalid state
1072  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1073  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
1074  *
1075  * @pre The state should be #STT_STATE_CREATED.
1076  *
1077  * @see stt_default_language_changed_cb()
1078  * @see stt_unset_default_language_changed_cb()
1079 */
1080 int stt_set_default_language_changed_cb(stt_h stt, stt_default_language_changed_cb callback, void* user_data);
1081
1082 /**
1083  * @brief Unregisters the callback function.
1084  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1085  * @privlevel public
1086  * @privilege %http://tizen.org/privilege/recorder
1087  *
1088  * @param[in] stt The STT handle
1089  *
1090  * @return 0 on success, otherwise a negative error value
1091  * @retval #STT_ERROR_NONE Successful
1092  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
1093  * @retval #STT_ERROR_INVALID_STATE Invalid state
1094  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1095  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
1096  *
1097  * @pre The state should be #STT_STATE_CREATED.
1098  *
1099  * @see stt_set_default_language_changed_cb()
1100 */
1101 int stt_unset_default_language_changed_cb(stt_h stt);
1102
1103 /**
1104  * @brief Registers a callback function to detect the engine change.
1105  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
1106  * @privlevel public
1107  * @privilege %http://tizen.org/privilege/recorder
1108  *
1109  * @param[in] stt The STT handle
1110  * @param]in] callback The callback function to register
1111  * @param[in] user_data The user data to be passed to the callback function
1112  *
1113  * @return 0 on success, otherwise a negative error value
1114  * @retval #STT_ERROR_NONE Successful
1115  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
1116  * @retval #STT_ERROR_INVALID_STATE Invalid state
1117  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1118  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
1119  *
1120  * @pre The state should be #STT_STATE_CREATED.
1121  *
1122  * @see stt_engine_changed_cb()
1123  * @see stt_unset_engine_changed_cb()
1124 */
1125 int stt_set_engine_changed_cb(stt_h stt, stt_engine_changed_cb callback, void* user_data);
1126
1127 /**
1128  * @brief Unregisters the callback function.
1129  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
1130  * @privlevel public
1131  * @privilege %http://tizen.org/privilege/recorder
1132  *
1133  * @param[in] stt The STT handle
1134  *
1135  * @return 0 on success, otherwise a negative error value
1136  * @retval #STT_ERROR_NONE Successful
1137  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
1138  * @retval #STT_ERROR_INVALID_STATE Invalid state
1139  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1140  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
1141  *
1142  * @pre The state should be #STT_STATE_CREATED.
1143  *
1144  * @see stt_set_engine_changed_cb()
1145 */
1146 int stt_unset_engine_changed_cb(stt_h stt);
1147
1148
1149 #ifdef __cplusplus
1150 }
1151 #endif
1152
1153 /**
1154  * @}@}
1155  */
1156
1157 #endif /* __STT_H__ */
1158