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 */
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 Checks whether the recognition type is supported.
521 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
523 * @privilege %http://tizen.org/privilege/recorder
525 * @param[in] stt The STT handle
526 * @param[in] type The type for recognition (e.g. #STT_RECOGNITION_TYPE_FREE, #STT_RECOGNITION_TYPE_FREE_PARTIAL)
527 * @param[out] support The result status @c true = supported, @c false = not supported
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_OPERATION_FAILED Operation failure
533 * @retval #STT_ERROR_INVALID_STATE Invalid state
534 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
536 * @pre The state should be #STT_STATE_READY.
538 int stt_is_recognition_type_supported(stt_h stt, const char* type, bool* support);
541 * @brief Sets the silence detection.
542 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
544 * @privilege %http://tizen.org/privilege/recorder
546 * @param[in] stt The STT handle
547 * @param[in] type The option type
549 * @return 0 on success, otherwise a negative error value
550 * @retval #STT_ERROR_NONE Successful
551 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
552 * @retval #STT_ERROR_INVALID_STATE Invalid state
553 * @retval #STT_ERROR_NOT_SUPPORTED_FEATURE Not supported feature of current engine
554 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
556 * @pre The state should be #STT_STATE_READY.
558 int stt_set_silence_detection(stt_h stt, stt_option_silence_detection_e type);
561 * @brief Sets the sound to start recording.
562 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
564 * @privilege %http://tizen.org/privilege/recorder
566 * @remarks Sound file type should be wav type.
568 * @param[in] stt The STT handle
569 * @param[in] filename The sound file path
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_OPERATION_FAILED Operation failure
576 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
578 * @pre The state should be #STT_STATE_READY.
580 int stt_set_start_sound(stt_h stt, const char* filename);
583 * @brief Unsets 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 * @param[in] stt The STT handle
590 * @return 0 on success, otherwise a negative error value
591 * @retval #STT_ERROR_NONE Successful
592 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
593 * @retval #STT_ERROR_INVALID_STATE Invalid state
594 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
595 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
597 * @pre The state should be #STT_STATE_READY.
599 int stt_unset_start_sound(stt_h stt);
602 * @brief Sets the sound to stop recording.
603 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
605 * @privilege %http://tizen.org/privilege/recorder
607 * @remarks Sound file type should be wav type.
609 * @param[in] stt The STT handle
610 * @param[in] filename The sound file path
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_set_stop_sound(stt_h stt, const char* filename);
624 * @brief Unsets 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 * @param[in] stt The STT handle
631 * @return 0 on success, otherwise a negative error value
632 * @retval #STT_ERROR_NONE Successful
633 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
634 * @retval #STT_ERROR_INVALID_STATE Invalid state
635 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
636 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
638 * @pre The state should be #STT_STATE_READY.
640 int stt_unset_stop_sound(stt_h stt);
643 * @brief Starts recording and recognition asynchronously.
644 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
646 * @privilege %http://tizen.org/privilege/recorder
648 * @remarks This function starts recording in the daemon and sending recording data to engine. \n
649 * This work continues until stt_stop(), stt_cancel() or silence detected by engine.
651 * @param[in] stt The STT handle
652 * @param[in] language The language selected from stt_foreach_supported_languages()
653 * @param[in] type The type for recognition (e.g. #STT_RECOGNITION_TYPE_FREE, #STT_RECOGNITION_TYPE_FREE_PARTIAL)
655 * @return 0 on success, otherwise a negative error value
656 * @retval #STT_ERROR_NONE Successful
657 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
658 * @retval #STT_ERROR_INVALID_STATE Invalid state
659 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
660 * @retval #STT_ERROR_RECORDER_BUSY Recorder busy
661 * @retval #STT_ERROR_INVALID_LANGUAGE Invalid language
662 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
664 * @pre The state should be #STT_STATE_READY.
665 * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
666 * If this function succeeds, the STT state will be #STT_STATE_RECORDING.
670 * @see stt_state_changed_cb()
672 int stt_start(stt_h stt, const char* language, const char* type);
675 * @brief Finishes the recording and starts recognition processing in engine asynchronously.
676 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
678 * @privilege %http://tizen.org/privilege/recorder
680 * @param[in] stt The STT handle
682 * @return 0 on success, otherwise a negative error value
683 * @retval #STT_ERROR_NONE Successful
684 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
685 * @retval #STT_ERROR_INVALID_STATE Invalid state
686 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
687 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
689 * @pre The state should be #STT_STATE_RECORDING.
690 * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
691 * If this function succeeds, the STT state will be #STT_STATE_PROCESSING. \n
692 * After processing of engine, stt_result_cb() is called.
696 * @see stt_state_changed_cb()
698 int stt_stop(stt_h stt);
701 * @brief Cancels processing recognition and recording asynchronously.
702 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
704 * @privilege %http://tizen.org/privilege/recorder
706 * @remarks This function cancels recording and engine cancels recognition processing. \n
707 * After successful cancel, stt_state_changed_cb() is called otherwise if error is occurred, stt_error_cb() is called.
709 * @param[in] stt The STT handle
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
718 * @pre The state should be #STT_STATE_RECORDING or #STT_STATE_PROCESSING.
719 * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
720 * If this function succeeds, the STT state will be #STT_STATE_READY.
724 * @see stt_state_changed_cb()
726 int stt_cancel(stt_h stt);
729 * @brief Gets the microphone volume during recording.
730 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
732 * @privilege %http://tizen.org/privilege/recorder
734 * @param[in] stt The STT handle
735 * @param[out] volume Recording volume
737 * @return 0 on success, otherwise a negative error value
738 * @retval #STT_ERROR_NONE Successful
739 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
740 * @retval #STT_ERROR_INVALID_STATE Invalid state
741 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
742 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
744 * @pre The state should be #STT_STATE_RECORDING.
748 int stt_get_recording_volume(stt_h stt, float* volume);
751 * @brief Retrieves the time stamp of the current recognition result using the callback function.
752 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
754 * @privilege %http://tizen.org/privilege/recorder
756 * @remarks This function should be called in stt_recognition_result_cb().
757 * After stt_recognition_result_cb(), result data is NOT valid.
759 * @param[in] stt The STT handle
760 * @param[in] callback The callback function to invoke
761 * @param[in] user_data The user data to be passed to the callback function
763 * @return 0 on success, otherwise a negative error value
764 * @retval #STT_ERROR_NONE Successful
765 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
766 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
767 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
769 * @pre This function should be called in stt_recognition_result_cb().
770 * @post This function invokes stt_result_time_cb() repeatedly for getting time information.
772 * @see stt_result_time_cb()
773 * @see stt_recognition_result_cb()
775 int stt_foreach_detailed_result(stt_h stt, stt_result_time_cb callback, void* user_data);
778 * @brief Registers a callback function to get the recognition result.
779 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
781 * @privilege %http://tizen.org/privilege/recorder
783 * @param[in] stt The STT handle
784 * @param[in] callback The callback function to register
785 * @param[in] user_data The user data to be passed to the callback function
787 * @return 0 on success, otherwise a negative error value
788 * @retval #STT_ERROR_NONE Successful
789 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
790 * @retval #STT_ERROR_INVALID_STATE Invalid state
791 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
793 * @pre The state should be #STT_STATE_CREATED.
795 * @see stt_recognition_result_cb()
796 * @see stt_unset_recognition_result_cb()
798 int stt_set_recognition_result_cb(stt_h stt, stt_recognition_result_cb callback, void* user_data);
801 * @brief Unregisters the callback function.
802 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
804 * @privilege %http://tizen.org/privilege/recorder
806 * @param[in] stt The STT handle
808 * @return 0 on success, otherwise a negative error value
809 * @retval #STT_ERROR_NONE Successful
810 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
811 * @retval #STT_ERROR_INVALID_STATE Invalid state
812 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
814 * @pre The state should be #STT_STATE_CREATED.
816 * @see stt_set_recognition_result_cb()
818 int stt_unset_recognition_result_cb(stt_h stt);
821 * @brief Registers a callback function to be called when STT state changes.
822 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
824 * @privilege %http://tizen.org/privilege/recorder
826 * @param[in] stt The STT handle
827 * @param[in] callback The callback function to register
828 * @param[in] user_data The user data to be passed to the callback function
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_state_changed_cb()
839 * @see stt_unset_state_changed_cb()
841 int stt_set_state_changed_cb(stt_h stt, stt_state_changed_cb callback, void* user_data);
844 * @brief Unregisters the callback function.
845 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
847 * @privilege %http://tizen.org/privilege/recorder
849 * @param[in] stt The STT handle
851 * @return 0 on success, otherwise a negative error value
852 * @retval #STT_ERROR_NONE Successful
853 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
854 * @retval #STT_ERROR_INVALID_STATE Invalid state
855 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
857 * @pre The state should be #STT_STATE_CREATED.
859 * @see stt_set_state_changed_cb()
861 int stt_unset_state_changed_cb(stt_h stt);
864 * @brief Registers a callback function to be called when an error occurred.
865 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
867 * @privilege %http://tizen.org/privilege/recorder
869 * @param[in] stt The STT handle
870 * @param[in] callback The callback function to register
871 * @param[in] user_data The user data to be passed to the callback function
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_error_cb()
882 * @see stt_unset_error_cb()
884 int stt_set_error_cb(stt_h stt, stt_error_cb callback, void* user_data);
887 * @brief Unregisters the callback function.
888 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
890 * @privilege %http://tizen.org/privilege/recorder
892 * @param[in] stt The STT handle
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_NOT_SUPPORTED STT NOT supported
900 * @pre The state should be #STT_STATE_CREATED.
902 * @see stt_set_error_cb()
904 int stt_unset_error_cb(stt_h stt);
907 * @brief Registers a callback function to detect the default language change.
908 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
910 * @privilege %http://tizen.org/privilege/recorder
912 * @param[in] stt The STT handle
913 * @param[in] callback The callback function to register
914 * @param[in] user_data The user data to be passed to the callback function
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_default_language_changed_cb()
925 * @see stt_unset_default_language_changed_cb()
927 int stt_set_default_language_changed_cb(stt_h stt, stt_default_language_changed_cb callback, void* user_data);
930 * @brief Unregisters the callback function.
931 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
933 * @privilege %http://tizen.org/privilege/recorder
935 * @param[in] stt The STT handle
937 * @return 0 on success, otherwise a negative error value
938 * @retval #STT_ERROR_NONE Successful
939 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
940 * @retval #STT_ERROR_INVALID_STATE Invalid state
941 * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
943 * @pre The state should be #STT_STATE_CREATED.
945 * @see stt_set_default_language_changed_cb()
947 int stt_unset_default_language_changed_cb(stt_h stt);
957 #endif /* __STT_H__ */