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