Allocate memory for output command list handle
[platform/core/uifw/voice-control.git] / include / voice_control.h
1 /**
2  * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17
18 #ifndef __VOICE_CONTROL_H__
19 #define __VOICE_CONTROL_H__
20
21
22 #include <voice_control_command.h>
23 #include <voice_control_common.h>
24
25
26 /**
27  * @addtogroup CAPI_UIX_VOICE_CONTROL_MODULE
28  * @{
29  */
30
31
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36
37
38 /**
39  * @file voice_control.h
40  * @brief This file contains the voice control client API and related callback definitions and enums.
41  */
42
43
44 /**
45  * @file voice_control_command.h
46  * @brief This file contains the command list and command API and related handle definitions and enums.
47  */
48
49
50 /**
51  * @file voice_control_common.h
52  * @brief This file contains the callback function definitions and enums.
53  */
54
55
56 /**
57  * @brief Definition for foreground command type.
58  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
59  */
60 #define VC_COMMAND_TYPE_FOREGROUND      1
61
62
63 /**
64  * @brief Definition for background command type.
65  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
66  */
67 #define VC_COMMAND_TYPE_BACKGROUND      2
68
69
70 /**
71  * @brief Definition for ended dialog.
72  * @since_tizen 3.0
73  */
74 #define VC_DIALOG_END           0
75
76
77 /**
78  * @brief Definition for continued dialog.
79  * @since_tizen 3.0
80  */
81 #define VC_DIALOG_CONTINUE      1
82
83
84 /**
85  * @brief Initializes voice control.
86  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
87  * @privlevel public
88  * @privilege %http://tizen.org/privilege/recorder
89  * @remarks If the function succeeds, vc must be released with vc_deinitialize().
90  * @return @c 0 on success,
91  *         otherwise a negative error value
92  * @retval #VC_ERROR_NONE Successful
93  * @retval #VC_ERROR_OUT_OF_MEMORY Out of memory
94  * @retval #VC_ERROR_OPERATION_FAILED Operation failure
95  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
96  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
97  * @post If this function is called, the state will be #VC_STATE_INITIALIZED.
98  * @see vc_deinitialize()
99  */
100 int vc_initialize(void);
101
102
103 /**
104  * @brief Deinitializes voice control.
105  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
106  * @privlevel public
107  * @privilege %http://tizen.org/privilege/recorder
108  * @return @c 0 on success,
109  *         otherwise a negative error value
110  * @retval #VC_ERROR_NONE Successful
111  * @retval #VC_ERROR_INVALID_STATE Invalid state
112  * @retval #VC_ERROR_OPERATION_FAILED Operation failure
113  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
114  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
115  * @see vc_initialize()
116  */
117 int vc_deinitialize(void);
118
119
120 /**
121  * @brief Connects the voice control service.
122  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
123  * @privlevel public
124  * @privilege %http://tizen.org/privilege/recorder
125  * @return @c 0 on success,
126  *         otherwise a negative error value
127  * @retval #VC_ERROR_NONE Successful
128  * @retval #VC_ERROR_INVALID_STATE Invalid state
129  * @retval #VC_ERROR_OPERATION_FAILED Operation failure
130  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
131  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
132  * @pre The state should be #VC_STATE_INITIALIZED.
133  * @post If this function is called, the state will be #VC_STATE_READY.
134  * @see vc_unprepare()
135  */
136 int vc_prepare(void);
137
138
139 /**
140  * @brief Disconnects the voice control service.
141  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
142  * @privlevel public
143  * @privilege %http://tizen.org/privilege/recorder
144  * @return @c 0 on success,
145  *         otherwise a negative error value
146  * @retval #VC_ERROR_NONE Successful
147  * @retval #VC_ERROR_INVALID_STATE Invalid state
148  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
149  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
150  * @pre The state should be #VC_STATE_READY.
151  * @post If this function is called, the state will be #VC_STATE_INITIALIZED.
152  * @see vc_prepare()
153  */
154 int vc_unprepare(void);
155
156
157 /**
158  * @brief Retrieves all supported languages using callback function.
159  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
160  * @privlevel public
161  * @privilege %http://tizen.org/privilege/recorder
162  * @param[in] callback Callback function to invoke
163  * @param[in] user_data The user data to be passed to the callback function
164  * @return @c 0 on success,
165  *         otherwise a negative error value
166  * @retval #VC_ERROR_NONE Successful
167  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
168  * @retval #VC_ERROR_OPERATION_FAILED Operation failure
169  * @retval #VC_ERROR_INVALID_STATE Invalid state
170  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
171  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
172  * @pre The state should be #VC_STATE_INITIALIZED or #VC_STATE_READY.
173  * @post This function invokes vc_supported_language_cb() repeatedly for getting languages.
174  * @see vc_supported_language_cb()
175  * @see vc_get_current_language()
176  */
177 int vc_foreach_supported_languages(vc_supported_language_cb callback, void* user_data);
178
179
180 /**
181  * @brief Gets current language.
182  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
183  * @privlevel public
184  * @privilege %http://tizen.org/privilege/recorder
185  * @remarks If the function succeeds, @a language must be released with free() by you when you no longer need it.
186  * @param[out] language A language is specified as an ISO 3166 alpha-2 two letter country-code
187  *                      followed by ISO 639-1 for the two-letter language code.
188  *                      For example, "ko_KR" for Korean, "en_US" for American English
189  * @return @c 0 on success,
190  *         otherwise a negative error value
191  * @retval #VC_ERROR_NONE Successful
192  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
193  * @retval #VC_ERROR_OUT_OF_MEMORY Out of memory
194  * @retval #VC_ERROR_OPERATION_FAILED Operation failure
195  * @retval #VC_ERROR_INVALID_STATE Invalid state
196  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
197  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
198  * @pre The state should be #VC_STATE_INITIALIZED or #VC_STATE_READY.
199  * @see vc_foreach_supported_languages()
200  */
201 int vc_get_current_language(char** language);
202
203
204 /**
205  * @brief Gets current state of voice control client.
206  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
207  * @privlevel public
208  * @privilege %http://tizen.org/privilege/recorder
209  * @param[out] state The current state
210  * @return @c 0 on success,
211  *         otherwise a negative error value
212  * @retval #VC_ERROR_NONE Successful
213  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
214  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
215  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
216  * @see vc_state_changed_cb()
217  * @see vc_set_state_changed_cb()
218  */
219 int vc_get_state(vc_state_e* state);
220
221
222 /**
223  * @brief Gets current state of voice control service.
224  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
225  * @privlevel public
226  * @privilege %http://tizen.org/privilege/recorder
227  * @param[out] state The current state
228  * @return @c 0 on success,
229  *         otherwise a negative error value
230  * @retval #VC_ERROR_NONE Successful
231  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
232  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
233  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
234  * @pre The state should be #VC_STATE_READY.
235  * @see vc_set_service_state_changed_cb()
236  * @see vc_unset_service_state_changed_cb()
237  */
238 int vc_get_service_state(vc_service_state_e* state);
239
240
241 /**
242  * @brief Gets the system command list.
243  * @since_tizen 3.0
244  * @privlevel public
245  * @privilege %http://tizen.org/privilege/recorder
246  * @remarks In the system command list, there are system commands predefined by product manufacturers. Those commands have the highest priority.
247  *          Therefore, the user can not set any commands same with the system commands.
248  *          The @a vc_sys_cmd_list must be released using vc_cmd_list_destroy() when it is no longer required.
249  * @param[out] vc_sys_cmd_list System command list handle
250  * @return @c 0 on success,
251  *         otherwise a negative error value
252  * @retval #VC_ERROR_NONE Successful
253  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
254  * @retval #VC_ERROR_INVALID_STATE Invalid state
255  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
256  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
257  * @pre The service state should be #VC_SERVICE_STATE_READY.
258  * @see vc_cmd_list_destroy()
259  */
260 int vc_get_system_command_list(vc_cmd_list_h* vc_sys_cmd_list);
261
262
263 /**
264  * @brief Sets the invocation name.
265  * @since_tizen 3.0
266  * @privlevel public
267  * @privilege %http://tizen.org/privilege/recorder
268  * @remarks Invocation name is used to activate background commands. The invocation name can be the same as the application name or any other phrase.
269  *          For example, an application "Tizen Sample" has a background command, "Play music", and the invocation name of the application is set to "Tizen Sample".
270  *          In order to activate the background command, users can say "Tizen Sample, Play music".
271  *          The invocation name is dependent on the current language. For example, if the current language is "en_US"(English), the invocation name is also "en_US".
272  *          If the current language is "ja_JP"(Japanese) and the invocation name is "en_US", the invocation name will not be recognized.
273  *          This function should be called before vc_set_command_list().
274  * @param[in] name Invocation name that an application wants to be invoked by
275  * @return @c 0 on success,
276  *         otherwise a negative error value
277  * @retval #VC_ERROR_NONE Successful
278  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
279  * @retval #VC_ERROR_INVALID_STATE Invalid state
280  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
281  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
282  * @pre The state should be #VC_STATE_READY.
283  * @see vc_set_command_list()
284  */
285 int vc_set_invocation_name(const char* name);
286
287
288 /**
289  * @brief Requests to set app id which is to want to ask the server dialogue.
290  * @details Using this function, the developer can request registering the application on vc framework.
291  *          If developer requests to register @a app_id with @a credential which is valid, the application will be set on vc framework.
292  *          and then, when the developer requests the dialogue using vc_request_dialog(), dialog from specific engine server will be played by vc framework.
293  * @since_tizen 5.0
294  * @privlevel public
295  * @privilege %http://tizen.org/privilege/recorder
296  * @param[in] app_id App id which is to want to ask server dialog.
297  * @param[in] credential Credential key.
298  * @return @c 0 on success,
299  *         otherwise a negative error value
300  * @retval #VC_ERROR_NONE Successful
301  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
302  * @retval #VC_ERROR_INVALID_STATE Invalid state
303  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
304  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
305  * @pre The service state should be #VC_SERVICE_STATE_READY.
306  * @see vc_unset_server_dialog()
307  */
308 int vc_set_server_dialog(const char* app_id, const char* credential);
309
310
311 /**
312  * @brief Requests to unset app id which is to not want to ask the server dialogue.
313  * @details Using this function, the developer can disable function to ask dialog based on server.
314  * @since_tizen 5.0
315  * @privlevel public
316  * @privilege %http://tizen.org/privilege/recorder
317  * @param[in] app_id App id which is to not want to ask server dialog.
318  * @return @c 0 on success,
319  *         otherwise a negative error value
320  * @retval #VC_ERROR_NONE Successful
321  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
322  * @retval #VC_ERROR_INVALID_STATE Invalid state
323  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
324  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
325  * @pre The service state should be #VC_SERVICE_STATE_READY.
326  * @see vc_set_server_dialog()
327  */
328 int vc_unset_server_dialog(const char* app_id);
329
330
331 /**
332  * @brief Requests to start the dialogue.
333  * @details Using this function, the developer can request starting the dialogue to the framework.
334  *          When the developer requests the dialogue, two types of texts, @a disp_text and @a utt_text, can be sent by this function.
335  *          @a disp_text is a text for displaying, and @a utt_text is that for uttering.
336  *          For example, if @a disp_text is "October 10th" and @a utt_text is "Today is October 10th.", "October 10th" will be displayed on the screen and "Today is October 10th." will be spoken.
337  *          Also, the developer can set whether the dialogue starts automatically or not, using @a auto_start.
338  *          If the developer sets @a auto_start as @c true, the framework will start to record next speech and continue the dialogue.
339  * @since_tizen 3.0
340  * @privlevel public
341  * @privilege %http://tizen.org/privilege/recorder
342  * @remarks If @a auto_start is @c true, the recognition will start again. In this case, it can be restarted up to 4 times.
343  * @param[in] disp_text Text to be displayed on the screen
344  * @param[in] utt_text Text to be spoken
345  * @param[in] auto_start A variable for setting whether the dialog session will be restarted automatically or not
346  * @return @c 0 on success,
347  *         otherwise a negative error value
348  * @retval #VC_ERROR_NONE Successful
349  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
350  * @retval #VC_ERROR_INVALID_STATE Invalid state
351  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
352  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
353  * @pre The service state should be #VC_SERVICE_STATE_READY.
354  */
355 int vc_request_dialog(const char* disp_text, const char* utt_text, bool auto_start);
356
357
358 /**
359  * @brief Sets command list.
360  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
361  * @privlevel public
362  * @privilege %http://tizen.org/privilege/recorder
363  * @remarks The command type is valid for #VC_COMMAND_TYPE_FOREGROUND or #VC_COMMAND_TYPE_BACKGROUND.
364  *          The matched commands of command list should be set and they should include type and command text at least.
365  * @param[in] vc_cmd_list Command list handle
366  * @param[in] type Command type
367  * @return @c 0 on success,
368  *         otherwise a negative error value
369  * @retval #VC_ERROR_NONE Successful
370  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
371  * @retval #VC_ERROR_INVALID_STATE Invalid state
372  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
373  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
374  * @pre The state should be #VC_STATE_READY.
375  * @see vc_unset_command_list()
376  */
377 int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type);
378
379
380 /**
381  * @brief Unsets command list.
382  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
383  * @privlevel public
384  * @privilege %http://tizen.org/privilege/recorder
385  * @param[in] type Command type
386  * @return @c 0 on success,
387  *         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
391  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
392  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
393  * @pre The state should be #VC_STATE_READY.
394  * @see vc_set_command_list()
395  */
396 int vc_unset_command_list(int type);
397
398
399 /**
400  * @brief Gets the recognition result.
401  * @since_tizen 3.0
402  * @privlevel public
403  * @privilege %http://tizen.org/privilege/recorder
404  * @param[in] callback Callback function to get recognition result
405  * @param[in] user_data The user data to be passed to the callback function
406  * @return @c 0 on success,
407  *         otherwise a negative error value
408  * @retval #VC_ERROR_NONE Successful
409  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
410  * @retval #VC_ERROR_INVALID_STATE Invalid state
411  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
412  * @pre The state should be #VC_STATE_READY.
413  * @see vc_result_cb()
414  */
415 int vc_get_result(vc_result_cb callback, void* user_data);
416
417
418 /**
419  * @brief Registers a callback function for getting recognition result.
420  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
421  * @privlevel public
422  * @privilege %http://tizen.org/privilege/recorder
423  * @param[in] callback Callback function to register
424  * @param[in] user_data The user data to be passed to the callback function
425  * @return @c 0 on success,
426  *         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_PERMISSION_DENIED Permission denied
431  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
432  * @pre The state should be #VC_STATE_INITIALIZED.
433  * @see vc_result_cb()
434  * @see vc_unset_result_cb()
435  */
436 int vc_set_result_cb(vc_result_cb callback, void* user_data);
437
438
439 /**
440  * @brief Unregisters the callback function.
441  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
442  * @privlevel public
443  * @privilege %http://tizen.org/privilege/recorder
444  * @return @c 0 on success,
445  *         otherwise a negative error value
446  * @retval #VC_ERROR_NONE Successful
447  * @retval #VC_ERROR_INVALID_STATE Invalid state
448  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
449  * @pre The state should be #VC_STATE_INITIALIZED.
450  * @see vc_set_result_cb()
451  */
452 int vc_unset_result_cb(void);
453
454
455 /**
456  * @brief Registers a callback function to be called when state is changed.
457  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
458  * @privlevel public
459  * @privilege %http://tizen.org/privilege/recorder
460  * @param[in] callback Callback function to register
461  * @param[in] user_data The user data to be passed to the callback function
462  * @return @c 0 on success,
463  *         otherwise a negative error value
464  * @retval #VC_ERROR_NONE Successful
465  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
466  * @retval #VC_ERROR_INVALID_STATE Invalid state
467  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
468  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
469  * @pre The state should be #VC_STATE_INITIALIZED.
470  * @see vc_service_state_changed_cb()
471  * @see vc_unset_service_state_changed_cb()
472  */
473 int vc_set_service_state_changed_cb(vc_service_state_changed_cb callback, void* user_data);
474
475
476 /**
477  * @brief Unregisters the callback function.
478  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
479  * @privlevel public
480  * @privilege %http://tizen.org/privilege/recorder
481  * @return @c 0 on success,
482  *         otherwise a negative error value
483  * @retval #VC_ERROR_NONE Successful
484  * @retval #VC_ERROR_INVALID_STATE Invalid state
485  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
486  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
487  * @pre The state should be #VC_STATE_INITIALIZED.
488  * @see vc_set_service_state_changed_cb()
489  */
490 int vc_unset_service_state_changed_cb(void);
491
492
493 /**
494  * @brief Registers a callback function to be called when state is changed.
495  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
496  * @privlevel public
497  * @privilege %http://tizen.org/privilege/recorder
498  * @param[in] callback Callback function to register
499  * @param[in] user_data The user data to be passed to the callback function
500  * @return @c 0 on success,
501  *         otherwise a negative error value
502  * @retval #VC_ERROR_NONE Successful
503  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
504  * @retval #VC_ERROR_INVALID_STATE Invalid state
505  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
506  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
507  * @pre The state should be #VC_STATE_INITIALIZED.
508  * @see vc_state_changed_cb()
509  * @see vc_unset_state_changed_cb()
510  */
511 int vc_set_state_changed_cb(vc_state_changed_cb callback, void* user_data);
512
513
514 /**
515  * @brief Unregisters the callback function.
516  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
517  * @privlevel public
518  * @privilege %http://tizen.org/privilege/recorder
519  * @return @c 0 on success,
520  *         otherwise a negative error value
521  * @retval #VC_ERROR_NONE Successful
522  * @retval #VC_ERROR_INVALID_STATE Invalid state
523  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
524  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
525  * @pre The state should be #VC_STATE_INITIALIZED.
526  * @see vc_set_state_changed_cb()
527  */
528 int vc_unset_state_changed_cb(void);
529
530
531 /**
532  * @brief Registers a callback function to be called when current language is changed.
533  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
534  * @privlevel public
535  * @privilege %http://tizen.org/privilege/recorder
536  * @param[in] callback Callback function to register
537  * @param[in] user_data The user data to be passed to the callback function
538  * @return @c 0 on success,
539  *         otherwise a negative error value
540  * @retval #VC_ERROR_NONE Successful
541  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
542  * @retval #VC_ERROR_INVALID_STATE Invalid state
543  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
544  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
545  * @pre The state should be #VC_STATE_INITIALIZED.
546  * @see vc_current_language_changed_cb()
547  * @see vc_unset_current_language_changed_cb()
548  */
549 int vc_set_current_language_changed_cb(vc_current_language_changed_cb callback, void* user_data);
550
551
552 /**
553  * @brief Unregisters the callback function.
554  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
555  * @privlevel public
556  * @privilege %http://tizen.org/privilege/recorder
557  * @return @c 0 on success,
558  *         otherwise a negative error value
559  * @retval #VC_ERROR_NONE Successful
560  * @retval #VC_ERROR_INVALID_STATE Invalid state
561  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
562  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
563  * @pre The state should be #VC_STATE_INITIALIZED.
564  * @see vc_set_current_language_changed_cb()
565  */
566 int vc_unset_current_language_changed_cb(void);
567
568
569 /**
570  * @brief Registers a callback function to be called when an error occurred.
571  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
572  * @privlevel public
573  * @privilege %http://tizen.org/privilege/recorder
574  * @param[in] callback Callback function to register
575  * @param[in] user_data The user data to be passed to the callback function
576  * @return @c 0 on success,
577  *         otherwise a negative error value
578  * @retval #VC_ERROR_NONE Successful
579  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
580  * @retval #VC_ERROR_INVALID_STATE Invalid state
581  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
582  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
583  * @pre The state should be #VC_STATE_INITIALIZED.
584  * @see vc_error_cb()
585  * @see vc_unset_error_cb()
586  */
587 int vc_set_error_cb(vc_error_cb callback, void* user_data);
588
589
590 /**
591  * @brief Unregisters the callback function.
592  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
593  * @privlevel public
594  * @privilege %http://tizen.org/privilege/recorder
595  * @return @c 0 on success,
596  *         otherwise a negative error value
597  * @retval #VC_ERROR_NONE Successful
598  * @retval #VC_ERROR_INVALID_STATE Invalid state
599  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
600  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
601  * @pre The state should be #VC_STATE_INITIALIZED.
602  * @see vc_set_error_cb()
603  */
604 int vc_unset_error_cb(void);
605
606
607 /**
608  * @partner
609  * @brief Requests to send TTS streaming data, asynchronously.
610  * @details Using this function, the developer can request text to speech to the framework.
611  *          When the developer requests the TTS with @a language, VC engine will send PCM data which is synthesized using VC engine's own persona.
612  *          If @a to_vc_manager is true, the synthesized PCM data will be delivered to the VC manager, otherwise it will be delivered to the VC client
613  *          For example, if @a text is "Alarm is set as 7 PM" and @a to_vc_manager is true, the PCM data corresponding "Alarm is set as 7 PM" will be delivered to VC manager client,
614  *          and then it will be spoken in VC manager. If @a to_vc_manager is false, you will receive PCM data through the vc_tts_streaming_cb() callback function if it was set using vc_tts_set_streaming_cb().
615  *          This function is executed asynchronously, so if there is an error while synthesizing, vc_error_cb() will be called.
616  * @since_tizen 5.5
617  * @privlevel partner
618  * @privilege %http://tizen.org/privilege/voicecontrol.tts
619  * @param[in] text The text to be requested for TTS
620  * @param[in] language The language is specified as an ISO 3166 alpha-2 two-letter country code
621  *                     followed by ISO 639-1 for the two-letter language code.
622  *                     For example, "ko_KR" for Korean, "en_US" for American English
623  * @param[in] to_vc_manager The value for selection between VC client and VC manager\n
624  *                          If @c true, the synthesized PCM data will be delivered to the VC manager, otherwise it will be delivered to the VC client
625  * @param[out] utt_id The utterance id
626  * @return @c 0 on success,
627  *         otherwise a negative error value
628  * @retval #VC_ERROR_NONE Successful
629  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
630  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
631  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
632  * @retval #VC_ERROR_INVALID_STATE Invalid state
633  * @retval #VC_ERROR_OPERATION_FAILED Operation failure
634  * @pre The state should be #VC_STATE_READY.
635  * @see vc_tts_cancel()
636  */
637 int vc_tts_request(const char* text, const char* language, bool to_vc_manager, int* utt_id);
638
639
640 /**
641  * @partner
642  * @brief Requests to cancel TTS streaming data.
643  * @since_tizen 5.5
644  * @privlevel partner
645  * @privilege %http://tizen.org/privilege/voicecontrol.tts
646  * @param[in] utt_id The utterance id
647  * @return @c 0 on success,
648  *         otherwise a negative error value
649  * @retval #VC_ERROR_NONE Successful
650  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
651  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
652  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
653  * @retval #VC_ERROR_INVALID_STATE Invalid state
654  * @pre The state should be #VC_STATE_READY.
655  * @see vc_tts_request()
656  */
657 int vc_tts_cancel(int utt_id);
658
659
660 /**
661  * @partner
662  * @brief Gets the TTS audio details.
663  * @details Using this function, the developer can get details of synthesized audio data which is requested by vc_tts_request() function.
664  * @since_tizen 5.5
665  * @privlevel partner
666  * @privilege %http://tizen.org/privilege/voicecontrol.tts
667  * @param[out] rate The audio sampling rate
668  * @param[out] channel The audio channel
669  * @param[out] audio_type The audio type
670  * @return @c 0 on success,
671  *         otherwise a negative error value
672  * @retval #VC_ERROR_NONE Successful
673  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
674  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
675  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
676  * @retval #VC_ERROR_INVALID_STATE Invalid state
677  * @pre The state should be #VC_STATE_READY.
678  */
679 int vc_tts_get_synthesized_audio_details(int* rate, vc_audio_channel_e* channel, vc_audio_type_e* audio_type);
680
681
682 /**
683  * @partner
684  * @brief Sets the TTS streaming callback function.
685  * @since_tizen 5.5
686  * @privlevel partner
687  * @privilege %http://tizen.org/privilege/voicecontrol.tts
688  * @param[in] callback The callback function
689  * @param[in] user_data The user data to be passed to the callback function
690  * @return @c 0 on success,
691  *         otherwise a negative error value
692  * @retval #VC_ERROR_NONE Successful
693  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
694  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
695  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
696  * @retval #VC_ERROR_INVALID_STATE Invalid state
697  * @pre The state should be #VC_STATE_INITIALIZED.
698  */
699 int vc_tts_set_streaming_cb(vc_tts_streaming_cb callback, void* user_data);
700
701
702 /**
703  * @partner
704  * @brief Unsets the TTS streaming callback function.
705  * @since_tizen 5.5
706  * @privlevel partner
707  * @privilege %http://tizen.org/privilege/voicecontrol.tts
708  * @return @c 0 on success,
709  *         otherwise a negative error value
710  * @retval #VC_ERROR_NONE Successful
711  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
712  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
713  * @retval #VC_ERROR_INVALID_STATE Invalid state
714  * @pre The state should be #VC_STATE_INITIALIZED.
715  */
716 int vc_tts_unset_streaming_cb(void);
717
718
719 /**
720  * @partner
721  * @brief Sets the TTS utterance status callback function.
722  * @details Using this function, the developer can set the utterance status callback to be called
723  *          when the VC manager client starts or stops playing TTS PCM data which was requested to be synthesized with the vc_tts_request() function.
724  *          This function is called when @a to_vc_manager in the vc_tts_request() function call is @c true.
725  * @since_tizen 5.5
726  * @privlevel partner
727  * @privilege %http://tizen.org/privilege/voicecontrol.tts
728  * @param[in] callback The callback function
729  * @param[in] user_data The user data to be passed to the callback function
730  * @return @c 0 on success,
731  *         otherwise a negative error value
732  * @retval #VC_ERROR_NONE Successful
733  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
734  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
735  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
736  * @retval #VC_ERROR_INVALID_STATE Invalid state
737  * @retval #VC_ERROR_OPERATION_FAILED Operation failure
738  * @pre The state should be #VC_STATE_INITIALIZED.
739  */
740 int vc_tts_set_utterance_status_cb(vc_tts_utterance_status_cb callback, void* user_data);
741
742
743 /**
744  * @partner
745  * @brief Unsets the TTS utterance status callback function.
746  * @since_tizen 5.5
747  * @privlevel partner
748  * @privilege %http://tizen.org/privilege/voicecontrol.tts
749  * @return @c 0 on success,
750  *         otherwise a negative error value
751  * @retval #VC_ERROR_NONE Successful
752  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
753  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
754  * @retval #VC_ERROR_INVALID_STATE Invalid state
755  * @pre The state should be #VC_STATE_INITIALIZED.
756  */
757 int vc_tts_unset_utterance_status_cb(void);
758
759
760 #ifdef __cplusplus
761 }
762 #endif
763
764 /**
765  * @}
766  */
767
768 #endif /* __VOICE_CONTROL_H__ */