Add ACR descriptions
[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 STT service */
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_RECORDING_TIMED_OUT           = TIZEN_ERROR_STT | 0x06,       /**< Recording timed out @if MOBILE (Since 3.0) @elseif WEARABLE (Since 2.3.2) @endif */
56         STT_ERROR_NO_SPEECH                     = TIZEN_ERROR_STT | 0x07,       /**< No speech while recording @if MOBILE (Since 3.0) @elseif WEARABLE (Since 2.3.2) @endif */
57         STT_ERROR_IN_PROGRESS_TO_READY          = TIZEN_ERROR_STT | 0x08,       /**< Progress to ready is not finished @if MOBILE (Since 3.0) @elseif WEARABLE (Since 2.3.2) @endif */
58         STT_ERROR_IN_PROGRESS_TO_RECORDING      = TIZEN_ERROR_STT | 0x09,       /**< Progress to recording is not finished @if MOBILE (Since 3.0) @elseif WEARABLE (Since 2.3.2) @endif */
59         STT_ERROR_IN_PROGRESS_TO_PROCESSING     = TIZEN_ERROR_STT | 0x10,       /**< Progress to processing is not finished @if MOBILE (Since 3.0) @elseif WEARABLE (Since 2.3.2) @endif */
60         STT_ERROR_SERVICE_RESET                 = TIZEN_ERROR_STT | 0x11        /**< Service reset @if MOBILE (Since 3.0) @elseif WEARABLE (Since 2.3.2) @endif */
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  * @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.
309  *
310  * @param[in] stt The STT handle
311  * @param[in] engine_id Engine id
312  * @param[in] language The default language
313  * @param[in] support_silence Whether the silence detection is supported or not
314  * @param[in] need_credential The necessity of credential
315  * @param[in] user_data The user data passed from the callback registration function
316  *
317  * @see stt_set_engine_changed_cb()
318 */
319 typedef void (*stt_engine_changed_cb)(stt_h stt, const char* engine_id, const char* language,
320                                                 bool support_silence, bool need_credential, void* user_data);
321
322 /**
323  * @brief Creates a STT handle.
324  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
325  * @privlevel public
326  * @privilege %http://tizen.org/privilege/recorder
327  *
328  * @remarks If the function succeeds, @a stt handle must be released with stt_destroy().
329  *
330  * @param[out] stt The STT handle
331  *
332  * @return 0 on success, otherwise a negative error value
333  * @retval #STT_ERROR_NONE Successful
334  * @retval #STT_ERROR_OUT_OF_MEMORY Out of memory
335  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
336  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
337  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
338  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
339  *
340  * @post If this function is called, the STT state will be #STT_STATE_CREATED.
341  *
342  * @see stt_destroy()
343 */
344 int stt_create(stt_h* stt);
345
346 /**
347  * @brief Destroys a STT handle.
348  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
349  * @privlevel public
350  * @privilege %http://tizen.org/privilege/recorder
351  *
352  * @param[in] stt The STT handle
353  *
354  * @return 0 on success, otherwise a negative error value
355  * @retval #STT_ERROR_NONE Successful
356  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
357  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
358  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
359  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
360  *
361  * @see stt_create()
362 */
363 int stt_destroy(stt_h stt);
364
365 /**
366  * @brief Retrieves supported engine information using a callback function.
367  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
368  * @privlevel public
369  * @privilege %http://tizen.org/privilege/recorder
370  *
371  * @param[in] stt The STT handle
372  * @param[in] callback The callback function to invoke
373  * @param[in] user_data The user data to be passed to the callback function
374  *
375  * @return 0 on success, otherwise a negative error value
376  * @retval #STT_ERROR_NONE Success
377  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
378  * @retval #STT_ERROR_INVALID_STATE STT Not initialized
379  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
380  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
381  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
382  *
383  * @pre The state should be #STT_STATE_CREATED.
384  * @post This function invokes stt_supported_engine_cb() repeatedly for getting engine information.
385  *
386  * @see stt_supported_engine_cb()
387 */
388 int stt_foreach_supported_engines(stt_h stt, stt_supported_engine_cb callback, void* user_data);
389
390 /**
391  * @brief Gets the current engine id.
392  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
393  * @privlevel public
394  * @privilege %http://tizen.org/privilege/recorder
395  *
396  * @remarks If the function is success, @a engine_id must be released using free().
397  *
398  * @param[in] stt The STT handle
399  * @param[out] engine_id Engine id
400  *
401  * @return 0 on success, otherwise a negative error value
402  * @retval #STT_ERROR_NONE Success
403  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
404  * @retval #STT_ERROR_INVALID_STATE STT Not initialized
405  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
406  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
407  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
408  *
409  * @pre The state should be #STT_STATE_CREATED.
410  *
411  * @see stt_set_engine()
412 */
413 int stt_get_engine(stt_h stt, char** engine_id);
414
415 /**
416  * @brief Sets the engine id.
417  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
418  * @privlevel public
419  * @privilege %http://tizen.org/privilege/recorder
420  * @privilege %http://tizen.org/privilege/appmanager.launch
421  *
422  * @remarks A privilege (%http://tizen.org/privilege/appmanager.launch) is necessary since 3.0.
423  *
424  * @param[in] stt The STT handle
425  * @param[in] engine_id Engine id
426  *
427  * @return 0 on success, otherwise a negative error value
428  * @retval #STT_ERROR_NONE Success
429  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
430  * @retval #STT_ERROR_INVALID_STATE STT Not initialized
431  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
432  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
433  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
434  *
435  * @pre The state should be #STT_STATE_CREATED.
436  *
437  * @see stt_get_engine()
438 */
439 int stt_set_engine(stt_h stt, const char* engine_id);
440
441 /**
442  * @brief Sets the app credential.
443  * @details Using this API, the application can set a credential.
444  *      The credential is a key to verify the authorization about using the engine.
445  *      If the application sets the credential, it will be able to use functions of the engine entirely.
446  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
447  *
448  * @remarks The necessity of the credential depends on the engine. In case of the engine which is basically embedded in Tizen, the credential is not necessary so far.
449  *      However, if the user wants to apply the 3rd party's engine, the credential may be necessary. In that case, please follow the policy provided by the corresponding engine.
450  *
451  * @param[in] stt The STT handle
452  * @param[in] credential The app credential
453  *
454  * @return 0 on success, otherwise a negative error value
455  * @retval #STT_ERROR_NONE Success
456  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
457  * @retval #STT_ERROR_INVALID_STATE Invalid state
458  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
459  *
460  * @pre The state should be #STT_STATE_CREATED or #STT_STATE_READY.
461  *
462  * @see stt_start()
463 */
464
465 int stt_set_credential(stt_h stt, const char* credential);
466
467 /**
468  * @brief Sets the private data to stt engine.
469  * @details The private data is the setting parameter for applying keys provided by the engine.
470  *      Using this API, the application can set the private data and use the corresponding key of the engine.
471  *      For example, if the engine provides 'partial recognition' as a recognition type, the application can set the private data as the following. \n
472  *      int ret = stt_set_private_data(stt_h, "recognition_type", "PARTIAL");
473  *
474  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
475  *
476  * @remarks If the engine is replaced with the other engine, the key may be ignored.
477  *
478  * @param[in] stt The STT handle
479  * @param[in] key The field name of private data
480  * @param[in] data The data for set
481  *
482  * @return 0 on success, otherwise a negative error value
483  * @retval #STT_ERROR_NONE Successful
484  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
485  * @retval #STT_ERROR_INVALID_STATE Invalid state
486  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
487  * @retval #STT_ERROR_TIMED_OUT No answer from the STT service
488  *
489  * @pre The state should be #STT_STATE_READY.
490  *
491  * @see stt_get_private_data()
492 */
493 int stt_set_private_data(stt_h stt, const char* key, const char* data);
494
495 /**
496  * @brief Gets the private data from stt engine.
497  * @details The private data is the information provided by the engine.
498  *      Using this API, the application can get the private data which corresponds to the key from the engine.
499
500  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
501  *
502  * @remarks If the engine is replaced with the other engine, the key may be ignored.
503  *
504  * @param[in] stt The STT handle
505  * @param[in] key The field name of private data
506  * @param[out] data The data field of private data
507  *
508  * @remarks The @a data must be released using free() when it is no longer required.
509  *
510  * @return 0 on success, otherwise a negative error value
511  * @retval #STT_ERROR_NONE Successful
512  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
513  * @retval #STT_ERROR_INVALID_STATE Invalid state
514  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
515  * @retval #STT_ERROR_TIMED_OUT No answer from the STT service
516  *
517  * @pre The state should be #STT_STATE_READY.
518  *
519  * @see stt_set_private_data()
520 */
521 int stt_get_private_data(stt_h stt, const char* key, char** data);
522
523 /**
524  * @brief Connects the STT service asynchronously.
525  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
526  * @privlevel public
527  * @privilege %http://tizen.org/privilege/recorder
528  *
529  * @param[in] stt The STT handle
530  *
531  * @return 0 on success, otherwise a negative error value
532  * @retval #STT_ERROR_NONE Successful
533  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
534  * @retval #STT_ERROR_INVALID_STATE Invalid state
535  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
536  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
537  *
538  * @pre The state should be #STT_STATE_CREATED.
539  * @post If this function is successful, the STT state will be #STT_STATE_READY. \n
540  *      If this function is failed, the error callback is called. (e.g. #STT_ERROR_ENGINE_NOT_FOUND)
541  *
542  * @see stt_unprepare()
543 */
544 int stt_prepare(stt_h stt);
545
546 /**
547  * @brief Disconnects the STT service.
548  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
549  * @privlevel public
550  * @privilege %http://tizen.org/privilege/recorder
551  *
552  * @param[in] stt The STT handle
553  *
554  * @return 0 on success, otherwise a negative error value
555  * @retval #STT_ERROR_NONE Successful
556  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
557  * @retval #STT_ERROR_INVALID_STATE Invalid state
558  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
559  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
560  *
561  * @pre The state should be #STT_STATE_READY.
562  * @post If this function is called, the STT state will be #STT_STATE_CREATED.
563  *
564  * @see stt_prepare()
565 */
566 int stt_unprepare(stt_h stt);
567
568 /**
569  * @brief Retrieves all supported languages of current engine using callback function.
570  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
571  * @privlevel public
572  * @privilege %http://tizen.org/privilege/recorder
573  *
574  * @param[in] stt The STT handle
575  * @param[in] callback The callback function to invoke
576  * @param[in] user_data The user data to be passed to the callback function
577  *
578  * @return 0 on success, otherwise a negative error value
579  * @retval #STT_ERROR_NONE Successful
580  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
581  * @retval #STT_ERROR_OUT_OF_MEMORY Out of memory
582  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
583  * @retval #STT_ERROR_ENGINE_NOT_FOUND No available engine
584  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
585  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
586  *
587  * @post This function invokes stt_supported_language_cb() repeatedly for getting languages.
588  *
589  * @see stt_supported_language_cb()
590  * @see stt_get_default_language()
591 */
592 int stt_foreach_supported_languages(stt_h stt, stt_supported_language_cb callback, void* user_data);
593
594 /**
595  * @brief Gets the default language set by the user.
596  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
597  * @privlevel public
598  * @privilege %http://tizen.org/privilege/recorder
599  * @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
600  * For example, "ko_KR" for Korean, "en_US" for American English. \n
601  * If the function succeeds, @a language must be released using free() when it is no longer required.
602  *
603  * @param[in] stt The STT handle
604  * @param[out] language The language
605  *
606  * @return 0 on success, otherwise a negative error value
607  * @retval #STT_ERROR_NONE Successful
608  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
609  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
610  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
611  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
612  *
613  * @see stt_foreach_supported_languages()
614 */
615 int stt_get_default_language(stt_h stt, char** language);
616
617 /**
618  * @brief Gets the current STT state.
619  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
620  * @privlevel public
621  * @privilege %http://tizen.org/privilege/recorder
622  *
623  * @param[in] stt The STT handle
624  * @param[out] state The current STT state
625  *
626  * @return 0 on success, otherwise a negative error value
627  * @retval #STT_ERROR_NONE Successful
628  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
629  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
630  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
631  *
632  * @see stt_start()
633  * @see stt_stop()
634  * @see stt_cancel()
635  * @see stt_state_changed_cb()
636 */
637 int stt_get_state(stt_h stt, stt_state_e* state);
638
639 /**
640  * @brief Gets the current error message.
641  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
642  * @remarks This function should be called during an stt error callback. If not, the error as operation failure will be returned. \n
643  *      If the function succeeds, @a err_msg must be released using free() when it is no longer required.
644  *
645  * @param[in] stt The STT handle
646  * @param[out] err_msg The current error message
647  *
648  * @return 0 on success, otherwise a negative error value
649  * @retval #STT_ERROR_NONE Successful
650  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
651  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
652  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
653  *
654  * @see stt_set_error_cb()
655  * @see stt_unset_error_cb()
656 */
657 int stt_get_error_message(stt_h stt, char** err_msg);
658
659 /**
660  * @brief Checks whether the recognition type is supported.
661  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
662  * @privlevel public
663  * @privilege %http://tizen.org/privilege/recorder
664  *
665  * @param[in] stt The STT handle
666  * @param[in] type The type for recognition (e.g. #STT_RECOGNITION_TYPE_FREE, #STT_RECOGNITION_TYPE_FREE_PARTIAL)
667  * @param[out] support The result status @c true = supported, @c false = not supported
668  *
669  * @return 0 on success, otherwise a negative error value
670  * @retval #STT_ERROR_NONE Successful
671  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
672  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
673  * @retval #STT_ERROR_INVALID_STATE Invalid state
674  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
675  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
676  *
677  * @pre The state should be #STT_STATE_READY.
678 */
679 int stt_is_recognition_type_supported(stt_h stt, const char* type, bool* support);
680
681 /**
682  * @brief Sets the silence detection.
683  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
684  * @privlevel public
685  * @privilege %http://tizen.org/privilege/recorder
686  *
687  * @param[in] stt The STT handle
688  * @param[in] type The option type
689  *
690  * @return 0 on success, otherwise a negative error value
691  * @retval #STT_ERROR_NONE Successful
692  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
693  * @retval #STT_ERROR_INVALID_STATE Invalid state
694  * @retval #STT_ERROR_NOT_SUPPORTED_FEATURE Not supported feature of current engine
695  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
696  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
697  *
698  * @pre The state should be #STT_STATE_READY.
699 */
700 int stt_set_silence_detection(stt_h stt, stt_option_silence_detection_e type);
701
702 /**
703  * @brief Sets the sound to start recording.
704  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
705  * @privlevel public
706  * @privilege %http://tizen.org/privilege/recorder
707  *
708  * @remarks Sound file type should be wav type.
709  *
710  * @param[in] stt The STT handle
711  * @param[in] filename The sound file path
712  *
713  * @return 0 on success, otherwise a negative error value
714  * @retval #STT_ERROR_NONE Successful
715  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
716  * @retval #STT_ERROR_INVALID_STATE Invalid state
717  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
718  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
719  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
720  *
721  * @pre The state should be #STT_STATE_READY.
722 */
723 int stt_set_start_sound(stt_h stt, const char* filename);
724
725 /**
726  * @brief Unsets the sound to start recording.
727  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
728  * @privlevel public
729  * @privilege %http://tizen.org/privilege/recorder
730  *
731  * @param[in] stt The STT handle
732  *
733  * @return 0 on success, otherwise a negative error value
734  * @retval #STT_ERROR_NONE Successful
735  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
736  * @retval #STT_ERROR_INVALID_STATE Invalid state
737  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
738  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
739  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
740  *
741  * @pre The state should be #STT_STATE_READY.
742 */
743 int stt_unset_start_sound(stt_h stt);
744
745 /**
746  * @brief Sets the sound to stop recording.
747  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
748  * @privlevel public
749  * @privilege %http://tizen.org/privilege/recorder
750  *
751  * @remarks Sound file type should be wav type.
752  *
753  * @param[in] stt The STT handle
754  * @param[in] filename The sound file path
755  *
756  * @return 0 on success, otherwise a negative error value
757  * @retval #STT_ERROR_NONE Successful
758  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
759  * @retval #STT_ERROR_INVALID_STATE Invalid state
760  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
761  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
762  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
763  *
764  * @pre The state should be #STT_STATE_READY.
765 */
766 int stt_set_stop_sound(stt_h stt, const char* filename);
767
768 /**
769  * @brief Unsets the sound to stop recording.
770  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
771  * @privlevel public
772  * @privilege %http://tizen.org/privilege/recorder
773  *
774  * @param[in] stt The STT handle
775  *
776  * @return 0 on success, otherwise a negative error value
777  * @retval #STT_ERROR_NONE Successful
778  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
779  * @retval #STT_ERROR_INVALID_STATE Invalid state
780  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
781  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
782  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
783  *
784  * @pre The state should be #STT_STATE_READY.
785 */
786 int stt_unset_stop_sound(stt_h stt);
787
788 /**
789  * @brief Starts recording and recognition asynchronously.
790  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
791  * @privlevel public
792  * @privilege %http://tizen.org/privilege/recorder
793  *
794  * @remarks This function starts recording in the STT service and sending recording data to engine. \n
795  * This work continues until stt_stop(), stt_cancel() or silence detected by engine.
796  *
797  * @param[in] stt The STT handle
798  * @param[in] language The language selected from stt_foreach_supported_languages()
799  * @param[in] type The type for recognition (e.g. #STT_RECOGNITION_TYPE_FREE, #STT_RECOGNITION_TYPE_FREE_PARTIAL)
800  *
801  * @return 0 on success, otherwise a negative error value
802  * @retval #STT_ERROR_NONE Successful
803  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
804  * @retval #STT_ERROR_INVALID_STATE Invalid state
805  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
806  * @retval #STT_ERROR_RECORDER_BUSY Recorder busy
807  * @retval #STT_ERROR_INVALID_LANGUAGE Invalid language
808  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
809  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
810  * @retval #STT_ERROR_IN_PROGRESS_TO_RECORDING Progress to recording is not finished
811  *
812  * @pre The state should be #STT_STATE_READY.
813  * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
814  * If this function succeeds, the STT state will be #STT_STATE_RECORDING.
815  * If you call this function again before state changes, you will receive STT_ERROR_IN_PROGRESS_TO_RECORDING.
816  *
817  * @see stt_stop()
818  * @see stt_cancel()
819  * @see stt_state_changed_cb()
820 */
821 int stt_start(stt_h stt, const char* language, const char* type);
822
823 /**
824  * @brief Finishes the recording and starts recognition processing in engine asynchronously.
825  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
826  * @privlevel public
827  * @privilege %http://tizen.org/privilege/recorder
828  *
829  * @param[in] stt The STT handle
830  *
831  * @return 0 on success, otherwise a negative error value
832  * @retval #STT_ERROR_NONE Successful
833  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
834  * @retval #STT_ERROR_INVALID_STATE Invalid state
835  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
836  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
837  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
838  * @retval #STT_ERROR_IN_PROGRESS_TO_READY Progress to ready is not finished
839  * @retval #STT_ERROR_IN_PROGRESS_TO_RECORDING Progress to recording is not finished
840  * @retval #STT_ERROR_IN_PROGRESS_TO_PROCESSING Progress to processing is not finished
841  *
842  * @pre The state should be #STT_STATE_RECORDING.
843  * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
844  * If this function succeeds, the STT state will be #STT_STATE_PROCESSING. \n
845  * If you call this function again before state changes, you will receive STT_ERROR_IN_PROGRESS_TO_PROCESSING.
846  * After processing of engine, stt_result_cb() is called.
847  *
848  * @see stt_start()
849  * @see stt_cancel()
850  * @see stt_state_changed_cb()
851 */
852 int stt_stop(stt_h stt);
853
854 /**
855  * @brief Cancels processing recognition and recording asynchronously.
856  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
857  * @privlevel public
858  * @privilege %http://tizen.org/privilege/recorder
859  *
860  * @remarks This function cancels recording and engine cancels recognition processing. \n
861  * After successful cancel, stt_state_changed_cb() is called otherwise if error is occurred, stt_error_cb() is called.
862  *
863  * @param[in] stt The STT handle
864  *
865  * @return 0 on success, otherwise a negative error value
866  * @retval #STT_ERROR_NONE Successful
867  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
868  * @retval #STT_ERROR_INVALID_STATE Invalid state
869  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
870  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
871  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
872  * @retval #STT_ERROR_IN_PROGRESS_TO_READY Progress to ready is not finished
873  * @retval #STT_ERROR_IN_PROGRESS_TO_RECORDING Progress to recording is not finished
874  * @retval #STT_ERROR_IN_PROGRESS_TO_PROCESSING Progress to processing is not finished
875  *
876  * @pre The state should be #STT_STATE_RECORDING or #STT_STATE_PROCESSING.
877  * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
878  * If this function succeeds, the STT state will be #STT_STATE_READY.
879  * If you call this function again before state changes, you will receive STT_ERROR_IN_PROGRESS_TO_READY.
880  *
881  * @see stt_start()
882  * @see stt_stop()
883  * @see stt_state_changed_cb()
884 */
885 int stt_cancel(stt_h stt);
886
887 /**
888  * @brief Gets the microphone volume during recording.
889  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
890  * @privlevel public
891  * @privilege %http://tizen.org/privilege/recorder
892  *
893  * @param[in] stt The STT handle
894  * @param[out] volume Recording volume
895  *
896  * @return 0 on success, otherwise a negative error value
897  * @retval #STT_ERROR_NONE Successful
898  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
899  * @retval #STT_ERROR_INVALID_STATE Invalid state
900  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
901  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
902  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
903  *
904  * @pre The state should be #STT_STATE_RECORDING.
905  *
906  * @see stt_start()
907 */
908 int stt_get_recording_volume(stt_h stt, float* volume);
909
910 /**
911  * @brief Retrieves the time stamp of the current recognition result using the callback function.
912  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
913  * @privlevel public
914  * @privilege %http://tizen.org/privilege/recorder
915  *
916  * @remarks This function should be called in stt_recognition_result_cb().
917  *      After stt_recognition_result_cb(), result data is NOT valid.
918  *
919  * @param[in] stt The STT handle
920  * @param[in] callback The callback function to invoke
921  * @param[in] user_data The user data to be passed to the callback function
922  *
923  * @return 0 on success, otherwise a negative error value
924  * @retval #STT_ERROR_NONE Successful
925  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
926  * @retval #STT_ERROR_OPERATION_FAILED Operation failure
927  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
928  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
929  *
930  * @pre This function should be called in stt_recognition_result_cb().
931  * @post This function invokes stt_result_time_cb() repeatedly for getting time information.
932  *
933  * @see stt_result_time_cb()
934  * @see stt_recognition_result_cb()
935 */
936 int stt_foreach_detailed_result(stt_h stt, stt_result_time_cb callback, void* user_data);
937
938 /**
939  * @brief Registers a callback function to get the recognition result.
940  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
941  * @privlevel public
942  * @privilege %http://tizen.org/privilege/recorder
943  *
944  * @param[in] stt The STT handle
945  * @param[in] callback The callback function to register
946  * @param[in] user_data The user data to be passed to the callback function
947  *
948  * @return 0 on success, otherwise a negative error value
949  * @retval #STT_ERROR_NONE Successful
950  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
951  * @retval #STT_ERROR_INVALID_STATE Invalid state
952  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
953  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
954  *
955  * @pre The state should be #STT_STATE_CREATED.
956  *
957  * @see stt_recognition_result_cb()
958  * @see stt_unset_recognition_result_cb()
959 */
960 int stt_set_recognition_result_cb(stt_h stt, stt_recognition_result_cb callback, void* user_data);
961
962 /**
963  * @brief Unregisters the callback function.
964  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
965  * @privlevel public
966  * @privilege %http://tizen.org/privilege/recorder
967  *
968  * @param[in] stt The STT handle
969  *
970  * @return 0 on success, otherwise a negative error value
971  * @retval #STT_ERROR_NONE Successful
972  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
973  * @retval #STT_ERROR_INVALID_STATE Invalid state
974  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
975  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
976  *
977  * @pre The state should be #STT_STATE_CREATED.
978  *
979  * @see stt_set_recognition_result_cb()
980 */
981 int stt_unset_recognition_result_cb(stt_h stt);
982
983 /**
984  * @brief Registers a callback function to be called when STT state changes.
985  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
986  * @privlevel public
987  * @privilege %http://tizen.org/privilege/recorder
988  *
989  * @param[in] stt The STT handle
990  * @param[in] callback The callback function to register
991  * @param[in] user_data The user data to be passed to the callback function
992  *
993  * @return 0 on success, otherwise a negative error value
994  * @retval #STT_ERROR_NONE Successful
995  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
996  * @retval #STT_ERROR_INVALID_STATE Invalid state
997  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
998  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
999  *
1000  * @pre The state should be #STT_STATE_CREATED.
1001  *
1002  * @see stt_state_changed_cb()
1003  * @see stt_unset_state_changed_cb()
1004 */
1005 int stt_set_state_changed_cb(stt_h stt, stt_state_changed_cb callback, void* user_data);
1006
1007 /**
1008  * @brief Unregisters the callback function.
1009  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1010  * @privlevel public
1011  * @privilege %http://tizen.org/privilege/recorder
1012  *
1013  * @param[in] stt The STT handle
1014  *
1015  * @return 0 on success, otherwise a negative error value
1016  * @retval #STT_ERROR_NONE Successful
1017  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
1018  * @retval #STT_ERROR_INVALID_STATE Invalid state
1019  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1020  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
1021  *
1022  * @pre The state should be #STT_STATE_CREATED.
1023  *
1024  * @see stt_set_state_changed_cb()
1025 */
1026 int stt_unset_state_changed_cb(stt_h stt);
1027
1028 /**
1029  * @brief Registers a callback function to be called when an error occurred.
1030  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1031  * @privlevel public
1032  * @privilege %http://tizen.org/privilege/recorder
1033  *
1034  * @param[in] stt The STT handle
1035  * @param[in] callback The callback function to register
1036  * @param[in] user_data The user data to be passed to the callback function
1037  *
1038  * @return 0 on success, otherwise a negative error value
1039  * @retval #STT_ERROR_NONE Successful
1040  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
1041  * @retval #STT_ERROR_INVALID_STATE Invalid state
1042  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1043  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
1044  *
1045  * @pre The state should be #STT_STATE_CREATED.
1046  *
1047  * @see stt_error_cb()
1048  * @see stt_unset_error_cb()
1049 */
1050 int stt_set_error_cb(stt_h stt, stt_error_cb callback, void* user_data);
1051
1052 /**
1053  * @brief Unregisters the callback function.
1054  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1055  * @privlevel public
1056  * @privilege %http://tizen.org/privilege/recorder
1057  *
1058  * @param[in] stt The STT handle
1059  *
1060  * @return 0 on success, otherwise a negative error value
1061  * @retval #STT_ERROR_NONE Successful
1062  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
1063  * @retval #STT_ERROR_INVALID_STATE Invalid state
1064  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1065  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
1066  *
1067  * @pre The state should be #STT_STATE_CREATED.
1068  *
1069  * @see stt_set_error_cb()
1070 */
1071 int stt_unset_error_cb(stt_h stt);
1072
1073 /**
1074  * @brief Registers a callback function to detect the default language change.
1075  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1076  * @privlevel public
1077  * @privilege %http://tizen.org/privilege/recorder
1078  *
1079  * @param[in] stt The STT handle
1080  * @param[in] callback The callback function to register
1081  * @param[in] user_data The user data to be passed to the callback function
1082  *
1083  * @return 0 on success, otherwise a negative error value
1084  * @retval #STT_ERROR_NONE Successful
1085  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
1086  * @retval #STT_ERROR_INVALID_STATE Invalid state
1087  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1088  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
1089  *
1090  * @pre The state should be #STT_STATE_CREATED.
1091  *
1092  * @see stt_default_language_changed_cb()
1093  * @see stt_unset_default_language_changed_cb()
1094 */
1095 int stt_set_default_language_changed_cb(stt_h stt, stt_default_language_changed_cb callback, void* user_data);
1096
1097 /**
1098  * @brief Unregisters the callback function.
1099  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1100  * @privlevel public
1101  * @privilege %http://tizen.org/privilege/recorder
1102  *
1103  * @param[in] stt The STT handle
1104  *
1105  * @return 0 on success, otherwise a negative error value
1106  * @retval #STT_ERROR_NONE Successful
1107  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
1108  * @retval #STT_ERROR_INVALID_STATE Invalid state
1109  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1110  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
1111  *
1112  * @pre The state should be #STT_STATE_CREATED.
1113  *
1114  * @see stt_set_default_language_changed_cb()
1115 */
1116 int stt_unset_default_language_changed_cb(stt_h stt);
1117
1118 /**
1119  * @brief Registers a callback function to detect the engine change.
1120  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
1121  *
1122  * @param[in] stt The STT handle
1123  * @param[in] callback The callback function to register
1124  * @param[in] user_data The user data to be passed to the callback function
1125  *
1126  * @return 0 on success, otherwise a negative error value
1127  * @retval #STT_ERROR_NONE Successful
1128  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
1129  * @retval #STT_ERROR_INVALID_STATE Invalid state
1130  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1131  *
1132  * @pre The state should be #STT_STATE_CREATED.
1133  *
1134  * @see stt_engine_changed_cb()
1135  * @see stt_unset_engine_changed_cb()
1136 */
1137 int stt_set_engine_changed_cb(stt_h stt, stt_engine_changed_cb callback, void* user_data);
1138
1139 /**
1140  * @brief Unregisters the callback function.
1141  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
1142  *
1143  * @param[in] stt The STT handle
1144  *
1145  * @return 0 on success, otherwise a negative error value
1146  * @retval #STT_ERROR_NONE Successful
1147  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
1148  * @retval #STT_ERROR_INVALID_STATE Invalid state
1149  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1150  *
1151  * @pre The state should be #STT_STATE_CREATED.
1152  *
1153  * @see stt_set_engine_changed_cb()
1154 */
1155 int stt_unset_engine_changed_cb(stt_h stt);
1156
1157
1158 #ifdef __cplusplus
1159 }
1160 #endif
1161
1162 /**
1163  * @}@}
1164  */
1165
1166 #endif /* __STT_H__ */
1167