2 * Copyright (c) 2011-2015 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.
18 #ifndef __VOICE_CONTROL_MANAGER_H__
19 #define __VOICE_CONTROL_MANAGER_H__
21 #include <voice_control_command.h>
22 #include <voice_control_command_expand.h>
23 #include <voice_control_common.h>
26 * @addtogroup VOICE_CONTROL_MANAGER
37 * @brief Definition of audio-in type.
39 #define VC_AUDIO_TYPE_BLUETOOTH "VC_AUDIO_ID_BLUETOOTH" /**< Bluetooth audio type */
42 * @brief Definition of audio-in type.
44 #define VC_AUDIO_TYPE_MSF "VC_AUDIO_ID_MSF" /**< MSF (wifi) audio type */
47 * @brief Definition for foreground command type.
48 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
50 #define VC_COMMAND_TYPE_FOREGROUND 1
53 * @brief Definition for background command type.
54 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
56 #define VC_COMMAND_TYPE_BACKGROUND 2
59 * @brief Definition for widget command type.
60 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
62 #define VC_COMMAND_TYPE_WIDGET 3
65 * @brief Definition for system command type.
66 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
68 #define VC_COMMAND_TYPE_SYSTEM 4
71 * @brief Definition for exclusive command type.
72 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
74 #define VC_COMMAND_TYPE_SYSTEM_BACKGROUND 5
77 * @brief Definitions for exclusive command type.
80 #define VC_COMMAND_TYPE_EXCLUSIVE 6
83 * @brief Definition for none message.
85 #define VC_RESULT_MESSAGE_NONE "vc.result.message.none"
88 * @brief Definition for failed recognition because the speech is too loud to listen.
90 #define VC_RESULT_MESSAGE_ERROR_TOO_LOUD "vc.result.message.error.too.loud"
93 * @brief Enumerations of recognition mode.
96 VC_RECOGNITION_MODE_STOP_BY_SILENCE, /**< Default mode */
97 VC_RECOGNITION_MODE_RESTART_AFTER_REJECT, /**< Restart recognition after rejected result */
98 VC_RECOGNITION_MODE_RESTART_CONTINUOUSLY, /**< Continuously restart recognition - not support yet*/
99 VC_RECOGNITION_MODE_MANUAL /**< Start and stop manually without silence */
100 } vc_recognition_mode_e;
103 * @brief Enumerations of send event type.
106 VC_SEND_EVENT_TYPE_TEXT, /**< send text event to vc engine*/
107 VC_SEND_EVENT_TYPE_LIST_EVENT, /**< send list event to vc engine */
108 VC_SEND_EVENT_TYPE_HAPTIC_EVENT /**< send haptic event to vc engine */
109 } vc_send_event_type_e;
112 * @brief Enumerations of pre result event.
115 VC_PRE_RESULT_EVENT_FINAL_RESULT = 0,
116 VC_PRE_RESULT_EVENT_PARTIAL_RESULT,
117 VC_PRE_RESULT_EVENT_ERROR
118 } vc_pre_result_event_e;
121 * @brief Called when client gets the all recognition results from vc-daemon.
123 * @remark temp_command is valid in callback function.
125 * @param[in] event The result event
126 * @param[in] vc_cmd_list_h Command list handle
127 * @param[in] result Command text
128 * @param[in] msg Engine message (e.g. #VC_RESULT_MESSAGE_NONE, #VC_RESULT_MESSAGE_ERROR_TOO_LOUD)
129 * @param[in] user_data The user data passed from the callback registration function
131 * @return @c true to release command to client, \n @c false to wait for selecting command.
132 * @pre An application registers callback function using vc_mgr_set_all_result_cb().
134 * @see vc_mgr_set_all_result_cb()
135 * @see vc_mgr_unset_all_result_cb()
137 typedef bool (*vc_mgr_all_result_cb)(vc_result_event_e event, vc_cmd_list_h vc_cmd_list,
138 const char* result, const char* msg, void *user_data);
141 * @brief Called when client gets the pre recognition results(partial ASR) from vc-daemon.
143 * @param[in] event The pre result event
144 * @param[in] result ASR text
145 * @param[in] user_data The user data passed from the callback registration function
147 * @pre An application registers callback function using vc_mgr_set_pre_result_cb().
149 * @see vc_mgr_set_pre_result_cb()
150 * @see vc_mgr_unset_pre_result_cb()
152 typedef void (*vc_mgr_pre_result_cb)(vc_pre_result_event_e event, const char* result, void *user_data);
155 * @brief Called when user speaking is detected.
157 * @param[in] user_data The user data passed from the callback registration function
159 * @pre An application registers callback function using vc_mgr_set_speech_detected_cb().
161 * @see vc_mgr_set_speech_detected_cb()
162 * @see vc_mgr_unset_speech_detected_cb()
164 typedef void (*vc_mgr_begin_speech_detected_cb)(void *user_data);
168 * @brief Called when user request dialog
170 * @param[in] pid Pid of VC client to request dialog
171 * @param[in] disp_text Text that wants to be displayed
172 * @param[in] utt_text Text that wants to be spoken
173 * @param[in] continuous Continue dialog session
174 * @param[in] user_data The user data passed from the callback registration function
176 * @pre An application registers callback function using vc_mgr_set_dialog_request_cb().
178 * @see vc_mgr_set_dialog_request_cb()
179 * @see vc_mgr_unset_dialog_request_cb()
181 typedef void (*vc_mgr_dialog_request_cb)(int pid, const char* disp_text, const char* utt_text, bool continuous, void *user_data);
185 * @brief Initialize voice control manager.
187 * @remarks If the function succeeds, @a vc mgr must be released with vc_mgr_deinitialize().
189 * @return 0 on success, otherwise a negative error value
190 * @retval #VC_ERROR_NONE Successful
191 * @retval #VC_ERROR_OUT_OF_MEMORY Out of memory
192 * @retval #VC_ERROR_OPERATION_FAILED Operation fail
194 * @pre The state should be #VC_STATE_NONE.
195 * @post If this function is called, the state will be #VC_STATE_INITIALIZED.
197 * @see vc_mgr_deinitialize()
199 int vc_mgr_initialize();
202 * @brief Deinitialize voice control manager.
204 * @return 0 on success, otherwise a negative error value
205 * @retval #VC_ERROR_NONE Successful
206 * @retval #VC_ERROR_INVALID_STATE Invalid state
208 * @post If this function is called, the state will be #VC_STATE_NONE.
210 * @see vc_mgr_deinitialize()
212 int vc_mgr_deinitialize();
215 * @brief Connects the voice control service.
217 * @return 0 on success, otherwise a negative error value
218 * @retval #VC_ERROR_NONE Successful
219 * @retval #VC_ERROR_INVALID_STATE Invalid state
221 * @pre The state should be #VC_STATE_INITIALIZED.
222 * @post If this function is called, the state will be #VC_STATE_READY.
224 * @see vc_mgr_unprepare()
226 int vc_mgr_prepare();
229 * @brief Disconnects the vc-daemon.
231 * @return 0 on success, otherwise a negative error value
232 * @retval #VC_ERROR_NONE Successful
233 * @retval #VC_ERROR_INVALID_STATE Invalid state
235 * @pre The state should be #VC_STATE_READY.
236 * @post If this function is called, the state will be #VC_STATE_INITIALIZED.
238 * @see vc_mgr_prepare()
240 int vc_mgr_unprepare();
243 * @brief Retrieves all supported languages using callback function.
245 * @param[in] callback Callback function to invoke
246 * @param[in] user_data The user data to be passed to the callback function
248 * @return 0 on success, otherwise a negative error value
249 * @retval #VC_ERROR_NONE Successful
250 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
251 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
252 * @retval #VC_ERROR_INVALID_STATE Invalid state
254 * @pre The state should NOT be #VC_SERVICE_STATE_NONE.
255 * @post This function invokes vc_supported_language_cb() repeatedly for getting languages.
257 * @see vc_supported_language_cb()
258 * @see vc_mgr_get_current_language()
260 int vc_mgr_foreach_supported_languages(vc_supported_language_cb callback, void* user_data);
263 * @brief Gets current language set by user.
265 * @remark If the function succeeds, @a language must be released with free() by you when you no longer need it.
267 * @param[out] language A language is specified as an ISO 3166 alpha-2 two letter country-code \n
268 * followed by ISO 639-1 for the two-letter language code. \n
269 * For example, "ko_KR" for Korean, "en_US" for American English.
271 * @return 0 on success, otherwise a negative error value
272 * @retval #VC_ERROR_NONE Successful
273 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
274 * @retval #VC_ERROR_OUT_OF_MEMORY Out of memory
275 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
276 * @retval #VC_ERROR_INVALID_STATE Invalid state
278 * @pre The state should NOT be #VC_SERVICE_STATE_NONE.
280 * @see vc_mgr_foreach_supported_languages()
282 int vc_mgr_get_current_language(char** language);
285 * @brief Gets current state of voice control manager.
287 * @param[out] state The current state
289 * @return 0 on success, otherwise a negative error value
290 * @retval #VC_ERROR_NONE Successful
291 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
293 * @pre The state should NOT be #VC_SERVICE_STATE_NONE.
295 * @see vc_state_changed_cb()
296 * @see vc_set_state_changed_cb()
298 int vc_mgr_get_state(vc_state_e* state);
301 * @brief Gets current state of voice control service.
303 * @param[out] state The current state
305 * @return 0 on success, otherwise a negative error value
306 * @retval #VC_ERROR_NONE Successful
307 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
309 * @pre The state should be #VC_STATE_READY.
311 * @see vc_mgr_start()
313 * @see vc_mgr_cancel()
314 * @see vc_set_service_state_changed_cb()
315 * @see vc_unset_service_state_changed_cb()
317 int vc_mgr_get_service_state(vc_service_state_e* state);
320 * @brief Sets demandable client list.
322 * @param[in] rule demandable client list rule path
324 * @return 0 on success, otherwise a negative error value
325 * @retval #VC_ERROR_NONE Successful
326 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
327 * @retval #VC_ERROR_INVALID_STATE Invalid state
329 * @pre The state should be #VC_STATE_READY.
331 * @see vc_mgr_get_demandable_client_rule()
333 int vc_mgr_set_demandable_client_rule(const char* rule);
336 * @brief Gets demandable client list.
338 * @return 0 on success, otherwise a negative error value
339 * @retval #VC_ERROR_NONE Successful
340 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
341 * @retval #VC_ERROR_INVALID_STATE Invalid state
343 * @pre The state should be #VC_STATE_READY.
345 * @see vc_mgr_set_demandable_client_rule()
347 int vc_mgr_unset_demandable_client_rule();
350 * @brief Checks whether the command format is supported.
352 * @param[in] format The command format
353 * @param[out] support The result status @c true = supported, @c false = not supported
355 * @return 0 on success, otherwise a negative error value
356 * @retval #VC_ERROR_NONE Successful
357 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
358 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
359 * @retval #VC_ERROR_INVALID_STATE Invalid state
361 * @pre The state should be #VC_STATE_READY.
363 int vc_mgr_is_command_format_supported(vc_cmd_format_e format, bool* support);
366 * @brief Sets system or exclusive commands.
368 * @remarks The command type is valid for VC_COMMAND_TYPE_SYSTEM or VC_COMMAND_TYPE_EXCLUSIVE.
369 * The commands should include type, command text, format.
371 * @param[in] vc_cmd_list The command list handle
373 * @return 0 on success, otherwise a negative error value
374 * @retval #VC_ERROR_NONE Successful
375 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
376 * @retval #VC_ERROR_INVALID_STATE Invalid state
378 * @pre The state should be #VC_STATE_READY.
380 * @see vc_mgr_unset_command_list()
382 int vc_mgr_set_command_list(vc_cmd_list_h vc_cmd_list);
385 * @brief Unsets system or exclusive commands.
387 * @return 0 on success, otherwise a negative error value
388 * @retval #VC_ERROR_NONE Successful
389 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
390 * @retval #VC_ERROR_INVALID_STATE Invalid state
392 * @pre The state should be #VC_STATE_READY.
394 * @see vc_mgr_set_command_list()
396 int vc_mgr_unset_command_list();
399 * @brief Sets commands from file.
401 * @remarks The commands should include type, command text, format.
403 * @param[in] vc_cmd_list The command list handle
404 * @param[in] type Command type
406 * @return 0 on success, otherwise a negative error value
407 * @retval #VC_ERROR_NONE Successful
408 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
409 * @retval #VC_ERROR_INVALID_STATE Invalid state
410 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
412 * @pre The state should be #VC_STATE_READY.
414 * @see vc_mgr_unset_command_list()
416 int vc_mgr_set_command_list_from_file(const char* file_path, int type);
419 * @brief Sets background commands of preloaded app from file.
421 * @remarks The command type is valid for VC_COMMAND_TYPE_BACKGROUND
422 * The commands should include type, command text, format.
424 * @param[in] vc_cmd_list The command list handle
426 * @return 0 on success, otherwise a negative error value
427 * @retval #VC_ERROR_NONE Successful
428 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
429 * @retval #VC_ERROR_INVALID_STATE Invalid state
430 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
432 * @pre The state should be #VC_STATE_READY.
434 * @see vc_mgr_unset_command_list()
436 int vc_mgr_set_preloaded_commands_from_file(const char* file_path);
439 * @brief Retrieves all available commands.
441 * @remarks If the function succeeds, @a vc_cmd_list must be released with vc_cmd_list_destroy(vc_cmd_list, true).
443 * @param[in] vc_cmd_list The command list
445 * @return 0 on success, otherwise a negative error value
446 * @retval #VC_ERROR_NONE Successful
447 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
448 * @retval #VC_ERROR_INVALID_STATE Invalid state
449 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
451 * @pre The state should be #VC_STATE_READY and the service state should be #VC_SERVICE_STATE_READY.
453 int vc_mgr_get_current_commands(vc_cmd_list_h* vc_cmd_list);
456 * @brief Sets audio in type.
458 * @param[in] audio_id audio type (e.g. #VC_AUDIO_TYPE_BLUETOOTH or usb device id)
460 * @return 0 on success, otherwise a negative error value
461 * @retval #VC_ERROR_NONE Successful
462 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
463 * @retval #VC_ERROR_INVALID_STATE Invalid state
464 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
466 * @pre The state should be #VC_STATE_READY and the service state should be #VC_SERVICE_STATE_READY.
468 * @see vc_mgr_get_audio_type()
470 int vc_mgr_set_audio_type(const char* audio_id);
473 * @brief Gets audio-in type.
475 * @remarks audio_id must be released using free() when it is no longer required.
477 * @param[out] audio_id audio id (e.g. #VC_AUDIO_TYPE_BLUETOOTH or usb device id)
479 * @return 0 on success, otherwise a negative error value
480 * @retval #VC_ERROR_NONE Successful
481 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
482 * @retval #VC_ERROR_INVALID_STATE Invalid state
483 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
485 * @pre The state should be #VC_STATE_READY and the service state should be #VC_SERVICE_STATE_READY.
487 * @see vc_mgr_set_audio_type()
489 int vc_mgr_get_audio_type(char** audio_id);
492 * @brief Sets recognition mode.
494 * @param[in] mode recognition mode (e.g. #VC_RECOGNITION_MODE_STOP_BY_SILENCE is default value)
496 * @return 0 on success, otherwise a negative error value
497 * @retval #VC_ERROR_NONE Successful
498 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
499 * @retval #VC_ERROR_INVALID_STATE Invalid state
501 * @pre The state should be #VC_STATE_READY and the service state should be #VC_SERVICE_STATE_READY.
503 * @see vc_mgr_set_recognition_mode()
505 int vc_mgr_set_recognition_mode(vc_recognition_mode_e mode);
508 * @brief Gets recognition mode.
510 * @param[out] mode recognition mode
512 * @return 0 on success, otherwise a negative error value
513 * @retval #VC_ERROR_NONE Successful
514 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
515 * @retval #VC_ERROR_INVALID_STATE Invalid state
517 * @pre The state should be #VC_STATE_READY.
519 * @see vc_mgr_get_recognition_mode()
521 int vc_mgr_get_recognition_mode(vc_recognition_mode_e* mode);
524 * @brief Sets private data between app and engine.
526 * @param[in] key Private key
527 * @param[in] data Private data
529 * @return 0 on success, otherwise a negative error value
530 * @retval #VC_ERROR_NONE Successful
531 * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory
532 * @retval #VC_ERROR_INVALID_STATE Invalid state
533 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
535 * @pre The service state should be #VC_SERVICE_STATE_READY.
537 int vc_mgr_set_private_data(const char* key, const char* data);
540 * @brief Gets private data between app and engine.
542 * @remarks data must be released using free() when it is no longer required.
544 * @param[in] key Private key
545 * @param[out] data Private data
547 * @return 0 on success, otherwise a negative error value
548 * @retval #VC_ERROR_NONE Successful
549 * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory
550 * @retval #VC_ERROR_INVALID_STATE Invalid state
551 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
553 * @pre The service state should be #VC_SERVICE_STATE_READY.
555 int vc_mgr_get_private_data(const char* key, char** data);
558 * @brief Sets domain such as agent or device type.
560 * @param[in] domain Available agent or device type
562 * @return 0 on success, otherwise a negative error value
563 * @retval #VC_ERROR_NONE Successful
564 * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory
565 * @retval #VC_ERROR_INVALID_STATE Invalid state
566 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
568 * @pre The service state should be #VC_SERVICE_STATE_READY.
570 int vc_mgr_set_domain(const char* domain);
573 * @brief Request to do action as if utterence is spoken.
575 * @param[in] type Event type
576 * @param[in] send_event The string for send event
578 * @return 0 on success, otherwise a negative error value
579 * @retval #VC_ERROR_NONE Successful
580 * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory
581 * @retval #VC_ERROR_INVALID_STATE Invalid state
582 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
584 * @pre The service state should be #VC_SERVICE_STATE_READY.
586 int vc_mgr_do_action(vc_send_event_type_e type, char* send_event);
589 * @brief Starts recognition.
591 * @remarks The default recognition mode is #VC_RECOGNITION_MODE_STOP_BY_SILENCE. \n
592 * If you want to use other mode, you can set mode with vc_mgr_set_recognition_mode().
594 * @param[in] exclusive_command_option Exclusive command option
596 * @return 0 on success, otherwise a negative error value
597 * @retval #VC_ERROR_NONE Successful
598 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter.
599 * @retval #VC_ERROR_INVALID_STATE Invalid state
600 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
602 * @pre The state should be #VC_STATE_READY and the service state should be #VC_SERVICE_STATE_READY.
603 * @post It will invoke vc_service_state_changed_cb(), if you register a callback with vc_service_state_changed_cb(). \n
604 * If this function succeeds, the service state will be #VC_SERVICE_STATE_RECORDING.
607 * @see vc_mgr_cancel()
608 * @see vc_service_state_changed_cb()
609 * @see vc_mgr_set_recognition_mode()
610 * @see vc_mgr_get_recognition_mode()
612 int vc_mgr_start(bool exclusive_command_option);
615 * @brief Stop recognition.
617 * @return 0 on success, otherwise a negative error value
618 * @retval #VC_ERROR_NONE Successful
619 * @retval #VC_ERROR_INVALID_STATE Invalid state
620 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
622 * @pre The service state should be #VC_SERVICE_STATE_RECORDING.
623 * @post It will invoke vc_service_state_changed_cb(), if you register a callback with vc_service_state_changed_cb(). \n
624 * If this function succeeds, the service state will be #VC_SERVICE_STATE_PROCESSING.
626 * @see vc_mgr_start()
627 * @see vc_mgr_cancel()
628 * @see vc_service_state_changed_cb()
629 * @see vc_mgr_result_cb()
634 * @brief Cancels recognition.
636 * @return 0 on success, otherwise a negative error value
637 * @retval #VC_ERROR_NONE Successful
638 * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory
639 * @retval #VC_ERROR_INVALID_STATE Invalid state
640 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
642 * @pre The service state should be #VC_SERVICE_STATE_RECORDING or #VC_SERVICE_STATE_PROCESSING.
643 * @post It will invoke vc_service_state_changed_cb(), if you register a callback with vc_service_state_changed_cb(). \n
644 * If this function succeeds, the service state will be #VC_SERVICE_STATE_READY.
646 * @see vc_mgr_start()
648 * @see vc_service_state_changed_cb()
653 * @brief Gets the microphone volume during recording.
655 * @param[out] volume Recording volume
657 * @return 0 on success, otherwise a negative error value
658 * @retval #VC_ERROR_NONE Successful
659 * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory
660 * @retval #VC_ERROR_INVALID_STATE Invalid state
661 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
663 * @pre The service state should be #VC_SERVICE_STATE_RECORDING.
665 * @see vc_mgr_start()
667 int vc_mgr_get_recording_volume(float* volume);
670 * @brief Select valid result from all results.
672 * @param[in] vc_cmd_list The valid result list
674 * @return 0 on success, otherwise a negative error value
675 * @retval #VC_ERROR_NONE Successful
676 * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory
677 * @retval #VC_ERROR_INVALID_STATE Invalid state
678 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
680 * @pre vc_mgr_all_result_cb() should be called
682 * @see vc_mgr_all_result_cb()
684 int vc_mgr_set_selected_results(vc_cmd_list_h vc_cmd_list);
688 * @brief Registers a callback function for getting recognition result.
690 * @param[in] callback Callback function to register
691 * @param[in] user_data The user data to be passed to the callback function
693 * @return 0 on success, otherwise a negative error value
694 * @retval #VC_ERROR_NONE Successful
695 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
696 * @retval #VC_ERROR_INVALID_STATE Invalid state
698 * @pre The state should be #VC_STATE_INITIALIZED.
700 * @see vc_mgr_all_result_cb()
701 * @see vc_mgr_unset_all_result_cb()
703 int vc_mgr_set_all_result_cb(vc_mgr_all_result_cb callback, void* user_data);
706 * @brief Unregisters the callback function.
708 * @return 0 on success, otherwise a negative error value
709 * @retval #VC_ERROR_NONE Successful
710 * @retval #VC_ERROR_INVALID_STATE Invalid state
712 * @pre The state should be #VC_STATE_INITIALIZED.
714 * @see vc_mgr_set_all_result_cb()
716 int vc_mgr_unset_all_result_cb();
719 * @brief Registers a callback function for getting pre recognition result.
721 * @param[in] callback Callback function to register
722 * @param[in] user_data The user data to be passed to the callback function
724 * @return 0 on success, otherwise a negative error value
725 * @retval #VC_ERROR_NONE Successful
726 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
727 * @retval #VC_ERROR_INVALID_STATE Invalid state
729 * @pre The state should be #VC_STATE_INITIALIZED.
731 * @see vc_mgr_pre_result_cb()
732 * @see vc_mgr_unset_pre_result_cb()
734 int vc_mgr_set_pre_result_cb(vc_mgr_pre_result_cb callback, void* user_data);
737 * @brief Unregisters the callback function.
739 * @return 0 on success, otherwise a negative error value
740 * @retval #VC_ERROR_NONE Successful
741 * @retval #VC_ERROR_INVALID_STATE Invalid state
743 * @pre The state should be #VC_STATE_INITIALIZED.
745 * @see vc_mgr_set_pre_result_cb()
747 int vc_mgr_unset_pre_result_cb();
750 * @brief Registers a callback function for getting system or exclusive recognition result.
752 * @param[in] callback Callback function to register
753 * @param[in] user_data The user data to be passed to the callback function
755 * @return 0 on success, otherwise a negative error value
756 * @retval #VC_ERROR_NONE Successful
757 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
758 * @retval #VC_ERROR_INVALID_STATE Invalid state
760 * @pre The state should be #VC_STATE_INITIALIZED.
762 * @see vc_result_cb()
763 * @see vc_mgr_unset_result_cb()
765 int vc_mgr_set_result_cb(vc_result_cb callback, void* user_data);
768 * @brief Unregisters the callback function.
770 * @return 0 on success, otherwise a negative error value
771 * @retval #VC_ERROR_NONE Successful
772 * @retval #VC_ERROR_INVALID_STATE Invalid state
774 * @pre The state should be #VC_STATE_INITIALIZED.
776 * @see vc_mgr_set_result_cb()
778 int vc_mgr_unset_result_cb();
781 * @brief Registers a callback function to be called when state is changed.
783 * @param[in] callback Callback function to register
784 * @param[in] user_data The user data to be passed to the callback function
786 * @return 0 on success, otherwise a negative error value
787 * @retval #VC_ERROR_NONE Successful
788 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
789 * @retval #VC_ERROR_INVALID_STATE Invalid state
791 * @pre The state should be #VC_STATE_INITIALIZED.
793 * @see vc_state_changed_cb()
794 * @see vc_mgr_unset_state_changed_cb()
796 int vc_mgr_set_state_changed_cb(vc_state_changed_cb callback, void* user_data);
799 * @brief Unregisters the callback function.
801 * @return 0 on success, otherwise a negative error value
802 * @retval #VC_ERROR_NONE Successful
803 * @retval #VC_ERROR_INVALID_STATE Invalid state
805 * @pre The state should be #VC_STATE_INITIALIZED.
807 * @see vc_mgr_set_state_changed_cb()
809 int vc_mgr_unset_state_changed_cb();
812 * @brief Registers a callback function to be called when state is changed.
814 * @param[in] callback Callback function to register
815 * @param[in] user_data The user data to be passed to the callback function
817 * @return 0 on success, otherwise a negative error value
818 * @retval #VC_ERROR_NONE Successful
819 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
820 * @retval #VC_ERROR_INVALID_STATE Invalid state
822 * @pre The state should be #VC_STATE_INITIALIZED.
824 * @see vc_service_state_changed_cb()
825 * @see vc_mgr_unset_service_state_changed_cb()
827 int vc_mgr_set_service_state_changed_cb(vc_service_state_changed_cb callback, void* user_data);
830 * @brief Unregisters the callback function.
832 * @return 0 on success, otherwise a negative error value
833 * @retval #VC_ERROR_NONE Successful
834 * @retval #VC_ERROR_INVALID_STATE Invalid state
836 * @pre The state should be #VC_STATE_INITIALIZED.
838 * @see vc_mgr_set_service_state_changed_cb()
840 int vc_mgr_unset_service_state_changed_cb();
843 * @brief Registers a callback function to be called when begin of speech is detected.
845 * @param[in] callback Callback function to register
846 * @param[in] user_data The user data to be passed to the callback function
848 * @return 0 on success, otherwise a negative error value
849 * @retval #VC_ERROR_NONE Successful
850 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
851 * @retval #VC_ERROR_INVALID_STATE Invalid state
853 * @pre The state should be #VC_STATE_INITIALIZED.
855 * @see vc_mgr_begin_speech_detected_cb()
856 * @see vc_mgr_unset_speech_detected_cb()
858 int vc_mgr_set_speech_detected_cb(vc_mgr_begin_speech_detected_cb callback, void* user_data);
861 * @brief Unregisters the callback function.
863 * @return 0 on success, otherwise a negative error value
864 * @retval #VC_ERROR_NONE Successful
865 * @retval #VC_ERROR_INVALID_STATE Invalid state
867 * @pre The state should be #VC_STATE_INITIALIZED.
869 * @see vc_mgr_set_speech_detected_cb()
871 int vc_mgr_unset_speech_detected_cb();
874 * @brief Registers a callback function to be called when current language is changed.
876 * @param[in] callback Callback function to register
877 * @param[in] user_data The user data to be passed to the callback function
879 * @return 0 on success, otherwise a negative error value
880 * @retval #VC_ERROR_NONE Successful
881 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
882 * @retval #VC_ERROR_INVALID_STATE Invalid state
884 * @pre The state should be #VC_STATE_INITIALIZED.
886 * @see vc_current_language_changed_cb()
887 * @see vc_mgr_unset_current_language_changed_cb()
889 int vc_mgr_set_current_language_changed_cb(vc_current_language_changed_cb callback, void* user_data);
892 * @brief Unregisters the callback function.
894 * @return 0 on success, otherwise a negative error value
895 * @retval #VC_ERROR_NONE Successful
896 * @retval #VC_ERROR_INVALID_STATE Invalid state
898 * @pre The state should be #VC_STATE_INITIALIZED.
900 * @see vc_mgr_set_current_language_changed_cb()
902 int vc_mgr_unset_current_language_changed_cb();
905 * @brief Gets the current error message.
907 * @remarks This function should be called during as vc error callback. If not, the error as operation failure will be returned. \n
908 * If the function succeeds, @a err_msg must be released using free() when it is no longer required.
910 * @param[out] err_msg The current error message
912 * @return 0 on success, otherwise a negative error value
913 * @retval #VC_ERROR_NONE Successful
914 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
915 * @retval #VC_ERROR_INVALID_STATE Invalid state
916 * @retval $VC_ERROR_OPERATION_FAILED Operation failure
917 * @retval #VC_ERROR_OUT_OF_MEMORY Out of memory
921 int vc_mgr_get_error_message(char** err_msg);
924 * @brief Registers a callback function to be called when an error occurred.
926 * @param[in] callback Callback function to register
927 * @param[in] user_data The user data to be passed to the callback function
929 * @return 0 on success, otherwise a negative error value
930 * @retval #VC_ERROR_NONE Successful
931 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
932 * @retval #VC_ERROR_INVALID_STATE Invalid state
934 * @pre The state should be #VC_STATE_INITIALIZED.
937 * @see vc_mgr_unset_error_cb()
939 int vc_mgr_set_error_cb(vc_error_cb callback, void* user_data);
942 * @brief Unregisters the callback function.
944 * @return 0 on success, otherwise a negative error value
945 * @retval #VC_ERROR_NONE Successful
946 * @retval #VC_ERROR_INVALID_STATE Invalid state
948 * @pre The state should be #VC_STATE_INITIALIZED.
950 * @see vc_mgr_set_error_cb()
952 int vc_mgr_unset_error_cb();
956 * @brief Registers a callback function to be called when dialog requests.
958 * @param[in] callback Callback function to register
959 * @param[in] user_data The user data to be passed to the callback function
961 * @return 0 on success, otherwise a negative error value
962 * @retval #VC_ERROR_NONE Successful
963 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
964 * @retval #VC_ERROR_INVALID_STATE Invalid state
966 * @pre The state should be #VC_STATE_INITIALIZED.
968 * @see vc_mgr_unset_dialog_request_cb()
970 int vc_mgr_set_dialog_request_cb(vc_mgr_dialog_request_cb callback, void* user_data);
973 * @brief Unregisters the callback function.
975 * @return 0 on success, otherwise a negative error value
976 * @retval #VC_ERROR_NONE Successful
977 * @retval #VC_ERROR_INVALID_STATE Invalid state
979 * @pre The state should be #VC_STATE_INITIALIZED.
981 * @see vc_mgr_set_dialog_request_cb()
983 int vc_mgr_unset_dialog_request_cb();
986 * @brief Enable command type as candidate command.
988 * @return 0 on success, otherwise a negative error value
989 * @retval #VC_ERROR_NONE Successful
990 * @retval #VC_ERROR_INVALID_STATE Invalid state
992 * @pre The state should be #VC_STATE_READY.
994 * @see vc_mgr_disable_command_type()
996 int vc_mgr_enable_command_type(int cmd_type);
999 * @brief Disable command type as candidate command.
1001 * @return 0 on success, otherwise a negative error value
1002 * @retval #VC_ERROR_NONE Successful
1003 * @retval #VC_ERROR_INVALID_STATE Invalid state
1005 * @pre The state should be #VC_STATE_READY.
1007 * @see vc_mgr_enable_command_type()
1009 int vc_mgr_disable_command_type(int cmd_type);
1019 #endif /* __VOICE_CONTROL_MANAGER_H__ */