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_COMMON_H__
19 #define __VOICE_CONTROL_COMMON_H__
21 #include <voice_control_command.h>
24 * @addtogroup CAPI_UIX_VOICE_CONTROL_MODULE
34 * @brief Enumerations of error codes.
38 VC_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
39 VC_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */
40 VC_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
41 VC_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
42 VC_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< No answer from service */
43 VC_ERROR_RECORDER_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Busy recorder */
44 VC_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
45 VC_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< VC NOT supported */
46 VC_ERROR_INVALID_STATE = TIZEN_ERROR_VOICE_CONTROL | 0x011, /**< Invalid state */
47 VC_ERROR_INVALID_LANGUAGE = TIZEN_ERROR_VOICE_CONTROL | 0x012, /**< Invalid language */
48 VC_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_VOICE_CONTROL | 0x013, /**< No available engine */
49 VC_ERROR_OPERATION_FAILED = TIZEN_ERROR_VOICE_CONTROL | 0x014, /**< Operation failed */
50 VC_ERROR_OPERATION_REJECTED = TIZEN_ERROR_VOICE_CONTROL | 0x015, /**< Operation rejected */
51 VC_ERROR_ITERATION_END = TIZEN_ERROR_VOICE_CONTROL | 0x016, /**< List reached end */
52 VC_ERROR_EMPTY = TIZEN_ERROR_VOICE_CONTROL | 0x017 /**< List empty */
56 * @brief Enumerations of result event.
60 VC_RESULT_EVENT_RESULT_SUCCESS = 0, /**< Normal result */
61 VC_RESULT_EVENT_REJECTED = 1 /**< Rejected result */
65 * @brief Enumerations of service state.
69 VC_SERVICE_STATE_NONE = 0, /**< 'None' state */
70 VC_SERVICE_STATE_READY = 1, /**< 'Ready' state */
71 VC_SERVICE_STATE_RECORDING = 2, /**< 'Recording' state */
72 VC_SERVICE_STATE_PROCESSING = 3 /**< 'Processing' state */
76 * @brief Enumerations of client state.
80 VC_STATE_NONE = 0, /**< 'None' state */
81 VC_STATE_INITIALIZED = 1, /**< 'Initialized' state */
82 VC_STATE_READY = 2 /**< 'Ready' state */
87 * @brief Called when client gets the recognition result.
90 * @remarks If the duplicated commands are recognized, the event(e.g. #VC_RESULT_EVENT_REJECTED) of command may be rejected \n
91 * for selecting command as priority. If you set similar or same commands or the recognized results are multi-results,
92 * vc_cmd_list has the multi commands.
94 * @param[in] event The result event (e.g. #VC_RESULT_EVENT_RESULT_SUCCESS, #VC_RESULT_EVENT_REJECTED)
95 * @param[in] vc_cmd_list The recognized command list
96 * @param[in] result The spoken text
97 * @param[in] user_data The user data passed from the callback registration function
99 * @pre An application registers callback function.
101 * @see vc_set_result_cb()
103 typedef void (*vc_result_cb)(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, void *user_data);
106 * @brief Called when default language is changed.
109 * @param[in] previous Previous language
110 * @param[in] current Current language
111 * @param[in] user_data The user data passed from the callback registration function
113 * @pre An application registers this callback to detect changing mode.
115 * @see vc_set_current_language_changed_cb()
117 typedef void (*vc_current_language_changed_cb)(const char* previous, const char* current, void* user_data);
120 * @brief Called to retrieve supported language.
123 * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code \n
124 * followed by ISO 639-1 for the two-letter language code. \n
125 * For example, "ko_KR" for Korean, "en_US" for American English.
126 * @param[in] user_data The user data passed from the foreach function
128 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
130 * @pre The function will invoke this callback.
132 typedef bool (*vc_supported_language_cb)(const char* language, void* user_data);
135 * @brief Called when the state of voice control client is changed.
138 * @param[in] previous A previous state
139 * @param[in] current A current state
140 * @param[in] user_data The user data passed from the callback registration function
142 * @pre An application registers this callback to detect changing state.
144 * @see vc_set_state_changed_cb()
146 typedef void (*vc_state_changed_cb)(vc_state_e previous, vc_state_e current, void* user_data);
149 * @brief Called when the state of voice control service is changed.
152 * @param[in] previous A previous state
153 * @param[in] current A current state
154 * @param[in] user_data The user data passed from the callback registration function
156 * @pre An application registers this callback to detect changing service state.
158 * @see vc_set_service_state_changed_cb()
160 typedef void (*vc_service_state_changed_cb)(vc_service_state_e previous, vc_service_state_e current, void* user_data);
163 * @brief Called when error occurred.
166 * @param[in] reason The error type (e.g. #VC_ERROR_OUT_OF_MEMORY, #VC_ERROR_TIMED_OUT)
167 * @param[in] user_data The user data passed from the callback registration function
169 * @pre An application registers this callback to detect error.
171 * @see vc_set_error_cb()
173 typedef void (*vc_error_cb)(vc_error_e reason, void *user_data);
184 #endif /* VOICE_CONTROL_COMMON */