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