2 * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
27 * @addtogroup CAPI_UIX_STT_MODULE
37 * @brief Enumerations for error codes.
38 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
41 STT_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
42 STT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */
43 STT_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
44 STT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,/**< Invalid parameter */
45 STT_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< No answer from the daemon */
46 STT_ERROR_RECORDER_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Device or resource busy */
47 STT_ERROR_OUT_OF_NETWORK = TIZEN_ERROR_NETWORK_DOWN, /**< Network is down */
48 STT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,/**< Permission denied */
49 STT_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< STT NOT supported */
50 STT_ERROR_INVALID_STATE = TIZEN_ERROR_STT | 0x01, /**< Invalid state */
51 STT_ERROR_INVALID_LANGUAGE = TIZEN_ERROR_STT | 0x02, /**< Invalid language */
52 STT_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_STT | 0x03, /**< No available engine */
53 STT_ERROR_OPERATION_FAILED = TIZEN_ERROR_STT | 0x04, /**< Operation failed */
54 STT_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_STT | 0x05 /**< Not supported feature of current engine */
58 * @brief Definition for free form dictation and default type.
59 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
61 #define STT_RECOGNITION_TYPE_FREE "stt.recognition.type.FREE"
64 * @brief Definition for continuous free dictation.
65 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
67 #define STT_RECOGNITION_TYPE_FREE_PARTIAL "stt.recognition.type.FREE.PARTIAL"
70 * @brief Definition for search.
71 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
73 #define STT_RECOGNITION_TYPE_SEARCH "stt.recognition.type.SEARCH"
76 * @brief Definition for web search.
77 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
79 #define STT_RECOGNITION_TYPE_WEB_SEARCH "stt.recognition.type.WEB_SEARCH"
82 * @brief Definition for map.
83 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
85 #define STT_RECOGNITION_TYPE_MAP "stt.recognition.type.MAP"
88 * @brief Definition for none message.
89 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
91 #define STT_RESULT_MESSAGE_NONE "stt.result.message.none"
94 * @brief Definition for failed recognition because the speech started too soon.
95 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
97 #define STT_RESULT_MESSAGE_ERROR_TOO_SOON "stt.result.message.error.too.soon"
100 * @brief Definition for failed recognition because the speech is too short.
101 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
103 #define STT_RESULT_MESSAGE_ERROR_TOO_SHORT "stt.result.message.error.too.short"
106 * @brief Definition for failed recognition because the speech is too long.
107 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
109 #define STT_RESULT_MESSAGE_ERROR_TOO_LONG "stt.result.message.error.too.long"
112 * @brief Definition for failed recognition because the speech is too quiet to listen.
113 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
115 #define STT_RESULT_MESSAGE_ERROR_TOO_QUIET "stt.result.message.error.too.quiet"
118 * @brief Definition for failed recognition because the speech is too loud to listen.
119 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
121 #define STT_RESULT_MESSAGE_ERROR_TOO_LOUD "stt.result.message.error.too.loud"
124 * @brief Definition for failed recognition because the speech is too fast to listen.
125 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
127 #define STT_RESULT_MESSAGE_ERROR_TOO_FAST "stt.result.message.error.too.fast"
131 * @brief Enumeration for state.
132 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
135 STT_STATE_CREATED = 0, /**< 'CREATED' state */
136 STT_STATE_READY = 1, /**< 'READY' state */
137 STT_STATE_RECORDING = 2, /**< 'RECORDING' state */
138 STT_STATE_PROCESSING = 3 /**< 'PROCESSING' state*/
142 * @brief Enumeration for result event.
143 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
146 STT_RESULT_EVENT_FINAL_RESULT = 0, /**< Event when the recognition full or last result is ready */
147 STT_RESULT_EVENT_PARTIAL_RESULT, /**< Event when the recognition partial result is ready */
148 STT_RESULT_EVENT_ERROR /**< Event when the recognition has failed */
149 } stt_result_event_e;
152 * @brief Enumeration for result time callback event.
153 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
156 STT_RESULT_TIME_EVENT_BEGINNING = 0, /**< Event when the token is beginning type */
157 STT_RESULT_TIME_EVENT_MIDDLE = 1, /**< Event when the token is middle type */
158 STT_RESULT_TIME_EVENT_END = 2 /**< Event when the token is end type */
159 } stt_result_time_event_e;
162 * @brief Enumeration for silence detection type.
163 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
166 STT_OPTION_SILENCE_DETECTION_FALSE = 0, /**< Silence detection type - False */
167 STT_OPTION_SILENCE_DETECTION_TRUE = 1, /**< Silence detection type - True */
168 STT_OPTION_SILENCE_DETECTION_AUTO = 2 /**< Silence detection type - Auto */
169 } stt_option_silence_detection_e;
172 * @brief A structure of STT handler.
173 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
175 typedef struct stt_s *stt_h;
178 * @brief Called to get the engine information.
179 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
181 * @param[in] engine_id Engine id
182 * @param[in] engine_name Engine name
183 * @param[in] user_data User data passed from the stt_setting_foreach_supported_engines()
185 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
186 * @pre stt_foreach_supported_engines() will invoke this callback.
188 * @see stt_foreach_supported_engines()
190 typedef bool(*stt_supported_engine_cb)(stt_h stt, const char* engine_id, const char* engine_name, void* user_data);
193 * @brief Called when STT gets the recognition result from the engine.
194 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
196 * @remarks After stt_stop() is called, silence is detected from recording, or partial result is occured,
197 * this function is called.
199 * @param[in] stt The STT handle
200 * @param[in] event The result event
201 * @param[in] data Result texts
202 * @param[in] data_count Result text count
203 * @param[in] msg Engine message (e.g. #STT_RESULT_MESSAGE_NONE, #STT_RESULT_MESSAGE_ERROR_TOO_SHORT)
204 * @param[in] user_data The user data passed from the callback registration function
206 * @pre stt_stop() will invoke this callback if you register it using stt_set_result_cb().
207 * @post If this function is called and event is #STT_RESULT_EVENT_FINAL_RESULT, the STT state will be #STT_STATE_READY.
210 * @see stt_set_recognition_result_cb()
211 * @see stt_unset_recognition_result_cb()
213 typedef void (*stt_recognition_result_cb)(stt_h stt, stt_result_event_e event, const char** data, int data_count,
214 const char* msg, void *user_data);
217 * @brief Called when STT get the result time stamp in free partial type.
218 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
220 * @param[in] stt The STT handle
221 * @param[in] index The result index
222 * @param[in] event The token event
223 * @param[in] text The result text
224 * @param[in] start_time The start time of result text
225 * @param[in] end_time The end time of result text
226 * @param[in] user_data The user data passed from the foreach function
228 * @return @c true to continue with the next iteration of the loop \n @c false to break out of the loop
230 * @pre stt_recognition_result_cb() should be called.
232 * @see stt_recognition_result_cb()
234 typedef bool (*stt_result_time_cb)(stt_h stt, int index, stt_result_time_event_e event, const char* text,
235 long start_time, long end_time, void* user_data);
238 * @brief Called when the state of STT is changed.
239 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
241 * @param[in] stt The STT handle
242 * @param[in] previous A previous state
243 * @param[in] current A current state
244 * @param[in] user_data The user data passed from the callback registration function
246 * @pre An application registers this callback using stt_set_state_changed_cb() to detect changing state.
248 * @see stt_set_state_changed_cb()
249 * @see stt_unset_state_changed_cb()
251 typedef void (*stt_state_changed_cb)(stt_h stt, stt_state_e previous, stt_state_e current, void* user_data);
254 * @brief Called when an error occurs.
255 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
257 * @param[in] stt The STT handle
258 * @param[in] reason The error type (e.g. #STT_ERROR_OUT_OF_NETWORK, #STT_ERROR_IO_ERROR)
259 * @param[in] user_data The user data passed from the callback registration function
261 * @pre An application registers this callback using stt_set_error_cb() to detect error.
263 * @see stt_set_error_cb()
264 * @see stt_unset_error_cb()
266 typedef void (*stt_error_cb)(stt_h stt, stt_error_e reason, void *user_data);
269 * @brief Called to retrieve the supported languages.
270 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
271 * @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.
273 * @param[in] stt The STT handle
274 * @param[in] language The language
275 * @param[in] user_data The user data passed from the foreach function
277 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
278 * @pre stt_foreach_supported_languages() will invoke this callback.
280 * @see stt_foreach_supported_languages()
282 typedef bool (*stt_supported_language_cb)(stt_h stt, const char* language, void* user_data);
285 * @brief Called when the default language is changed.
286 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
288 * @param[in] stt The STT handle
289 * @param[in] previous_language A previous language
290 * @param[in] current_language A current language
291 * @param[in] user_data The user data passed from the callback registration function
293 * @see stt_set_default_language_changed_cb()
295 typedef void (*stt_default_language_changed_cb)(stt_h stt, const char* previous_language,
296 const char* current_language, void* user_data);
299 * @brief Called when the engine is changed.
302 * @param[in] stt The STT handle
303 * @param[in] engine_id Engine id
304 * @param[in] language The default language
305 * @param[in] support_silence support silence detection
306 * @param[in] need_credential necessity of credential
307 * @param[in] user_data The user data passed from the callback registration function
309 * @see stt_set_engine_changed_cb()
311 typedef bool (*stt_engine_changed_cb)(stt_h stt, const char* engine_id, const char* language,
312 bool support_silence, bool need_credential, void* user_data);
315 * @brief Creates a STT handle.
316 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
318 * @privilege %http://tizen.org/privilege/recorder
320 * @remarks If the function succeeds, @a stt handle must be released with stt_destroy().
322 * @param[out] stt The STT handle
324 * @return 0 on success, otherwise a negative error value
325 * @retval #STT_ERROR_NONE Successful
326 * @retval #STT_ERROR_OUT_OF_MEMORY Out of memory
327 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
328 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
329 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
331 * @post If this function is called, the STT state will be #STT_STATE_CREATED.
335 int stt_create(stt_h* stt);
338 * @brief Destroys a STT handle.
339 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
341 * @privilege %http://tizen.org/privilege/recorder
343 * @param[in] stt The STT handle
345 * @return 0 on success, otherwise a negative error value
346 * @retval #STT_ERROR_NONE Successful
347 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
348 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
349 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
353 int stt_destroy(stt_h stt);
356 * @brief Retrieves supported engine information using a callback function.
357 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
359 * @privilege %http://tizen.org/privilege/recorder
361 * @param[in] stt The STT handle
362 * @param[in] callback The callback function to invoke
363 * @param[in] user_data The user data to be passed to the callback function
365 * @return 0 on success, otherwise a negative error value
366 * @retval #STT_ERROR_NONE Success
367 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
368 * @retval #STT_ERROR_INVALID_STATE STT Not initialized
369 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
370 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
372 * @pre The state should be #STT_STATE_CREATED.
373 * @post This function invokes stt_supported_engine_cb() repeatedly for getting engine information.
375 * @see stt_supported_engine_cb()
377 int stt_foreach_supported_engines(stt_h stt, stt_supported_engine_cb callback, void* user_data);
380 * @brief Gets the current engine id.
381 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
383 * @privilege %http://tizen.org/privilege/recorder
385 * @remarks If the function is success, @a engine_id must be released using free().
387 * @param[in] stt The STT handle
388 * @param[out] engine_id Engine id
390 * @return 0 on success, otherwise a negative error value
391 * @retval #STT_ERROR_NONE Success
392 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
393 * @retval #STT_ERROR_INVALID_STATE STT Not initialized
394 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
395 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
397 * @pre The state should be #STT_STATE_CREATED.
399 * @see stt_set_engine()
401 int stt_get_engine(stt_h stt, char** engine_id);
404 * @brief Sets the engine id.
405 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
407 * @privilege %http://tizen.org/privilege/recorder
409 * @param[in] stt The STT handle
410 * @param[in] engine_id Engine id
412 * @return 0 on success, otherwise a negative error value
413 * @retval #STT_ERROR_NONE Success
414 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
415 * @retval #STT_ERROR_INVALID_STATE STT Not initialized
416 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
417 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
419 * @pre The state should be #STT_STATE_CREATED.
421 * @see stt_get_engine()
423 int stt_set_engine(stt_h stt, const char* engine_id);
426 * @brief Sets the app credential.
429 * @privilege %http://tizen.org/privilege/recorder
431 * @param[in] stt The STT handle
432 * @param[in] credential The app credential
434 * @return 0 on success, otherwise a negative error value
435 * @retval #STT_ERROR_NONE Success
436 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
437 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
439 * @pre The state should be #STT_STATE_CREATED or #STT_STATE_READY.
444 int stt_set_credential(stt_h stt, const char* credential);
447 * @brief Connects the daemon asynchronously.
448 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
450 * @privilege %http://tizen.org/privilege/recorder
452 * @param[in] stt The STT handle
454 * @return 0 on success, otherwise a negative error value
455 * @retval #STT_ERROR_NONE Successful
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
460 * @pre The state should be #STT_STATE_CREATED.
461 * @post If this function is successful, the STT state will be #STT_STATE_READY. \n
462 * If this function is failed, the error callback is called. (e.g. #STT_ERROR_ENGINE_NOT_FOUND)
464 * @see stt_unprepare()
466 int stt_prepare(stt_h stt);
469 * @brief Disconnects the daemon.
470 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
472 * @privilege %http://tizen.org/privilege/recorder
474 * @param[in] stt The STT handle
476 * @return 0 on success, otherwise a negative error value
477 * @retval #STT_ERROR_NONE Successful
478 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
479 * @retval #STT_ERROR_INVALID_STATE Invalid state
480 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
482 * @pre The state should be #STT_STATE_READY.
483 * @post If this function is called, the STT state will be #STT_STATE_CREATED.
487 int stt_unprepare(stt_h stt);
490 * @brief Retrieves all supported languages of current engine using callback function.
491 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
493 * @privilege %http://tizen.org/privilege/recorder
495 * @param[in] stt The STT handle
496 * @param[in] callback The callback function to invoke
497 * @param[in] user_data The user data to be passed to the callback function
499 * @return 0 on success, otherwise a negative error value
500 * @retval #STT_ERROR_NONE Successful
501 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
502 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
503 * @retval #STT_ERROR_ENGINE_NOT_FOUND No available engine
504 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
506 * @post This function invokes stt_supported_language_cb() repeatedly for getting languages.
508 * @see stt_supported_language_cb()
509 * @see stt_get_default_language()
511 int stt_foreach_supported_languages(stt_h stt, stt_supported_language_cb callback, void* user_data);
514 * @brief Gets the default language set by the user.
515 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
517 * @privilege %http://tizen.org/privilege/recorder
518 * @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
519 * For example, "ko_KR" for Korean, "en_US" for American English. \n
520 * If the function succeeds, @a language must be released using free() when it is no longer required.
522 * @param[in] stt The STT handle
523 * @param[out] language The language
525 * @return 0 on success, otherwise a negative error value
526 * @retval #STT_ERROR_NONE Successful
527 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
528 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
529 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
531 * @see stt_foreach_supported_languages()
533 int stt_get_default_language(stt_h stt, char** language);
536 * @brief Gets the current STT state.
537 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
539 * @privilege %http://tizen.org/privilege/recorder
541 * @param[in] stt The STT handle
542 * @param[out] state The current STT state
544 * @return 0 on success, otherwise a negative error value
545 * @retval #STT_ERROR_NONE Successful
546 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
547 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
552 * @see stt_state_changed_cb()
554 int stt_get_state(stt_h stt, stt_state_e* state);
557 * @brief Gets the current error message.
560 * @privilege %http://tizen.org/privilege/recorder
561 * @remarks This function should be called during an stt error callback. If not, the error as operation failure will be returned. \n
562 * If the function succeeds, @a err_msg must be released using free() when it is no longer required.
564 * @param[in] stt The STT handle
565 * @param[out] err_msg The current error message
567 * @return 0 on success, otherwise a negative error value
568 * @retval #STT_ERROR_NONE Successful
569 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
570 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
571 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
573 * @see stt_set_error_cb()
574 * @see stt_unset_error_cb()
576 int stt_get_error_message(stt_h stt, char** err_msg);
579 * @brief Checks whether the recognition type is supported.
580 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
582 * @privilege %http://tizen.org/privilege/recorder
584 * @param[in] stt The STT handle
585 * @param[in] type The type for recognition (e.g. #STT_RECOGNITION_TYPE_FREE, #STT_RECOGNITION_TYPE_FREE_PARTIAL)
586 * @param[out] support The result status @c true = supported, @c false = not supported
588 * @return 0 on success, otherwise a negative error value
589 * @retval #STT_ERROR_NONE Successful
590 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
591 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
592 * @retval #STT_ERROR_INVALID_STATE Invalid state
593 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
595 * @pre The state should be #STT_STATE_READY.
597 int stt_is_recognition_type_supported(stt_h stt, const char* type, bool* support);
600 * @brief Sets the silence detection.
601 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
603 * @privilege %http://tizen.org/privilege/recorder
605 * @param[in] stt The STT handle
606 * @param[in] type The option type
608 * @return 0 on success, otherwise a negative error value
609 * @retval #STT_ERROR_NONE Successful
610 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
611 * @retval #STT_ERROR_INVALID_STATE Invalid state
612 * @retval #STT_ERROR_NOT_SUPPORTED_FEATURE Not supported feature of current engine
613 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
615 * @pre The state should be #STT_STATE_READY.
617 int stt_set_silence_detection(stt_h stt, stt_option_silence_detection_e type);
620 * @brief Sets the sound to start recording.
621 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
623 * @privilege %http://tizen.org/privilege/recorder
625 * @remarks Sound file type should be wav type.
627 * @param[in] stt The STT handle
628 * @param[in] filename The sound file path
630 * @return 0 on success, otherwise a negative error value
631 * @retval #STT_ERROR_NONE Successful
632 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
633 * @retval #STT_ERROR_INVALID_STATE Invalid state
634 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
635 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
637 * @pre The state should be #STT_STATE_READY.
639 int stt_set_start_sound(stt_h stt, const char* filename);
642 * @brief Unsets the sound to start recording.
643 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
645 * @privilege %http://tizen.org/privilege/recorder
647 * @param[in] stt The STT handle
649 * @return 0 on success, otherwise a negative error value
650 * @retval #STT_ERROR_NONE Successful
651 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
652 * @retval #STT_ERROR_INVALID_STATE Invalid state
653 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
654 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
656 * @pre The state should be #STT_STATE_READY.
658 int stt_unset_start_sound(stt_h stt);
661 * @brief Sets the sound to stop recording.
662 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
664 * @privilege %http://tizen.org/privilege/recorder
666 * @remarks Sound file type should be wav type.
668 * @param[in] stt The STT handle
669 * @param[in] filename The sound file path
671 * @return 0 on success, otherwise a negative error value
672 * @retval #STT_ERROR_NONE Successful
673 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
674 * @retval #STT_ERROR_INVALID_STATE Invalid state
675 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
676 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
678 * @pre The state should be #STT_STATE_READY.
680 int stt_set_stop_sound(stt_h stt, const char* filename);
683 * @brief Unsets the sound to stop recording.
684 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
686 * @privilege %http://tizen.org/privilege/recorder
688 * @param[in] stt The STT handle
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_OPERATION_FAILED Operation failure
695 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
697 * @pre The state should be #STT_STATE_READY.
699 int stt_unset_stop_sound(stt_h stt);
702 * @brief Starts recording and recognition asynchronously.
703 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
705 * @privilege %http://tizen.org/privilege/recorder
707 * @remarks This function starts recording in the daemon and sending recording data to engine. \n
708 * This work continues until stt_stop(), stt_cancel() or silence detected by engine.
710 * @param[in] stt The STT handle
711 * @param[in] language The language selected from stt_foreach_supported_languages()
712 * @param[in] type The type for recognition (e.g. #STT_RECOGNITION_TYPE_FREE, #STT_RECOGNITION_TYPE_FREE_PARTIAL)
714 * @return 0 on success, otherwise a negative error value
715 * @retval #STT_ERROR_NONE Successful
716 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
717 * @retval #STT_ERROR_INVALID_STATE Invalid state
718 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
719 * @retval #STT_ERROR_RECORDER_BUSY Recorder busy
720 * @retval #STT_ERROR_INVALID_LANGUAGE Invalid language
721 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
723 * @pre The state should be #STT_STATE_READY.
724 * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
725 * If this function succeeds, the STT state will be #STT_STATE_RECORDING.
729 * @see stt_state_changed_cb()
731 int stt_start(stt_h stt, const char* language, const char* type);
734 * @brief Finishes the recording and starts recognition processing in engine asynchronously.
735 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
737 * @privilege %http://tizen.org/privilege/recorder
739 * @param[in] stt The STT handle
741 * @return 0 on success, otherwise a negative error value
742 * @retval #STT_ERROR_NONE Successful
743 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
744 * @retval #STT_ERROR_INVALID_STATE Invalid state
745 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
746 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
748 * @pre The state should be #STT_STATE_RECORDING.
749 * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
750 * If this function succeeds, the STT state will be #STT_STATE_PROCESSING. \n
751 * After processing of engine, stt_result_cb() is called.
755 * @see stt_state_changed_cb()
757 int stt_stop(stt_h stt);
760 * @brief Cancels processing recognition and recording asynchronously.
761 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
763 * @privilege %http://tizen.org/privilege/recorder
765 * @remarks This function cancels recording and engine cancels recognition processing. \n
766 * After successful cancel, stt_state_changed_cb() is called otherwise if error is occurred, stt_error_cb() is called.
768 * @param[in] stt The STT handle
770 * @return 0 on success, otherwise a negative error value
771 * @retval #STT_ERROR_NONE Successful
772 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
773 * @retval #STT_ERROR_INVALID_STATE Invalid state
774 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
775 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
777 * @pre The state should be #STT_STATE_RECORDING or #STT_STATE_PROCESSING.
778 * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
779 * If this function succeeds, the STT state will be #STT_STATE_READY.
783 * @see stt_state_changed_cb()
785 int stt_cancel(stt_h stt);
788 * @brief Gets the microphone volume during recording.
789 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
791 * @privilege %http://tizen.org/privilege/recorder
793 * @param[in] stt The STT handle
794 * @param[out] volume Recording volume
796 * @return 0 on success, otherwise a negative error value
797 * @retval #STT_ERROR_NONE Successful
798 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
799 * @retval #STT_ERROR_INVALID_STATE Invalid state
800 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
801 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
803 * @pre The state should be #STT_STATE_RECORDING.
807 int stt_get_recording_volume(stt_h stt, float* volume);
810 * @brief Retrieves the time stamp of the current recognition result using the callback function.
811 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
813 * @privilege %http://tizen.org/privilege/recorder
815 * @remarks This function should be called in stt_recognition_result_cb().
816 * After stt_recognition_result_cb(), result data is NOT valid.
818 * @param[in] stt The STT handle
819 * @param[in] callback The callback function to invoke
820 * @param[in] user_data The user data to be passed to the callback function
822 * @return 0 on success, otherwise a negative error value
823 * @retval #STT_ERROR_NONE Successful
824 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
825 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
826 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
828 * @pre This function should be called in stt_recognition_result_cb().
829 * @post This function invokes stt_result_time_cb() repeatedly for getting time information.
831 * @see stt_result_time_cb()
832 * @see stt_recognition_result_cb()
834 int stt_foreach_detailed_result(stt_h stt, stt_result_time_cb callback, void* user_data);
837 * @brief Registers a callback function to get the recognition result.
838 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
840 * @privilege %http://tizen.org/privilege/recorder
842 * @param[in] stt The STT handle
843 * @param[in] callback The callback function to register
844 * @param[in] user_data The user data to be passed to the callback function
846 * @return 0 on success, otherwise a negative error value
847 * @retval #STT_ERROR_NONE Successful
848 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
849 * @retval #STT_ERROR_INVALID_STATE Invalid state
850 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
852 * @pre The state should be #STT_STATE_CREATED.
854 * @see stt_recognition_result_cb()
855 * @see stt_unset_recognition_result_cb()
857 int stt_set_recognition_result_cb(stt_h stt, stt_recognition_result_cb callback, void* user_data);
860 * @brief Unregisters the callback function.
861 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
863 * @privilege %http://tizen.org/privilege/recorder
865 * @param[in] stt The STT handle
867 * @return 0 on success, otherwise a negative error value
868 * @retval #STT_ERROR_NONE Successful
869 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
870 * @retval #STT_ERROR_INVALID_STATE Invalid state
871 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
873 * @pre The state should be #STT_STATE_CREATED.
875 * @see stt_set_recognition_result_cb()
877 int stt_unset_recognition_result_cb(stt_h stt);
880 * @brief Registers a callback function to be called when STT state changes.
881 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
883 * @privilege %http://tizen.org/privilege/recorder
885 * @param[in] stt The STT handle
886 * @param[in] callback The callback function to register
887 * @param[in] user_data The user data to be passed to the callback function
889 * @return 0 on success, otherwise a negative error value
890 * @retval #STT_ERROR_NONE Successful
891 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
892 * @retval #STT_ERROR_INVALID_STATE Invalid state
893 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
895 * @pre The state should be #STT_STATE_CREATED.
897 * @see stt_state_changed_cb()
898 * @see stt_unset_state_changed_cb()
900 int stt_set_state_changed_cb(stt_h stt, stt_state_changed_cb callback, void* user_data);
903 * @brief Unregisters the callback function.
904 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
906 * @privilege %http://tizen.org/privilege/recorder
908 * @param[in] stt The STT handle
910 * @return 0 on success, otherwise a negative error value
911 * @retval #STT_ERROR_NONE Successful
912 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
913 * @retval #STT_ERROR_INVALID_STATE Invalid state
914 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
916 * @pre The state should be #STT_STATE_CREATED.
918 * @see stt_set_state_changed_cb()
920 int stt_unset_state_changed_cb(stt_h stt);
923 * @brief Registers a callback function to be called when an error occurred.
924 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
926 * @privilege %http://tizen.org/privilege/recorder
928 * @param[in] stt The STT handle
929 * @param[in] callback The callback function to register
930 * @param[in] user_data The user data to be passed to the callback function
932 * @return 0 on success, otherwise a negative error value
933 * @retval #STT_ERROR_NONE Successful
934 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
935 * @retval #STT_ERROR_INVALID_STATE Invalid state
936 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
938 * @pre The state should be #STT_STATE_CREATED.
940 * @see stt_error_cb()
941 * @see stt_unset_error_cb()
943 int stt_set_error_cb(stt_h stt, stt_error_cb callback, void* user_data);
946 * @brief Unregisters the callback function.
947 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
949 * @privilege %http://tizen.org/privilege/recorder
951 * @param[in] stt The STT handle
953 * @return 0 on success, otherwise a negative error value
954 * @retval #STT_ERROR_NONE Successful
955 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
956 * @retval #STT_ERROR_INVALID_STATE Invalid state
957 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
959 * @pre The state should be #STT_STATE_CREATED.
961 * @see stt_set_error_cb()
963 int stt_unset_error_cb(stt_h stt);
966 * @brief Registers a callback function to detect the default language change.
967 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
969 * @privilege %http://tizen.org/privilege/recorder
971 * @param[in] stt The STT handle
972 * @param[in] callback The callback function to register
973 * @param[in] user_data The user data to be passed to the callback function
975 * @return 0 on success, otherwise a negative error value
976 * @retval #STT_ERROR_NONE Successful
977 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
978 * @retval #STT_ERROR_INVALID_STATE Invalid state
979 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
981 * @pre The state should be #STT_STATE_CREATED.
983 * @see stt_default_language_changed_cb()
984 * @see stt_unset_default_language_changed_cb()
986 int stt_set_default_language_changed_cb(stt_h stt, stt_default_language_changed_cb callback, void* user_data);
989 * @brief Unregisters the callback function.
990 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
992 * @privilege %http://tizen.org/privilege/recorder
994 * @param[in] stt The STT handle
996 * @return 0 on success, otherwise a negative error value
997 * @retval #STT_ERROR_NONE Successful
998 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
999 * @retval #STT_ERROR_INVALID_STATE Invalid state
1000 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
1002 * @pre The state should be #STT_STATE_CREATED.
1004 * @see stt_set_default_language_changed_cb()
1006 int stt_unset_default_language_changed_cb(stt_h stt);
1016 #endif /* __STT_H__ */