Merge "Fix line coverage script" into tizen
[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_request_start()
236  * @see vc_request_stop()
237  * @see vc_request_cancel()
238  * @see vc_set_service_state_changed_cb()
239  * @see vc_unset_service_state_changed_cb()
240  */
241 int vc_get_service_state(vc_service_state_e* state);
242
243
244 /**
245  * @brief Gets the system command list.
246  * @since_tizen 3.0
247  * @privlevel public
248  * @privilege %http://tizen.org/privilege/recorder
249  * @remarks In the system command list, there are system commands predefined by product manufacturers. Those commands have the highest priority.
250  *          Therefore, the user can not set any commands same with the system commands.
251  *          The @a vc_sys_cmd_list must be released using free() when it is no longer required.
252  * @param[out] vc_sys_cmd_list System command list handle
253  * @return @c 0 on success,
254  *         otherwise a negative error value
255  * @retval #VC_ERROR_NONE Successful
256  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
257  * @retval #VC_ERROR_INVALID_STATE Invalid state
258  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
259  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
260  * @pre The service state should be #VC_SERVICE_STATE_READY.
261  * @see vc_unset_command_list()
262  */
263 int vc_get_system_command_list(vc_cmd_list_h* vc_sys_cmd_list);
264
265
266 /**
267  * @brief Sets the invocation name.
268  * @since_tizen 3.0
269  * @privlevel public
270  * @privilege %http://tizen.org/privilege/recorder
271  * @remarks Invocation name is used to activate background commands. The invocation name can be the same as the application name or any other phrase.
272  *          For example, an application "Tizen Sample" has a background command, "Play music", and the invocation name of the application is set to "Tizen Sample".
273  *          In order to activate the background command, users can say "Tizen Sample, Play music".
274  *          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".
275  *          If the current language is "ja_JP"(Japanese) and the invocation name is "en_US", the invocation name will not be recognized.
276  *          This function should be called before vc_set_command_list().
277  * @param[in] name Invocation name that an application wants to be invoked by
278  * @return @c 0 on success,
279  *         otherwise a negative error value
280  * @retval #VC_ERROR_NONE Successful
281  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
282  * @retval #VC_ERROR_INVALID_STATE Invalid state
283  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
284  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
285  * @pre The state should be #VC_STATE_READY.
286  * @see vc_set_command_list()
287  */
288 int vc_set_invocation_name(const char* name);
289
290
291 /**
292  * @brief Requests to set app id which is to want to ask the server dialogue.
293  * @details Using this function, the developer can request registering the application on vc framework.
294  *          If developer requests to register @a app_id with @a credential which is valid, the application will be set on vc framework.
295  *          and then, when the developer requests the dialogue using vc_request_dialog(), dialog from specific engine server will be played by vc framework.
296  * @since_tizen 5.0
297  * @privlevel public
298  * @privilege %http://tizen.org/privilege/recorder
299  * @param[in] app_id App id which is to want to ask server dialog.
300  * @param[in] credential Credential key.
301  * @return @c 0 on success,
302  *         otherwise a negative error value
303  * @retval #VC_ERROR_NONE Successful
304  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
305  * @retval #VC_ERROR_INVALID_STATE Invalid state
306  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
307  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
308  * @pre The service state should be #VC_SERVICE_STATE_READY.
309  * @see vc_unset_server_dialog()
310  */
311 int vc_set_server_dialog(const char* app_id, const char* credential);
312
313
314 /**
315  * @brief Requests to unset app id which is to not want to ask the server dialogue.
316  * @details Using this function, the developer can disable function to ask dialog based on server.
317  * @since_tizen 5.0
318  * @privlevel public
319  * @privilege %http://tizen.org/privilege/recorder
320  * @param[in] app_id App id which is to not want to ask server dialog.
321  * @return @c 0 on success,
322  *         otherwise a negative error value
323  * @retval #VC_ERROR_NONE Successful
324  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
325  * @retval #VC_ERROR_INVALID_STATE Invalid state
326  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
327  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
328  * @pre The service state should be #VC_SERVICE_STATE_READY.
329  * @see vc_set_server_dialog()
330  */
331 int vc_unset_server_dialog(const char* app_id);
332
333
334 /**
335  * @brief Requests to start the dialogue.
336  * @details Using this function, the developer can request starting the dialogue to the framework.
337  *          When the developer requests the dialogue, two types of texts, @a disp_text and @a utt_text, can be sent by this function.
338  *          @a disp_text is a text for displaying, and @a utt_text is that for uttering.
339  *          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.
340  *          Also, the developer can set whether the dialogue starts automatically or not, using @a auto_start.
341  *          If the developer sets @a auto_start as @c true, the framework will start to record next speech and continue the dialogue.
342  * @since_tizen 3.0
343  * @privlevel public
344  * @privilege %http://tizen.org/privilege/recorder
345  * @remarks If @a auto_start is @c true, the recognition will start again. In this case, it can be restarted up to 4 times.
346  * @param[in] disp_text Text to be displayed on the screen
347  * @param[in] utt_text Text to be spoken
348  * @param[in] auto_start A variable for setting whether the dialog session will be restarted automatically or not
349  * @return @c 0 on success,
350  *         otherwise a negative error value
351  * @retval #VC_ERROR_NONE Successful
352  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
353  * @retval #VC_ERROR_INVALID_STATE Invalid state
354  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
355  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
356  * @pre The service state should be #VC_SERVICE_STATE_READY.
357  */
358 int vc_request_dialog(const char* disp_text, const char* utt_text, bool auto_start);
359
360
361 /**
362  * @brief Sets command list.
363  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
364  * @privlevel public
365  * @privilege %http://tizen.org/privilege/recorder
366  * @remarks The command type is valid for #VC_COMMAND_TYPE_FOREGROUND or #VC_COMMAND_TYPE_BACKGROUND.
367  *          The matched commands of command list should be set and they should include type and command text at least.
368  * @param[in] vc_cmd_list Command list handle
369  * @param[in] type Command type
370  * @return @c 0 on success,
371  *         otherwise a negative error value
372  * @retval #VC_ERROR_NONE Successful
373  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
374  * @retval #VC_ERROR_INVALID_STATE Invalid state
375  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
376  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
377  * @pre The state should be #VC_STATE_READY.
378  * @see vc_unset_command_list()
379  */
380 int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type);
381
382
383 /**
384  * @brief Unsets command list.
385  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
386  * @privlevel public
387  * @privilege %http://tizen.org/privilege/recorder
388  * @param[in] type Command type
389  * @return @c 0 on success,
390  *         otherwise a negative error value
391  * @retval #VC_ERROR_NONE Successful
392  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
393  * @retval #VC_ERROR_INVALID_STATE Invalid state
394  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
395  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
396  * @pre The state should be #VC_STATE_READY.
397  * @see vc_set_command_list()
398  */
399 int vc_unset_command_list(int type);
400
401
402 /**
403  * @brief Gets the recognition result.
404  * @since_tizen 3.0
405  * @privlevel public
406  * @privilege %http://tizen.org/privilege/recorder
407  * @param[in] callback Callback function to get recognition result
408  * @param[in] user_data The user data to be passed to the callback function
409  * @return @c 0 on success,
410  *         otherwise a negative error value
411  * @retval #VC_ERROR_NONE Successful
412  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
413  * @retval #VC_ERROR_INVALID_STATE Invalid state
414  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
415  * @pre The state should be #VC_STATE_READY.
416  * @see vc_result_cb()
417  */
418 int vc_get_result(vc_result_cb callback, void* user_data);
419
420
421 /**
422  * @brief Registers a callback function for getting recognition result.
423  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
424  * @privlevel public
425  * @privilege %http://tizen.org/privilege/recorder
426  * @param[in] callback Callback function to register
427  * @param[in] user_data The user data to be passed to the callback function
428  * @return @c 0 on success,
429  *         otherwise a negative error value
430  * @retval #VC_ERROR_NONE Successful
431  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
432  * @retval #VC_ERROR_INVALID_STATE Invalid state
433  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
434  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
435  * @pre The state should be #VC_STATE_INITIALIZED.
436  * @see vc_result_cb()
437  * @see vc_unset_result_cb()
438  */
439 int vc_set_result_cb(vc_result_cb callback, void* user_data);
440
441
442 /**
443  * @brief Unregisters the callback function.
444  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
445  * @privlevel public
446  * @privilege %http://tizen.org/privilege/recorder
447  * @return @c 0 on success,
448  *         otherwise a negative error value
449  * @retval #VC_ERROR_NONE Successful
450  * @retval #VC_ERROR_INVALID_STATE Invalid state
451  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
452  * @pre The state should be #VC_STATE_INITIALIZED.
453  * @see vc_set_result_cb()
454  */
455 int vc_unset_result_cb(void);
456
457
458 /**
459  * @brief Registers a callback function to be called when state is changed.
460  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
461  * @privlevel public
462  * @privilege %http://tizen.org/privilege/recorder
463  * @param[in] callback Callback function to register
464  * @param[in] user_data The user data to be passed to the callback function
465  * @return @c 0 on success,
466  *         otherwise a negative error value
467  * @retval #VC_ERROR_NONE Successful
468  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
469  * @retval #VC_ERROR_INVALID_STATE Invalid state
470  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
471  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
472  * @pre The state should be #VC_STATE_INITIALIZED.
473  * @see vc_service_state_changed_cb()
474  * @see vc_unset_service_state_changed_cb()
475  */
476 int vc_set_service_state_changed_cb(vc_service_state_changed_cb callback, void* user_data);
477
478
479 /**
480  * @brief Unregisters the callback function.
481  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
482  * @privlevel public
483  * @privilege %http://tizen.org/privilege/recorder
484  * @return @c 0 on success,
485  *         otherwise a negative error value
486  * @retval #VC_ERROR_NONE Successful
487  * @retval #VC_ERROR_INVALID_STATE Invalid state
488  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
489  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
490  * @pre The state should be #VC_STATE_INITIALIZED.
491  * @see vc_set_service_state_changed_cb()
492  */
493 int vc_unset_service_state_changed_cb(void);
494
495
496 /**
497  * @brief Registers a callback function to be called when state is changed.
498  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
499  * @privlevel public
500  * @privilege %http://tizen.org/privilege/recorder
501  * @param[in] callback Callback function to register
502  * @param[in] user_data The user data to be passed to the callback function
503  * @return @c 0 on success,
504  *         otherwise a negative error value
505  * @retval #VC_ERROR_NONE Successful
506  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
507  * @retval #VC_ERROR_INVALID_STATE Invalid state
508  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
509  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
510  * @pre The state should be #VC_STATE_INITIALIZED.
511  * @see vc_state_changed_cb()
512  * @see vc_unset_state_changed_cb()
513  */
514 int vc_set_state_changed_cb(vc_state_changed_cb callback, void* user_data);
515
516
517 /**
518  * @brief Unregisters the callback function.
519  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
520  * @privlevel public
521  * @privilege %http://tizen.org/privilege/recorder
522  * @return @c 0 on success,
523  *         otherwise a negative error value
524  * @retval #VC_ERROR_NONE Successful
525  * @retval #VC_ERROR_INVALID_STATE Invalid state
526  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
527  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
528  * @pre The state should be #VC_STATE_INITIALIZED.
529  * @see vc_set_state_changed_cb()
530  */
531 int vc_unset_state_changed_cb(void);
532
533
534 /**
535  * @brief Registers a callback function to be called when current language is changed.
536  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
537  * @privlevel public
538  * @privilege %http://tizen.org/privilege/recorder
539  * @param[in] callback Callback function to register
540  * @param[in] user_data The user data to be passed to the callback function
541  * @return @c 0 on success,
542  *         otherwise a negative error value
543  * @retval #VC_ERROR_NONE Successful
544  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
545  * @retval #VC_ERROR_INVALID_STATE Invalid state
546  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
547  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
548  * @pre The state should be #VC_STATE_INITIALIZED.
549  * @see vc_current_language_changed_cb()
550  * @see vc_unset_current_language_changed_cb()
551  */
552 int vc_set_current_language_changed_cb(vc_current_language_changed_cb callback, void* user_data);
553
554
555 /**
556  * @brief Unregisters the callback function.
557  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
558  * @privlevel public
559  * @privilege %http://tizen.org/privilege/recorder
560  * @return @c 0 on success,
561  *         otherwise a negative error value
562  * @retval #VC_ERROR_NONE Successful
563  * @retval #VC_ERROR_INVALID_STATE Invalid state
564  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
565  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
566  * @pre The state should be #VC_STATE_INITIALIZED.
567  * @see vc_set_current_language_changed_cb()
568  */
569 int vc_unset_current_language_changed_cb(void);
570
571
572 /**
573  * @brief Registers a callback function to be called when an error occurred.
574  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
575  * @privlevel public
576  * @privilege %http://tizen.org/privilege/recorder
577  * @param[in] callback Callback function to register
578  * @param[in] user_data The user data to be passed to the callback function
579  * @return @c 0 on success,
580  *         otherwise a negative error value
581  * @retval #VC_ERROR_NONE Successful
582  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
583  * @retval #VC_ERROR_INVALID_STATE Invalid state
584  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
585  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
586  * @pre The state should be #VC_STATE_INITIALIZED.
587  * @see vc_error_cb()
588  * @see vc_unset_error_cb()
589  */
590 int vc_set_error_cb(vc_error_cb callback, void* user_data);
591
592
593 /**
594  * @brief Unregisters the callback function.
595  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
596  * @privlevel public
597  * @privilege %http://tizen.org/privilege/recorder
598  * @return @c 0 on success,
599  *         otherwise a negative error value
600  * @retval #VC_ERROR_NONE Successful
601  * @retval #VC_ERROR_INVALID_STATE Invalid state
602  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
603  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
604  * @pre The state should be #VC_STATE_INITIALIZED.
605  * @see vc_set_error_cb()
606  */
607 int vc_unset_error_cb(void);
608
609
610 /**
611  * @partner
612  * @brief Requests to send TTS streaming data, asynchronously.
613  * @details Using this function, the developer can request text to speech to the framework.
614  *          When the developer requests the TTS with @a language, VC engine will send PCM data which is synthesized using VC engine's own persona.
615  *          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
616  *          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,
617  *          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().
618  *          This function is executed asynchronously, so if there is an error while synthesizing, vc_error_cb() will be called.
619  * @since_tizen 5.5
620  * @privlevel partner
621  * @privilege %http://tizen.org/privilege/voicecontrol.tts
622  * @param[in] text The text to be requested for TTS
623  * @param[in] language The language is specified as an ISO 3166 alpha-2 two-letter country code
624  *                     followed by ISO 639-1 for the two-letter language code.
625  *                     For example, "ko_KR" for Korean, "en_US" for American English
626  * @param[in] to_vc_manager The value for selection between VC client and VC manager\n
627  *                          If @c true, the synthesized PCM data will be delivered to the VC manager, otherwise it will be delivered to the VC client
628  * @param[out] utt_id The utterance id
629  * @return @c 0 on success,
630  *         otherwise a negative error value
631  * @retval #VC_ERROR_NONE Successful
632  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
633  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
634  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
635  * @retval #VC_ERROR_INVALID_STATE Invalid state
636  * @retval #VC_ERROR_OPERATION_FAILED Operation failure
637  * @pre The state should be #VC_STATE_READY.
638  * @see vc_tts_cancel()
639  */
640 int vc_tts_request(const char* text, const char* language, bool to_vc_manager, int* utt_id);
641
642
643 /**
644  * @partner
645  * @brief Requests to cancel TTS streaming data.
646  * @since_tizen 5.5
647  * @privlevel partner
648  * @privilege %http://tizen.org/privilege/voicecontrol.tts
649  * @param[in] utt_id The utterance id
650  * @return @c 0 on success,
651  *         otherwise a negative error value
652  * @retval #VC_ERROR_NONE Successful
653  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
654  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
655  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
656  * @retval #VC_ERROR_INVALID_STATE Invalid state
657  * @pre The state should be #VC_STATE_READY.
658  * @see vc_tts_request()
659  */
660 int vc_tts_cancel(int utt_id);
661
662
663 /**
664  * @partner
665  * @brief Gets the TTS audio details.
666  * @details Using this function, the developer can get details of synthesized audio data which is requested by vc_tts_request() function.
667  * @since_tizen 5.5
668  * @privlevel partner
669  * @privilege %http://tizen.org/privilege/voicecontrol.tts
670  * @param[out] rate The audio sampling rate
671  * @param[out] channel The audio channel
672  * @param[out] audio_type The audio type
673  * @return @c 0 on success,
674  *         otherwise a negative error value
675  * @retval #VC_ERROR_NONE Successful
676  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
677  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
678  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
679  * @retval #VC_ERROR_INVALID_STATE Invalid state
680  * @pre The state should be #VC_STATE_READY.
681  */
682 int vc_tts_get_synthesized_audio_details(int* rate, vc_audio_channel_e* channel, vc_audio_type_e* audio_type);
683
684
685 /**
686  * @partner
687  * @brief Sets the TTS streaming callback function.
688  * @since_tizen 5.5
689  * @privlevel partner
690  * @privilege %http://tizen.org/privilege/voicecontrol.tts
691  * @param[in] callback The callback function
692  * @param[in] user_data The user data to be passed to the callback function
693  * @return @c 0 on success,
694  *         otherwise a negative error value
695  * @retval #VC_ERROR_NONE Successful
696  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
697  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
698  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
699  * @retval #VC_ERROR_INVALID_STATE Invalid state
700  * @pre The state should be #VC_STATE_INITIALIZED.
701  */
702 int vc_tts_set_streaming_cb(vc_tts_streaming_cb callback, void* user_data);
703
704
705 /**
706  * @partner
707  * @brief Unsets the TTS streaming callback function.
708  * @since_tizen 5.5
709  * @privlevel partner
710  * @privilege %http://tizen.org/privilege/voicecontrol.tts
711  * @return @c 0 on success,
712  *         otherwise a negative error value
713  * @retval #VC_ERROR_NONE Successful
714  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
715  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
716  * @retval #VC_ERROR_INVALID_STATE Invalid state
717  * @pre The state should be #VC_STATE_INITIALIZED.
718  */
719 int vc_tts_unset_streaming_cb(void);
720
721
722 /**
723  * @partner
724  * @brief Sets the TTS utterance status callback function.
725  * @details Using this function, the developer can set the utterance status callback to be called
726  *          when the VC manager client starts or stops playing TTS PCM data which was requested to be synthesized with the vc_tts_request() function.
727  *          This function is called when @a to_vc_manager in the vc_tts_request() function call is @c true.
728  * @since_tizen 5.5
729  * @privlevel partner
730  * @privilege %http://tizen.org/privilege/voicecontrol.tts
731  * @param[in] callback The callback function
732  * @param[in] user_data The user data to be passed to the callback function
733  * @return @c 0 on success,
734  *         otherwise a negative error value
735  * @retval #VC_ERROR_NONE Successful
736  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
737  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
738  * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
739  * @retval #VC_ERROR_INVALID_STATE Invalid state
740  * @retval #VC_ERROR_OPERATION_FAILED Operation failure
741  * @pre The state should be #VC_STATE_INITIALIZED.
742  */
743 int vc_tts_set_utterance_status_cb(vc_tts_utterance_status_cb callback, void* user_data);
744
745
746 /**
747  * @partner
748  * @brief Unsets the TTS utterance status callback function.
749  * @since_tizen 5.5
750  * @privlevel partner
751  * @privilege %http://tizen.org/privilege/voicecontrol.tts
752  * @return @c 0 on success,
753  *         otherwise a negative error value
754  * @retval #VC_ERROR_NONE Successful
755  * @retval #VC_ERROR_NOT_SUPPORTED Not supported
756  * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
757  * @retval #VC_ERROR_INVALID_STATE Invalid state
758  * @pre The state should be #VC_STATE_INITIALIZED.
759  */
760 int vc_tts_unset_utterance_status_cb(void);
761
762
763 #ifdef __cplusplus
764 }
765 #endif
766
767 /**
768  * @}
769  */
770
771 #endif /* __VOICE_CONTROL_H__ */