2 * Copyright (c) 2011-2016 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>
25 * @addtogroup CAPI_UIX_VOICE_CONTROL_MODULE
37 * @brief Enumeration for error codes.
38 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
41 VC_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
42 VC_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */
43 VC_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
44 VC_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
45 VC_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< No answer from service */
46 VC_ERROR_RECORDER_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Busy recorder */
47 VC_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
48 VC_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< VC NOT supported */
49 VC_ERROR_INVALID_STATE = TIZEN_ERROR_VOICE_CONTROL | 0x011, /**< Invalid state */
50 VC_ERROR_INVALID_LANGUAGE = TIZEN_ERROR_VOICE_CONTROL | 0x012, /**< Invalid language */
51 VC_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_VOICE_CONTROL | 0x013, /**< No available engine */
52 VC_ERROR_OPERATION_FAILED = TIZEN_ERROR_VOICE_CONTROL | 0x014, /**< Operation failed */
53 VC_ERROR_OPERATION_REJECTED = TIZEN_ERROR_VOICE_CONTROL | 0x015, /**< Operation rejected */
54 VC_ERROR_ITERATION_END = TIZEN_ERROR_VOICE_CONTROL | 0x016, /**< List reached end */
55 VC_ERROR_EMPTY = TIZEN_ERROR_VOICE_CONTROL | 0x017, /**< List empty */
56 VC_ERROR_SERVICE_RESET = TIZEN_ERROR_VOICE_CONTROL | 0x018, /**< Service daemon reset (Since 3.0) */
57 VC_ERROR_IN_PROGRESS_TO_READY = TIZEN_ERROR_VOICE_CONTROL | 0x019, /**< In progress to ready (Since 3.0) */
58 VC_ERROR_IN_PROGRESS_TO_RECORDING = TIZEN_ERROR_VOICE_CONTROL | 0x020, /**< In progress to recording (Since 3.0) */
59 VC_ERROR_IN_PROGRESS_TO_PROCESSING = TIZEN_ERROR_VOICE_CONTROL | 0x021, /**< In progress to processing (Since 3.0) */
60 VC_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_VOICE_CONTROL | 0x022 /**< Not supported feature of current engine (Since 4.0) */
65 * @brief Enumeration for result event.
66 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
69 VC_RESULT_EVENT_RESULT_SUCCESS = 0, /**< Normal result */
70 VC_RESULT_EVENT_REJECTED = 1 /**< Rejected result */
75 * @brief Enumeration for service state.
76 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
79 VC_SERVICE_STATE_NONE = 0, /**< 'None' state */
80 VC_SERVICE_STATE_READY = 1, /**< 'Ready' state */
81 VC_SERVICE_STATE_RECORDING = 2, /**< 'Recording' state */
82 VC_SERVICE_STATE_PROCESSING = 3 /**< 'Processing' state */
87 * @brief Enumeration for client state.
88 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
91 VC_STATE_NONE = 0, /**< 'None' state */
92 VC_STATE_INITIALIZED = 1, /**< 'Initialized' state */
93 VC_STATE_READY = 2 /**< 'Ready' state */
97 * @brief Enumerations of audio types.
101 VC_AUDIO_TYPE_PCM_S16_LE = 0, /**< Signed 16bit audio type, Little endian */
102 VC_AUDIO_TYPE_PCM_U8 /**< Unsigned 8bit audio type */
106 * @brief Enumerations for audio channels.
110 VC_AUDIO_CHANNEL_MONO = 0, /**< 1 channel, mono */
111 VC_AUDIO_CHANNEL_STEREO = 1 /**< 2 channels, stereo */
112 } vc_audio_channel_e;
115 * @brief Enumeration for TTS feedback events.
119 VC_FEEDBACK_EVENT_FAIL = -1, /**< Failed */
120 VC_FEEDBACK_EVENT_START = 1, /**< Start event */
121 VC_FEEDBACK_EVENT_CONTINUE = 2, /**< Continue event */
122 VC_FEEDBACK_EVENT_FINISH = 3 /**< Finish event */
123 } vc_feedback_event_e;
126 * @brief Enumeration for requested TTS events.
130 VC_TTS_EVENT_FAIL = -1, /**< Failed */
131 VC_TTS_EVENT_START = 1, /**< Start event */
132 VC_TTS_EVENT_CONTINUE = 2, /**< Continue event */
133 VC_TTS_EVENT_FINISH = 3 /**< Finish event */
137 * @brief Enumeration for requested TTS utterance status events.
141 VC_TTS_UTTERANCE_NONE = -1, /**< None */
142 VC_TTS_UTTERANCE_STARTED = 1, /**< Utterance started */
143 VC_TTS_UTTERANCE_COMPLETED = 2, /**< Utterance completed */
144 VC_TTS_UTTERANCE_CANCELED = 3 /**< Utterance canceled */
145 } vc_tts_utterance_status_e;
148 * @brief Called when client gets the recognition result.
149 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
150 * @remarks If the duplicated commands are recognized, the event(e.g. #VC_RESULT_EVENT_REJECTED) of command may be rejected
151 * for selecting command as priority. If you set similar or same commands or the recognized results are multi-results,
152 * vc_cmd_list has the multi commands.
153 * @param[in] event The result event (e.g. #VC_RESULT_EVENT_RESULT_SUCCESS, #VC_RESULT_EVENT_REJECTED)
154 * @param[in] vc_cmd_list The recognized command list
155 * @param[in] result The spoken text
156 * @param[in] user_data The user data passed from the callback registration function
157 * @pre An application registers callback function.
158 * @see vc_set_result_cb()
160 typedef void (*vc_result_cb)(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, void *user_data);
164 * @brief Called when default language is changed.
165 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
166 * @param[in] previous Previous language
167 * @param[in] current Current language
168 * @param[in] user_data The user data passed from the callback registration function
169 * @pre An application registers this callback to detect changing mode.
170 * @see vc_set_current_language_changed_cb()
172 typedef void (*vc_current_language_changed_cb)(const char* previous, const char* current, void* user_data);
176 * @brief Called to retrieve supported language.
177 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
178 * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code
179 * followed by ISO 639-1 for the two-letter language code.
180 * For example, "ko_KR" for Korean, "en_US" for American English
181 * @param[in] user_data The user data passed from the foreach function
182 * @return @c true to continue with the next iteration of the loop,
183 * @c false to break out of the loop
184 * @pre The function will invoke this callback.
186 typedef bool (*vc_supported_language_cb)(const char* language, void* user_data);
190 * @brief Called when the state of voice control client is changed.
191 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
192 * @param[in] previous A previous state
193 * @param[in] current A current state
194 * @param[in] user_data The user data passed from the callback registration function
195 * @pre An application registers this callback to detect changing state.
196 * @see vc_set_state_changed_cb()
198 typedef void (*vc_state_changed_cb)(vc_state_e previous, vc_state_e current, void* user_data);
202 * @brief Called when the state of voice control service is changed.
203 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
204 * @param[in] previous A previous state
205 * @param[in] current A current state
206 * @param[in] user_data The user data passed from the callback registration function
207 * @pre An application registers this callback to detect changing service state.
208 * @see vc_set_service_state_changed_cb()
210 typedef void (*vc_service_state_changed_cb)(vc_service_state_e previous, vc_service_state_e current, void* user_data);
214 * @brief Called when error occurred.
215 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
216 * @param[in] reason The error type (e.g. #VC_ERROR_OUT_OF_MEMORY, #VC_ERROR_TIMED_OUT)
217 * @param[in] user_data The user data passed from the callback registration function
218 * @pre An application registers this callback to detect error.
219 * @see vc_set_error_cb()
221 typedef void (*vc_error_cb)(vc_error_e reason, void *user_data);
225 * @brief Called when the client receives TTS streaming data from the VC engine service.
227 * @remarks The @a buffer must be released with free() by you when you no longer need it.
228 * @param[in] event The TTS event
229 * @param[in] buffer The TTS streaming data
230 * @param[in] len The length of the TTS streaming data
231 * @param[in] utt_id The utterance id
232 * @param[in] user_data The user data passed from the callback registration function
233 * @pre The application registers the callback function using vc_tts_set_streaming_cb().
234 * @see vc_tts_set_streaming_cb()
236 typedef void (*vc_tts_streaming_cb)(vc_tts_event_e event, char* buffer, int len, int utt_id, void *user_data);
240 * @brief Called when the client receives the TTS utterance status.
242 * @param[in] utt_id The utterance id
243 * @param[in] status The new TTS utterance status (e.g. #VC_TTS_UTTERANCE_STARTED, #VC_TTS_UTTERANCE_COMPLETED, and so on)
244 * @param[in] user_data The user data passed from the callback registration function
245 * @pre The application registers the callback function using vc_tts_set_utterance_status_cb().
246 * @see vc_tts_set_utterance_status_cb()
248 typedef void (*vc_tts_utterance_status_cb)(int utt_id, vc_tts_utterance_status_e status, void *user_data);
260 #endif /* VOICE_CONTROL_COMMON */