2 * Copyright (c) 2011-2018 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_INTERNAL_H__
19 #define __VOICE_CONTROL_INTERNAL_H__
30 VC_TTS_EVENT_FAIL = -1, /**< Failed */
31 VC_TTS_EVENT_START = 1, /**< Start event */
32 VC_TTS_EVENT_CONTINUE = 2, /**< Continue event */
33 VC_TTS_EVENT_FINISH = 3 /**< Finish event */
37 VC_TTS_UTTERANCE_NONE = -1,
38 VC_TTS_UTTERANCE_STARTED = 1,
39 VC_TTS_UTTERANCE_COMPLETED = 2,
40 VC_TTS_UTTERANCE_CANCELED = 3
41 } vc_tts_utterance_status_e;
45 * @brief Called when client gets the asr recognition result from vc-daemon.
47 * @param[in] event The result event
48 * @param[in] result ASR text
49 * @param[in] user_data The user data passed from the callback registration function
51 * @return @c true when asr result is consumed \n @c false to propagate.
53 * @pre An application registers callback function using vc_mgr_set_pre_result_cb().
55 * @see vc_widget_set_asr_result_cb()
56 * @see vc_widget_unset_asr_result_cb()
58 typedef bool (*vc_asr_result_cb)(vc_result_event_e event, const char* result, void *user_data);
61 * @brief Called when client gets TTS streaming data from vc engine service.
64 * @param[in] event The TTS event
65 * @param[in] buffer The TTS streaming data
66 * @param[in] len The length of the TTS streaming data
67 * @param[in] utt_id The utterance id
68 * @param[in] user_data The user data passed from the callback registration function
70 * @pre An application registers callback function using vc_tts_set_streaming_cb().
72 * @see vc_tts_set_streaming_cb()
73 * @see vc_tts_unset_streaming_cb()
75 typedef void (*vc_tts_streaming_cb)(vc_tts_event_e event, char* buffer, int len, int utt_id, void *user_data);
78 * @brief Called when client gets TTS utterance status.
81 * @param[in] utt_id The utterance id
82 * @param[in] status The TTS utterance status (e.g. #VC_TTS_UTTERANCE_STARTED, #VC_TTS_UTTERANCE_COMPLETED, and so on)
84 * @pre An application registers callback function using vc_tts_set_utterance_status_cb().
86 * @see vc_tts_set_utterance_status_cb()
87 * @see vc_tts_unset_utterance_status_cb()
89 typedef void (*vc_tts_utterance_status_cb)(int utt_id, vc_tts_utterance_status_e status);
92 * @brief Sets command list from file.
95 * @privilege %http://tizen.org/privilege/recorder
97 * @remarks The command type is valid for #VC_COMMAND_TYPE_FOREGROUND and #VC_COMMAND_TYPE_BACKGROUND.
98 * Therefore, @a type is either #VC_COMMAND_TYPE_FOREGROUND or #VC_COMMAND_TYPE_BACKGROUND.
99 * In the file corresponding to @a file_path, there must be commands and command types.
101 * @param[in] file_path The command file path (absolute or relative)
102 * @param[in] type Command type
104 * @return 0 on success, otherwise a negative error value
105 * @retval #VC_ERROR_NONE Successful
106 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
107 * @retval #VC_ERROR_INVALID_STATE Invalid state
108 * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
109 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
111 * @pre The state should be #VC_STATE_READY.
113 * @see vc_unset_command_list()
115 int vc_set_command_list_from_file(const char* file_path, int type);
118 * @brief Connects the voice control service synchronously.
121 * @privilege %http://tizen.org/privilege/recorder
122 * @return @c 0 on success,
123 * otherwise a negative error value
124 * @retval #VC_ERROR_NONE Successful
125 * @retval #VC_ERROR_INVALID_STATE Invalid state
126 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
127 * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
128 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
129 * @pre The state should be #VC_STATE_INITIALIZED.
130 * @post If this function is called, the state will be #VC_STATE_READY.
131 * @see vc_unprepare()
133 int vc_prepare_sync(void);
136 * @brief Requests to send TTS streaming data.
139 * @param[in] text The text to be requested for TTS
140 * @param[in] language The language for TTS
141 * @param[in] to_vcm A value whether the TTS request is from vc client or vc manager
142 * @param[in] utt_id The utterance id
144 * @return 0 on success, otherwise a negative error value
145 * @retval #VC_ERROR_NONE Successful
146 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
147 * @retval #VC_ERROR_INVALID_STATE Invalid state
148 * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
149 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
151 * @pre The state should be #VC_STATE_READY.
153 * @see vc_tts_cancel()
155 int vc_tts_request(const char* text, const char* language, bool to_vcm, int* utt_id);
158 * @brief Requests to cancel TTS streaming data.
161 * @param[in] utt_id The utterance id
163 * @return 0 on success, otherwise a negative error value
164 * @retval #VC_ERROR_NONE Successful
165 * @retval #VC_ERROR_INVALID_STATE Invalid state
166 * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
167 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
169 * @pre The state should be #VC_STATE_READY.
171 * @see vc_tts_request()
173 int vc_tts_cancel(int utt_id);
176 * @brief Gets TTS audio format.
179 * @param[out] rate The audio sampling rate
180 * @param[out] channel The audio channel
181 * @param[out] audio_type The audio type
183 * @return 0 on success, otherwise a negative error value
184 * @retval #VC_ERROR_NONE Successful
185 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
186 * @retval #VC_ERROR_INVALID_STATE Invalid state
187 * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
188 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
190 * @pre The state should be #VC_STATE_READY.
192 int vc_tts_get_audio_format(int* rate, vc_audio_channel_e* channel, vc_audio_type_e* audio_type);
195 * @brief Sets TTS streaming callback function.
198 * @param[in] callback The callback function
199 * @param[in] user_data The user data to be passed to the callback function
201 * @return 0 on success, otherwise a negative error value
202 * @retval #VC_ERROR_NONE Successful
203 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
204 * @retval #VC_ERROR_INVALID_STATE Invalid state
205 * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
206 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
208 * @pre The state should be #VC_STATE_INITIALIZED.
210 int vc_tts_set_streaming_cb(vc_tts_streaming_cb callback, void* user_data);
213 * @brief Unsets TTS streaming callback function.
216 * @return 0 on success, otherwise a negative error value
217 * @retval #VC_ERROR_NONE Successful
218 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
219 * @retval #VC_ERROR_INVALID_STATE Invalid state
220 * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
221 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
223 * @pre The state should be #VC_STATE_INITIALIZED.
225 int vc_tts_unset_streaming_cb(void);
228 * @brief Sets TTS utterance status callback function.
231 * @param[in] callback The callback function
232 * @param[in] user_data The user data to be passed to the callback function
234 * @return 0 on success, otherwise a negative error value
235 * @retval #VC_ERROR_NONE Successful
236 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
237 * @retval #VC_ERROR_INVALID_STATE Invalid state
238 * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
239 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
241 * @pre The state should be #VC_STATE_INITIALIZED.
243 int vc_tts_set_utterance_status_cb(vc_tts_utterance_status_cb callback, void* user_data);
246 * @brief Unsets TTS utterance status callback function.
249 * @return 0 on success, otherwise a negative error value
250 * @retval #VC_ERROR_NONE Successful
251 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
252 * @retval #VC_ERROR_INVALID_STATE Invalid state
253 * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
254 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
256 * @pre The state should be #VC_STATE_INITIALIZED.
258 int vc_tts_unset_utterance_status_cb(void);
269 #endif /* __VOICE_CONTROL_INTERNAL_H__ */