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 Creates a STT handle.
300 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
302 * @privilege %http://tizen.org/privilege/recorder
304 * @remarks If the function succeeds, @a stt handle must be released with stt_destroy().
306 * @param[out] stt The STT handle
308 * @return 0 on success, otherwise a negative error value
309 * @retval #STT_ERROR_NONE Successful
310 * @retval #STT_ERROR_OUT_OF_MEMORY Out of memory
311 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
312 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
313 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
315 * @post If this function is called, the STT state will be #STT_STATE_CREATED.
319 int stt_create(stt_h* stt);
322 * @brief Destroys a STT handle.
323 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
325 * @privilege %http://tizen.org/privilege/recorder
327 * @param[in] stt The STT handle
329 * @return 0 on success, otherwise a negative error value
330 * @retval #STT_ERROR_NONE Successful
331 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
332 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
333 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
337 int stt_destroy(stt_h stt);
340 * @brief Retrieves supported engine information using a callback function.
341 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
343 * @privilege %http://tizen.org/privilege/recorder
345 * @param[in] stt The STT handle
346 * @param[in] callback The callback function to invoke
347 * @param[in] user_data The user data to be passed to the callback function
349 * @return 0 on success, otherwise a negative error value
350 * @retval #STT_ERROR_NONE Success
351 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
352 * @retval #STT_ERROR_INVALID_STATE STT Not initialized
353 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
354 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
356 * @pre The state should be #STT_STATE_CREATED.
357 * @post This function invokes stt_supported_engine_cb() repeatedly for getting engine information.
359 * @see stt_supported_engine_cb()
361 int stt_foreach_supported_engines(stt_h stt, stt_supported_engine_cb callback, void* user_data);
364 * @brief Gets the current engine id.
365 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
367 * @privilege %http://tizen.org/privilege/recorder
369 * @remarks If the function is success, @a engine_id must be released using free().
371 * @param[in] stt The STT handle
372 * @param[out] engine_id Engine id
374 * @return 0 on success, otherwise a negative error value
375 * @retval #STT_ERROR_NONE Success
376 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
377 * @retval #STT_ERROR_INVALID_STATE STT Not initialized
378 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
379 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
381 * @pre The state should be #STT_STATE_CREATED.
383 * @see stt_set_engine()
385 int stt_get_engine(stt_h stt, char** engine_id);
388 * @brief Sets the engine id.
389 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
391 * @privilege %http://tizen.org/privilege/recorder
393 * @param[in] stt The STT handle
394 * @param[in] engine_id Engine id
396 * @return 0 on success, otherwise a negative error value
397 * @retval #STT_ERROR_NONE Success
398 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
399 * @retval #STT_ERROR_INVALID_STATE STT Not initialized
400 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
401 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
403 * @pre The state should be #STT_STATE_CREATED.
405 * @see stt_get_engine()
407 int stt_set_engine(stt_h stt, const char* engine_id);
410 * @brief Connects the daemon asynchronously.
411 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
413 * @privilege %http://tizen.org/privilege/recorder
415 * @param[in] stt The STT handle
417 * @return 0 on success, otherwise a negative error value
418 * @retval #STT_ERROR_NONE Successful
419 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
420 * @retval #STT_ERROR_INVALID_STATE Invalid state
421 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
423 * @pre The state should be #STT_STATE_CREATED.
424 * @post If this function is successful, the STT state will be #STT_STATE_READY. \n
425 * If this function is failed, the error callback is called. (e.g. #STT_ERROR_ENGINE_NOT_FOUND)
427 * @see stt_unprepare()
429 int stt_prepare(stt_h stt);
432 * @brief Disconnects the daemon.
433 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
435 * @privilege %http://tizen.org/privilege/recorder
437 * @param[in] stt The STT handle
439 * @return 0 on success, otherwise a negative error value
440 * @retval #STT_ERROR_NONE Successful
441 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
442 * @retval #STT_ERROR_INVALID_STATE Invalid state
443 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
445 * @pre The state should be #STT_STATE_READY.
446 * @post If this function is called, the STT state will be #STT_STATE_CREATED.
450 int stt_unprepare(stt_h stt);
453 * @brief Retrieves all supported languages of current engine using callback function.
454 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
456 * @privilege %http://tizen.org/privilege/recorder
458 * @param[in] stt The STT handle
459 * @param[in] callback The callback function to invoke
460 * @param[in] user_data The user data to be passed to the callback function
462 * @return 0 on success, otherwise a negative error value
463 * @retval #STT_ERROR_NONE Successful
464 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
465 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
466 * @retval #STT_ERROR_ENGINE_NOT_FOUND No available engine
467 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
469 * @post This function invokes stt_supported_language_cb() repeatedly for getting languages.
471 * @see stt_supported_language_cb()
472 * @see stt_get_default_language()
474 int stt_foreach_supported_languages(stt_h stt, stt_supported_language_cb callback, void* user_data);
477 * @brief Gets the default language set by the user.
478 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
480 * @privilege %http://tizen.org/privilege/recorder
481 * @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
482 * For example, "ko_KR" for Korean, "en_US" for American English. \n
483 * If the function succeeds, @a language must be released using free() when it is no longer required.
485 * @param[in] stt The STT handle
486 * @param[out] language The language
488 * @return 0 on success, otherwise a negative error value
489 * @retval #STT_ERROR_NONE Successful
490 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
491 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
492 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
494 * @see stt_foreach_supported_languages()
496 int stt_get_default_language(stt_h stt, char** language);
499 * @brief Gets the current STT state.
500 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
502 * @privilege %http://tizen.org/privilege/recorder
504 * @param[in] stt The STT handle
505 * @param[out] state The current STT state
507 * @return 0 on success, otherwise a negative error value
508 * @retval #STT_ERROR_NONE Successful
509 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
510 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
515 * @see stt_state_changed_cb()
517 int stt_get_state(stt_h stt, stt_state_e* state);
520 * @brief Gets the current error message.
523 * @privilege %http://tizen.org/privilege/recorder
524 * @remarks This function should be called during an stt error callback. If not, the error as operation failure will be returned. \n
525 * If the function succeeds, @a err_msg must be released using free() when it is no longer required.
527 * @param[in] stt The STT handle
528 * @param[out] err_msg The current error message
530 * @return 0 on success, otherwise a negative error value
531 * @retval #STT_ERROR_NONE Successful
532 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
533 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
534 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
536 * @see stt_set_error_cb()
537 * @see stt_unset_error_cb()
539 int stt_get_error_message(stt_h stt, char** err_msg);
542 * @brief Checks whether the recognition type is supported.
543 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
545 * @privilege %http://tizen.org/privilege/recorder
547 * @param[in] stt The STT handle
548 * @param[in] type The type for recognition (e.g. #STT_RECOGNITION_TYPE_FREE, #STT_RECOGNITION_TYPE_FREE_PARTIAL)
549 * @param[out] support The result status @c true = supported, @c false = not supported
551 * @return 0 on success, otherwise a negative error value
552 * @retval #STT_ERROR_NONE Successful
553 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
554 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
555 * @retval #STT_ERROR_INVALID_STATE Invalid state
556 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
558 * @pre The state should be #STT_STATE_READY.
560 int stt_is_recognition_type_supported(stt_h stt, const char* type, bool* support);
563 * @brief Sets the silence detection.
564 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
566 * @privilege %http://tizen.org/privilege/recorder
568 * @param[in] stt The STT handle
569 * @param[in] type The option type
571 * @return 0 on success, otherwise a negative error value
572 * @retval #STT_ERROR_NONE Successful
573 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
574 * @retval #STT_ERROR_INVALID_STATE Invalid state
575 * @retval #STT_ERROR_NOT_SUPPORTED_FEATURE Not supported feature of current engine
576 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
578 * @pre The state should be #STT_STATE_READY.
580 int stt_set_silence_detection(stt_h stt, stt_option_silence_detection_e type);
583 * @brief Sets the sound to start recording.
584 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
586 * @privilege %http://tizen.org/privilege/recorder
588 * @remarks Sound file type should be wav type.
590 * @param[in] stt The STT handle
591 * @param[in] filename The sound file path
593 * @return 0 on success, otherwise a negative error value
594 * @retval #STT_ERROR_NONE Successful
595 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
596 * @retval #STT_ERROR_INVALID_STATE Invalid state
597 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
598 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
600 * @pre The state should be #STT_STATE_READY.
602 int stt_set_start_sound(stt_h stt, const char* filename);
605 * @brief Unsets the sound to start recording.
606 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
608 * @privilege %http://tizen.org/privilege/recorder
610 * @param[in] stt The STT handle
612 * @return 0 on success, otherwise a negative error value
613 * @retval #STT_ERROR_NONE Successful
614 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
615 * @retval #STT_ERROR_INVALID_STATE Invalid state
616 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
617 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
619 * @pre The state should be #STT_STATE_READY.
621 int stt_unset_start_sound(stt_h stt);
624 * @brief Sets the sound to stop recording.
625 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
627 * @privilege %http://tizen.org/privilege/recorder
629 * @remarks Sound file type should be wav type.
631 * @param[in] stt The STT handle
632 * @param[in] filename The sound file path
634 * @return 0 on success, otherwise a negative error value
635 * @retval #STT_ERROR_NONE Successful
636 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
637 * @retval #STT_ERROR_INVALID_STATE Invalid state
638 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
639 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
641 * @pre The state should be #STT_STATE_READY.
643 int stt_set_stop_sound(stt_h stt, const char* filename);
646 * @brief Unsets the sound to stop recording.
647 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
649 * @privilege %http://tizen.org/privilege/recorder
651 * @param[in] stt The STT handle
653 * @return 0 on success, otherwise a negative error value
654 * @retval #STT_ERROR_NONE Successful
655 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
656 * @retval #STT_ERROR_INVALID_STATE Invalid state
657 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
658 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
660 * @pre The state should be #STT_STATE_READY.
662 int stt_unset_stop_sound(stt_h stt);
665 * @brief Starts recording and recognition asynchronously.
666 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
668 * @privilege %http://tizen.org/privilege/recorder
670 * @remarks This function starts recording in the daemon and sending recording data to engine. \n
671 * This work continues until stt_stop(), stt_cancel() or silence detected by engine.
673 * @param[in] stt The STT handle
674 * @param[in] language The language selected from stt_foreach_supported_languages()
675 * @param[in] type The type for recognition (e.g. #STT_RECOGNITION_TYPE_FREE, #STT_RECOGNITION_TYPE_FREE_PARTIAL)
677 * @return 0 on success, otherwise a negative error value
678 * @retval #STT_ERROR_NONE Successful
679 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
680 * @retval #STT_ERROR_INVALID_STATE Invalid state
681 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
682 * @retval #STT_ERROR_RECORDER_BUSY Recorder busy
683 * @retval #STT_ERROR_INVALID_LANGUAGE Invalid language
684 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
686 * @pre The state should be #STT_STATE_READY.
687 * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
688 * If this function succeeds, the STT state will be #STT_STATE_RECORDING.
692 * @see stt_state_changed_cb()
694 int stt_start(stt_h stt, const char* language, const char* type);
697 * @brief Finishes the recording and starts recognition processing in engine asynchronously.
698 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
700 * @privilege %http://tizen.org/privilege/recorder
702 * @param[in] stt The STT handle
704 * @return 0 on success, otherwise a negative error value
705 * @retval #STT_ERROR_NONE Successful
706 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
707 * @retval #STT_ERROR_INVALID_STATE Invalid state
708 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
709 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
711 * @pre The state should be #STT_STATE_RECORDING.
712 * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
713 * If this function succeeds, the STT state will be #STT_STATE_PROCESSING. \n
714 * After processing of engine, stt_result_cb() is called.
718 * @see stt_state_changed_cb()
720 int stt_stop(stt_h stt);
723 * @brief Cancels processing recognition and recording asynchronously.
724 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
726 * @privilege %http://tizen.org/privilege/recorder
728 * @remarks This function cancels recording and engine cancels recognition processing. \n
729 * After successful cancel, stt_state_changed_cb() is called otherwise if error is occurred, stt_error_cb() is called.
731 * @param[in] stt The STT handle
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
740 * @pre The state should be #STT_STATE_RECORDING or #STT_STATE_PROCESSING.
741 * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
742 * If this function succeeds, the STT state will be #STT_STATE_READY.
746 * @see stt_state_changed_cb()
748 int stt_cancel(stt_h stt);
751 * @brief Gets the microphone volume during recording.
752 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
754 * @privilege %http://tizen.org/privilege/recorder
756 * @param[in] stt The STT handle
757 * @param[out] volume Recording volume
759 * @return 0 on success, otherwise a negative error value
760 * @retval #STT_ERROR_NONE Successful
761 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
762 * @retval #STT_ERROR_INVALID_STATE Invalid state
763 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
764 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
766 * @pre The state should be #STT_STATE_RECORDING.
770 int stt_get_recording_volume(stt_h stt, float* volume);
773 * @brief Retrieves the time stamp of the current recognition result using the callback function.
774 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
776 * @privilege %http://tizen.org/privilege/recorder
778 * @remarks This function should be called in stt_recognition_result_cb().
779 * After stt_recognition_result_cb(), result data is NOT valid.
781 * @param[in] stt The STT handle
782 * @param[in] callback The callback function to invoke
783 * @param[in] user_data The user data to be passed to the callback function
785 * @return 0 on success, otherwise a negative error value
786 * @retval #STT_ERROR_NONE Successful
787 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
788 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
789 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
791 * @pre This function should be called in stt_recognition_result_cb().
792 * @post This function invokes stt_result_time_cb() repeatedly for getting time information.
794 * @see stt_result_time_cb()
795 * @see stt_recognition_result_cb()
797 int stt_foreach_detailed_result(stt_h stt, stt_result_time_cb callback, void* user_data);
800 * @brief Registers a callback function to get the recognition result.
801 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
803 * @privilege %http://tizen.org/privilege/recorder
805 * @param[in] stt The STT handle
806 * @param[in] callback The callback function to register
807 * @param[in] user_data The user data to be passed to the callback function
809 * @return 0 on success, otherwise a negative error value
810 * @retval #STT_ERROR_NONE Successful
811 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
812 * @retval #STT_ERROR_INVALID_STATE Invalid state
813 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
815 * @pre The state should be #STT_STATE_CREATED.
817 * @see stt_recognition_result_cb()
818 * @see stt_unset_recognition_result_cb()
820 int stt_set_recognition_result_cb(stt_h stt, stt_recognition_result_cb callback, void* user_data);
823 * @brief Unregisters the callback function.
824 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
826 * @privilege %http://tizen.org/privilege/recorder
828 * @param[in] stt The STT handle
830 * @return 0 on success, otherwise a negative error value
831 * @retval #STT_ERROR_NONE Successful
832 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
833 * @retval #STT_ERROR_INVALID_STATE Invalid state
834 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
836 * @pre The state should be #STT_STATE_CREATED.
838 * @see stt_set_recognition_result_cb()
840 int stt_unset_recognition_result_cb(stt_h stt);
843 * @brief Registers a callback function to be called when STT state changes.
844 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
846 * @privilege %http://tizen.org/privilege/recorder
848 * @param[in] stt The STT handle
849 * @param[in] callback The callback function to register
850 * @param[in] user_data The user data to be passed to the callback function
852 * @return 0 on success, otherwise a negative error value
853 * @retval #STT_ERROR_NONE Successful
854 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
855 * @retval #STT_ERROR_INVALID_STATE Invalid state
856 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
858 * @pre The state should be #STT_STATE_CREATED.
860 * @see stt_state_changed_cb()
861 * @see stt_unset_state_changed_cb()
863 int stt_set_state_changed_cb(stt_h stt, stt_state_changed_cb callback, void* user_data);
866 * @brief Unregisters the callback function.
867 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
869 * @privilege %http://tizen.org/privilege/recorder
871 * @param[in] stt The STT handle
873 * @return 0 on success, otherwise a negative error value
874 * @retval #STT_ERROR_NONE Successful
875 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
876 * @retval #STT_ERROR_INVALID_STATE Invalid state
877 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
879 * @pre The state should be #STT_STATE_CREATED.
881 * @see stt_set_state_changed_cb()
883 int stt_unset_state_changed_cb(stt_h stt);
886 * @brief Registers a callback function to be called when an error occurred.
887 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
889 * @privilege %http://tizen.org/privilege/recorder
891 * @param[in] stt The STT handle
892 * @param[in] callback The callback function to register
893 * @param[in] user_data The user data to be passed to the callback function
895 * @return 0 on success, otherwise a negative error value
896 * @retval #STT_ERROR_NONE Successful
897 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
898 * @retval #STT_ERROR_INVALID_STATE Invalid state
899 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
901 * @pre The state should be #STT_STATE_CREATED.
903 * @see stt_error_cb()
904 * @see stt_unset_error_cb()
906 int stt_set_error_cb(stt_h stt, stt_error_cb callback, void* user_data);
909 * @brief Unregisters the callback function.
910 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
912 * @privilege %http://tizen.org/privilege/recorder
914 * @param[in] stt The STT handle
916 * @return 0 on success, otherwise a negative error value
917 * @retval #STT_ERROR_NONE Successful
918 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
919 * @retval #STT_ERROR_INVALID_STATE Invalid state
920 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
922 * @pre The state should be #STT_STATE_CREATED.
924 * @see stt_set_error_cb()
926 int stt_unset_error_cb(stt_h stt);
929 * @brief Registers a callback function to detect the default language change.
930 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
932 * @privilege %http://tizen.org/privilege/recorder
934 * @param[in] stt The STT handle
935 * @param[in] callback The callback function to register
936 * @param[in] user_data The user data to be passed to the callback function
938 * @return 0 on success, otherwise a negative error value
939 * @retval #STT_ERROR_NONE Successful
940 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
941 * @retval #STT_ERROR_INVALID_STATE Invalid state
942 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
944 * @pre The state should be #STT_STATE_CREATED.
946 * @see stt_default_language_changed_cb()
947 * @see stt_unset_default_language_changed_cb()
949 int stt_set_default_language_changed_cb(stt_h stt, stt_default_language_changed_cb callback, void* user_data);
952 * @brief Unregisters the callback function.
953 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
955 * @privilege %http://tizen.org/privilege/recorder
957 * @param[in] stt The STT handle
959 * @return 0 on success, otherwise a negative error value
960 * @retval #STT_ERROR_NONE Successful
961 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
962 * @retval #STT_ERROR_INVALID_STATE Invalid state
963 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
965 * @pre The state should be #STT_STATE_CREATED.
967 * @see stt_set_default_language_changed_cb()
969 int stt_unset_default_language_changed_cb(stt_h stt);
979 #endif /* __STT_H__ */