2 * Copyright (c) 2011-2017 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.
24 * @addtogroup CAPI_UIX_VOICE_CONTROL_ENGINE_MODULE
33 * @brief Enumerations of error codes.
34 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
37 VCE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
38 VCE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */
39 VCE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
40 VCE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,/**< Invalid parameter */
41 VCE_ERROR_OUT_OF_NETWORK = TIZEN_ERROR_NETWORK_DOWN, /**< Out of network */
42 VCE_ERROR_RECORDER_BUSY = TIZEN_ERROR_RESOURCE_BUSY,/**< Busy resource */
43 VCE_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< VC Engine NOT supported */
44 VCE_ERROR_INVALID_STATE = TIZEN_ERROR_VOICE_CONTROL | 0x011, /**< Invalid state */
45 VCE_ERROR_INVALID_LANGUAGE = TIZEN_ERROR_VOICE_CONTROL | 0x012, /**< Invalid language */
46 VCE_ERROR_OPERATION_FAILED = TIZEN_ERROR_VOICE_CONTROL | 0x014, /**< Operation failed */
47 VCE_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
48 VCE_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_VOICE_CONTROL | 0x022 /**< Not supported feature of current engine */
52 * @brief Enumerations of audio type.
53 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
56 VCE_AUDIO_TYPE_PCM_S16_LE = 0, /**< Signed 16bit audio type, Little endian */
57 VCE_AUDIO_TYPE_PCM_U8 /**< Unsigned 8bit audio type */
61 * @brief Enumerations of callback event.
62 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
65 VCE_RESULT_EVENT_SUCCESS = 0, /**< Event when the recognition full result is ready */
66 VCE_RESULT_EVENT_REJECTED, /**< Event when the recognition result is rejected */
67 VCE_RESULT_EVENT_ERROR /**< Event when the recognition has failed */
71 * @brief Enumerations of command type.
72 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
75 VCE_COMMAND_FORMAT_FIXED = 0, /**< Fixed command */
76 VCE_COMMAND_FORMAT_FIXED_AND_VFIXED, /**< Fixed command + variable-fixed command */
77 VCE_COMMAND_FORMAT_VFIXED_AND_FIXED, /**< variable-fixed command + Fixed command */
78 VCE_COMMAND_FORMAT_FIXED_AND_NONFIXED, /**< Fixed command + Non-fixed command */
79 VCE_COMMAND_FORMAT_NONFIXED_AND_FIXED, /**< Non-fixed command + Fixed command */
80 VCE_COMMAND_FORMAT_ACTION, /**< Action command */
81 VCE_COMMAND_FORMAT_PARTIAL /**< Partial matched command */
82 } vce_command_format_e;
85 * @brief Enumerations of speech detect.
86 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
89 VCE_SPEECH_DETECT_NONE = 0, /**< No event */
90 VCE_SPEECH_DETECT_BEGIN, /**< Begin of speech detected */
91 VCE_SPEECH_DETECT_END, /**< End of speech detected */
92 } vce_speech_detect_e;
95 * @brief Enumerations of ASR result events.
96 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
99 VCE_ASR_RESULT_EVENT_FINAL_RESULT = 0, /**< Event when the ASR result is last data or ASR result is only one result */
100 VCE_ASR_RESULT_EVENT_PARTIAL_RESULT, /**< Event when the ASR result exist, not first and not last */
101 VCE_ASR_RESULT_EVENT_ERROR /**< Event when the ASR result is failed */
102 } vce_asr_result_event_e;
105 * @brief Enumerations of audio channels.
106 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
109 VCE_AUDIO_CHANNEL_MONO = 0, /**< 1 channel, mono */
110 VCE_AUDIO_CHANNEL_STEREO = 1 /**< 2 channels, stereo */
111 } vce_audio_channel_e;
114 * @brief Enumeration for TTS feedback events.
115 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
118 VCE_FEEDBACK_EVENT_FAIL = -1, /**< Failed */
119 VCE_FEEDBACK_EVENT_START = 1, /**< Start event */
120 VCE_FEEDBACK_EVENT_CONTINUE = 2, /**< Continue event */
121 VCE_FEEDBACK_EVENT_FINISH = 3 /**< Finish event */
122 } vce_feedback_event_e;
125 * @brief A structure of handle for VC command.
126 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
128 typedef struct vce_cmd_s* vce_cmd_h;
131 * @brief Definition for foreground command type.
132 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
134 #define VCE_COMMAND_TYPE_FOREGROUND 1
137 * @brief Definition for background command type.
138 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
140 #define VCE_COMMAND_TYPE_BACKGROUND 2
143 * @brief Definition for widget command type.
144 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
146 #define VCE_COMMAND_TYPE_WIDGET 3
149 * @brief Definition for system command type.
150 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
152 #define VCE_COMMAND_TYPE_SYSTEM 4
155 * @brief Definition for system background command type.
156 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
158 #define VCE_COMMAND_TYPE_SYSTEM_BACKGROUND 5
161 * @brief Definitions for exclusive command type.
162 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
164 #define VCE_COMMAND_TYPE_EXCLUSIVE 6
167 * @brief Definition of bluetooth audio id.
168 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
170 #define VCE_AUDIO_ID_BLUETOOTH "VC_AUDIO_ID_BLUETOOTH" /**< Bluetooth audio id */
173 * @brief Definition of Wi-Fi audio id.
174 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
176 #define VCE_AUDIO_ID_WIFI "VC_AUDIO_ID_WIFI" /**< Wi-Fi audio id */
179 * @brief Definition for none message.
180 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
182 #define VC_RESULT_MESSAGE_NONE "vc.result.message.none"
185 * @brief Definition for failed recognition because the speech is too loud to listen.
186 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
188 #define VC_RESULT_MESSAGE_ERROR_TOO_LOUD "vc.result.message.error.too.loud"
191 * @brief Called when VC engine informs the engine service user about whole supported languages.
192 * @details This callback function is implemented by the engine service user. Therefore, the engine developer does NOT have to implement this callback function.
193 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
194 * @remarks This callback function is called by vce_foreach_supported_languages_cb() to retrieve the whole supported language list.
195 * The @a user_data must be transferred from vce_foreach_supported_languages_cb().
196 * The @a language can be used only in the callback. To use outside, make a copy.
197 * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code \n
198 * For example, "ko_KR" for Korean, "en_US" for American English.
199 * @param[in] user_data The user data passed from the foreach function
200 * @return @c true to continue with the next iteration of the loop \n @c false to break out of the loop
201 * @pre vce_foreach_supported_languages() will invoke this callback.
202 * @see vce_foreach_supported_languages()
204 typedef bool (*vce_supported_language_cb)(const char* language, void* user_data);
207 * @brief Called when the engine service user initializes Voice Control (VC) engine.
208 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
209 * @remarks This callback function is mandatory and must be registered using vce_main().
210 * @return 0 on success, otherwise a negative error value
211 * @retval #VCE_ERROR_NONE Successful
212 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
213 * @retval #VCE_ERROR_INVALID_STATE Already initialized
214 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
215 * @see vce_deinitialize_cb()
217 typedef int (*vce_initialize_cb)(void);
220 * @brief Called when the engine service user deinitializes VC engine.
221 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
222 * @remarks This callback function is mandatory and must be registered using vce_main().
223 * @return 0 on success, otherwise a negative error value
224 * @retval #VCE_ERROR_NONE Successful
225 * @retval #VCE_ERROR_INVALID_STATE Not initialized
226 * @see vce_initialize_cb()
228 typedef int (*vce_deinitialize_cb)(void);
231 * @brief Called when the engine service user requests the recording format of VC engine.
232 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
233 * @remarks This callback function is mandatory and must be registered using vce_main().
234 * The @a audio_id can be used only in the callback. To use outside, make a copy.
235 * The @a types is managed by the platform and will be released when this callback function is completed.
236 * The @a rate is managed by the platform and will be released when this callback function is completed.
237 * The @a channels is managed by the platform and will be released when this callback function is completed.
238 * @param[in] audio_id The audio device id. (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI)
239 * @param[out] types The format used by the recorder.
240 * @param[out] rate The sample rate used by the recorder.
241 * @param[out] channels The number of channels used by the recorder.
242 * @return 0 on success, otherwise a negative error value
243 * @retval #VCE_ERROR_NONE Successful
244 * @retval #VCE_ERROR_INVALID_PARAMETER Not initialized
246 typedef int (*vce_get_recording_format_cb)(const char* audio_id, vce_audio_type_e* types, int* rate, int* channels);
249 * @brief Called when the engine service user retrieves all supported languages of VC engine.
250 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
251 * @remarks This callback function is mandatory and must be registered using vce_main().
252 * @param[in] callback a callback function
253 * @param[in] user_data The user data to be passed to the callback function
254 * @return 0 on success, otherwise a negative error value
255 * @retval #VCE_ERROR_NONE Successful
256 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
257 * @retval #VCE_ERROR_INVALID_STATE Not initialized
258 * @post This function invokes vce_supported_language_cb() repeatedly for getting supported languages.
260 * @see vce_supported_language_cb()
262 typedef int (*vce_foreach_supported_languages_cb)(vce_supported_language_cb callback, void* user_data);
265 * @brief Called when the engine service user checks whether a language is supported or not.
266 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
267 * @remarks This callback function is mandatory and must be registered using vce_main().
268 * The @a language can be used only in the callback. To use outside, make a copy.
269 * @param[in] language A language
270 * @return @c true = supported, \n @c false = not supported.
272 typedef bool (*vce_is_language_supported_cb)(const char* language);
275 * @brief Called when the engine service user sets language.
276 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
277 * @remarks The @a language can be used only in the callback. To use outside, make a copy.
278 * @param[in] language A language.
279 * @return 0 on success, otherwise a negative error value
280 * @retval #VCE_ERROR_NONE Successful
281 * @retval #VCE_ERROR_INVALID_LANGUAGE Invalid language
282 * @retval #VCE_ERROR_INVALID_STATE Not initialized
283 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
285 typedef int (*vce_set_language_cb)(const char* language);
288 * @brief Called when the engine service user sets command list before recognition.
289 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
290 * @remarks This function should set commands via vcd_foreach_command().
291 * The @a vc_command should not be released.
292 * The @a vc_command can be used only in the callback. To use outside, make a copy.
293 * @param[in] vc_command command handle. The @a vc_command can be used only in the callback. To use outside, make a copy.
294 * @return 0 on success, otherwise a negative error value
295 * @retval #VCE_ERROR_NONE Successful
296 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
297 * @retval #VCE_ERROR_INVALID_STATE Invalid state
298 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
299 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported command type
300 * @post vce_start() is called after this function is successful.
302 * @see vcd_foreach_command()
303 * @see vce_unset_commands()
304 * @see vce_get_command_count()
306 typedef int (*vce_set_commands_cb)(vce_cmd_h vc_command);
309 * @brief Called when the engine service user unsets command list for reset.
310 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
311 * @return 0 on success, otherwise a negative error value
312 * @retval #VCE_ERROR_NONE Successful
313 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
314 * @retval #VCE_ERROR_INVALID_STATE Invalid state
315 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
316 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
317 * @see vce_set_commands_cb()
319 typedef int (*vce_unset_commands_cb)(void);
322 * @brief Called when the engine service user starts recognition.
323 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
324 * @remarks This callback function is mandatory and must be registered using vce_main().
325 * @param[in] stop_by_silence Silence detection option.
326 * @c true to detect the silence,
327 * @c false not to detect the silence
328 * @return 0 on success, otherwise a negative error value
329 * @retval #VCE_ERROR_NONE Successful
330 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
331 * @retval #VCE_ERROR_INVALID_STATE Invalid state
332 * @retval #VCE_ERROR_INVALID_LANGUAGE Invalid language
333 * @retval #VCE_ERROR_OUT_OF_NETWORK Out of network
334 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
335 * @pre vcd_foreach_command() is successful.
336 * @see vce_set_recording_data_cb()
340 typedef int (*vce_start_cb)(bool stop_by_silence);
343 * @brief Called when the engine service user sets recording data for speech recognition from recorder.
344 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
345 * @remarks This function should be returned immediately after recording data copy.
346 * The @a data can be used only in the callback. To use outside, make a copy.
347 * The @a speech_detected should not be released. This is managed by the platform.
348 * @param[in] data A recording data
349 * @param[in] length A length of recording data
350 * @param[out] speech_detected The status of speech (e.g. #VCE_SPEECH_DETECT_BEGIN or #VCE_SPEECH_DETECT_END). The @a speech_detected can be used only in the callback. To use outside, make a copy.
351 * @return 0 on success, otherwise a negative error value
352 * @retval #VCE_ERROR_NONE Successful
353 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
354 * @retval #VCE_ERROR_INVALID_STATE Invalid state
355 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
356 * @pre vce_start() is successful.
361 typedef int(*vce_set_recording_data_cb)(const void* data, unsigned int length, vce_speech_detect_e* speech_detected);
364 * @brief Called when the engine service user stops to get the result of recognition.
365 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
366 * @return 0 on success, otherwise a negative error value
367 * @retval #VCE_ERROR_NONE Successful
368 * @retval #VCE_ERROR_INVALID_STATE Invalid state
369 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
370 * @retval #VCE_ERROR_OUT_OF_NETWORK Out of network
371 * @pre vce_set_recording_data() is successful.
373 * @see vce_set_recording_data()
374 * @see vce_result_cb()
377 typedef int (*vce_stop_cb)(void);
380 * @brief Called when the engine service user cancels the recognition process.
381 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
382 * @return 0 on success, otherwise a negative error value.
383 * @retval #VCE_ERROR_NONE Successful.
384 * @retval #VCE_ERROR_INVALID_STATE Invalid state.
385 * @pre vce_start() is successful.
389 typedef int (*vce_cancel_cb)(void);
392 * @brief Called when the engine service user sets audio recording type.
393 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
394 * @remarks The @a audio_type can be used only in the callback. To use outside, make a copy.
395 * @param[in] audio_type Current audio type (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI)
396 * @return 0 on success, otherwise a negative error value.
397 * @retval #VCE_ERROR_NONE Successful.
398 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature.
400 typedef int (*vce_set_audio_type_cb)(const char* audio_type);
403 * @brief Called when the engine service user sets app id which is want to ask server dialog.
404 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
405 * @remarks The @a app_id and @a credential can be used only in the callback. To use outside, make a copy.
406 * @param[in] app_id App id which is to want to ask server dialog.
407 * @param[in] credential Credential key.
408 * @return 0 on success, otherwise a negative error value.
409 * @retval #VCE_ERROR_NONE Successful.
410 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature.
411 * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied.
413 typedef int (*vce_set_server_dialog_cb)(const char* app_id, const char* credential);
416 * @brief Called when the engine service user sets domain (agent or device type).
417 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
418 * @remarks The @a domain can be used only in the callback. To use outside, make a copy.
419 * @param[in] domain Agent (e.g. "music", "news", etc) or device type (e.g. "tv", "mobile", etc) corresponding to the command
420 * @return 0 on success, otherwise a negative error value.
421 * @retval #VCE_ERROR_NONE Successful.
422 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
424 typedef int (*vce_set_domain_cb)(const char* domain);
427 * @brief Called when the engine service user requests essential value from NLU result.
428 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
429 * @remarks The @a key can be used only in the callback. To use outside, make a copy.
430 * The @a value is managed by the platform and will be released when this callback function is completed.
431 * @param[in] key NLU base info key.
432 * @param[out] value NLU base info value.
433 * @return 0 on success, otherwise a negative error value.
434 * @retval #VCE_ERROR_NONE Successful.
435 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature.
437 typedef int (*vce_nlu_base_info_requested_cb)(const char* key, char** value);
440 * @brief Called when client gets the specific engine's request from the engine service user.
441 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
442 * @remarks The @a engine_app_id is managed by the platform and will be released when this callback function is completed.
443 * The @a event is managed by the platform and will be released when this callback function is completed.
444 * The @a request is managed by the platform and will be released when this callback function is completed.
446 * @param[in] engine_app_id The specific engine's app id
447 * @param[in] event The specific engine event type
448 * @param[in] request The specific engine request
450 * @return 0 on success, otherwise a negative error value.
451 * @retval #VCE_ERROR_NONE Successful
452 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
453 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
455 * @pre An application registers callback function using vce_set_specific_engine_request_cb().
457 * @see vce_set_specific_engine_request_cb()
458 * @see vce_unset_specific_engine_request_cb()
460 typedef int (*vce_specific_engine_request_cb)(const char* engine_app_id, const char* event, const char* request);
463 * @brief Called when the engine service user sets private data between app and engine.
464 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
465 * @remarks The @a key, @a data can be used only in the callback. To use outside, make a copy.
466 * @param[in] key Private key.
467 * @param[in] data Private data.
468 * @return 0 on success, otherwise a negative error value.
469 * @retval #VCE_ERROR_NONE Successful.
470 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature.
472 typedef int (*vce_private_data_set_cb)(const char* key, const char* data);
475 * @brief Called when the engine service user requests private data between app and engine.
476 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
477 * @remarks The @a key can be used only in the callback. To use outside, make a copy.
478 * The @a data is managed by the platform and will be released when this callback function is completed.
479 * @param[in] key Private key.
480 * @param[out] data Private data.
481 * @return 0 on success, otherwise a negative error value.
482 * @retval #VCE_ERROR_NONE Successful.
483 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature.
485 typedef int (*vce_private_data_requested_cb)(const char* key, char** data);
488 * @brief Called when the engine service user requests process text.
489 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
490 * @remarks The @a text can be used only in the callback. To use outside, make a copy.
491 * @param[in] text Requested text
492 * @return 0 on success, otherwise a negative error value.
493 * @retval #VCE_ERROR_NONE Successful.
494 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature.
496 typedef int (*vce_process_text_cb)(const char* text);
499 * @brief Called when the engine service user requests list event.
500 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
501 * @remarks The @a event can be used only in the callback. To use outside, make a copy.
502 * @param[in] event Requested list event
503 * @return 0 on success, otherwise a negative error value.
504 * @retval #VCE_ERROR_NONE Successful.
505 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature.
507 typedef int (*vce_process_list_event_cb)(const char* event);
510 * @brief Called when the engine service user requests haptic event.
511 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
512 * @remarks The @a event can be used only in the callback. To use outside, make a copy.
513 * @param[in] event Requested haptic event
514 * @return 0 on success, otherwise a negative error value.
515 * @retval #VCE_ERROR_NONE Successful.
516 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature.
518 typedef int (*vce_process_haptic_event_cb)(const char* event);
521 * @brief Called when the engine service user requests the base information of VC engine.
522 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
523 * @remarks This callback function is mandatory and must be registered using vce_main().
524 * The @a engine_uuid is managed by the platform and will be released when this callback function is completed.
525 * The @a engine_name is managed by the platform and will be released when this callback function is completed.
526 * The @a engine_settings_app_id is managed by the platform and will be released when this callback function is completed.
527 * The @a use_network is managed by the platform and will be released when this callback function is completed.
528 * In order to upload the engine to Tizen Appstore, both the service app and the UI app (engine settings) are necessary.
529 * Therefore, @a engine_settings_app_id should be set to the application ID of the UI application.
530 * If there is no UI application, then @a engine_settings_app_id should be set to NULL.
531 * @param[out] engine_uuid The engine id
532 * @param[out] engine_name The engine name
533 * @param[out] engine_settings_app_id The ID of the engine settings application (the UI application)
534 * @param[out] use_network @c true to need network @c false not to need network.
535 * @return @c 0 on success, otherwise a negative error code on failure
536 * @retval #VCE_ERROR_NONE Successful
537 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
538 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
540 typedef int (*vce_get_info_cb)(char** engine_uuid, char** engine_name, char** engine_settings_app_id, bool* use_network);
543 * @brief Called to retrieve the commands.
544 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
545 * @remarks The @a command, @a param can be used only in the callback. To use outside, make a copy.
546 * @param[in] id command id
547 * @param[in] type command type
548 * @param[in] format command format
549 * @param[in] command command text
550 * @param[in] param parameter text
551 * @param[in] domain command domain
552 * @param[in] user_data The user data passed from the foreach function
553 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
554 * @pre vce_get_foreach_command() will invoke this callback.
555 * @see vce_get_foreach_command()
557 typedef bool (*vce_command_cb)(int id, int type, int format, const char* command, const char* param, int domain, void* user_data);
560 * @brief Called when the engine service user (voice control client) requests to send TTS feedback.
562 * @remarks The @a text and @a language can be used only in the callback. To use outside, make a copy.
564 * @param[in] pid The process id of the engine service user (voice control client)
565 * @param[in] utt_id The utterance id
566 * @param[in] text The text for TTS feedback
567 * @param[in] language The language
568 * @param[in] user_data The user data passed from the callback setter function
570 * @return 0 on success, otherwise a negative error value.
571 * @retval #VCE_ERROR_NONE Successful
572 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
573 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
575 * @pre An application registers callback function using vce_set_request_tts_cb().
577 * @see vce_set_request_tts_cb()
578 * @see vce_unset_request_tts_cb()
580 typedef int (*vce_request_tts_cb)(int pid, int utt_id, const char* text, const char* language, void* user_data);
583 * @brief Called when the engine service user cancels TTS feedback.
586 * @param[in] pid The process id of the engine service user
587 * @param[in] utt_id The utterance id corresponding to the text
588 * @param[in] user_data The user data passed from the callback setter function
590 * @return 0 on success, otherwise a negative error value.
591 * @retval #VCE_ERROR_NONE Successful
592 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
593 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
595 * @pre An application registers callback function using vce_set_cancel_tts_cb().
597 * @see vce_set_cancel_tts_cb()
598 * @see vce_unset_cancel_tts_cb()
600 typedef int (*vce_cancel_tts_cb)(int pid, int utt_id, void* user_data);
603 * @brief Called when the engine service user requests TTS audio format.
605 * @remarks The @a rate, @a channel, and @a audio_type should not be released.
606 * The @a rate, @a channel, and @a audio_type are managed by the platform and will be released after the audio format is transferred to the VC client.
608 * @param[out] rate The audio sample rate
609 * @param[out] channel The audio channel
610 * @param[out] audio_type The audio type
611 * @param[in] user_data The user data passed from the callback setter function
613 * @return 0 on success, otherwise a negative error value.
614 * @retval #VCE_ERROR_NONE Successful
615 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
616 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
618 * @pre An application registers callback function using vce_set_tts_audio_format_request_cb().
620 * @see vce_set_tts_audio_format_request_cb()
621 * @see vce_unset_tts_audio_format_request_cb()
623 typedef int (*vce_tts_audio_format_request_cb)(int* rate, int* channel, int* audio_type, void* user_data);
627 * @brief A structure for the VC engine functions.
628 * @details This structure contains essential callback functions for operating VC engine.
629 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
630 * @remarks You must register all callbacks except optional callbacks for operating VC engine.\n
631 * The following callbacks are optional callbacks : \n
632 * - vce_private_data_set_cb \n
633 * - vce_private_data_requested_cb \n
634 * - vce_nlu_base_info_requested_cb \n
635 * - vce_specific_engine_request_cb \n
636 * If you want to use the optional callbacks, you can set them using vce_set_private_data_set_cb(), vce_set_private_data_requested_cb(), vce_set_nlu_base_info_requested_cb(), and vce_set_specific_engine_request_cb() functions.
639 * @see vce_set_private_data_set_cb()
640 * @see vce_set_private_data_requested_cb()
641 * @see vce_set_nlu_base_info_requested_cb()
642 * @see vce_set_specific_engine_request_cb()
645 int version; /**< Version */
647 /* Get engine information */
648 vce_get_info_cb get_info; /**< Called when the engine service user requests the basic information of VC engine */
649 vce_get_recording_format_cb get_recording_format; /**< Get recording format */
650 vce_foreach_supported_languages_cb foreach_langs; /**< Foreach language list */
651 vce_is_language_supported_cb is_lang_supported; /**< Check language */
653 vce_initialize_cb initialize; /**< Initialize engine */
654 vce_deinitialize_cb deinitialize; /**< Shutdown engine */
657 vce_set_language_cb set_language; /**< Set language */
658 vce_set_commands_cb set_commands; /**< Request to set current commands */
659 vce_unset_commands_cb unset_commands; /**< Request to unset current commands */
661 /* Control recognition */
662 vce_start_cb start; /**< Start recognition */
663 vce_set_recording_data_cb set_recording; /**< Set recording data */
664 vce_stop_cb stop; /**< Stop recording for getting result */
665 vce_cancel_cb cancel; /**< Cancel recording and processing */
667 vce_set_audio_type_cb set_audio_type; /**< Set audio type */
668 vce_set_server_dialog_cb set_server_dialog; /**< Set server dialog */
670 vce_set_domain_cb set_domain; /**< Set domain */
671 vce_process_text_cb process_text; /**< Request to process text */
672 vce_process_list_event_cb process_list_event; /**< Request to process list event */
673 vce_process_haptic_event_cb process_haptic_event; /**< Request to process haptic event */
675 /* Optional callbacks */
676 vce_private_data_set_cb private_data_set; /**< Set private data from the app */
677 vce_private_data_requested_cb private_data_request; /**< Send private data to the app */
678 vce_nlu_base_info_requested_cb nlu_base_info_request; /**< Send essential value from NLU result */
679 vce_specific_engine_request_cb specific_engine_request; /**< Get specific engine's request from the engine service user */
680 } vce_request_callback_s;
683 * @brief Starts the main function for Voice Control (VC) engine.
684 * @details This function is the main function for operating VC engine.
685 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
687 * @privilege %http://tizen.org/privilege/recorder
688 * @remarks The service_app_main() should be used for working the engine after this function.
689 * @param[in] argc The argument count(original)
690 * @param[in] argv The argument(original)
691 * @param[in] callback The structure of engine request callback function
692 * @return This function returns @c zero on success, or negative with error code on failure
693 * @retval #VCE_ERROR_NONE Successful
694 * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
695 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
696 * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
697 * @retval #VCE_ERROR_NOT_SUPPORTED Not supported
698 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
699 * @pre The vce_get_engine_info() should be successful.
700 * @see vce_get_engine_info()
701 * @see vce_unload_engine()
702 * @see vce_request_callback_s
706 // Required callback functions - MUST BE IMPLEMENTED
707 static int vce_default_initialize();
708 static int vce_default_deinitialize(void);
710 static int vce_default_get_info(char** engine_uuid, char** engine_name, char** engine_setting, bool* use_network);
711 static int vce_default_get_recording_format(const char* audio_id, vce_audio_type_e* types, int* rate, int* channels);
712 static int vce_default_foreach_langs(vce_supported_language_cb callback, void* user_data);
713 static bool vce_default_is_lang_supported(const char* lang);
715 static int vce_default_set_language(const char* language);
716 static int vce_default_set_commands(vce_cmd_h vc_command);
717 static int vce_default_unset_commands();
719 static int vce_default_start(bool stop_by_silence);
720 static int vce_default_set_recording(const void* data, unsigned int length, vce_speech_detect_e* silence_detected);
721 static int vce_default_stop();
722 static int vce_default_cancel(void);
724 static int vce_default_set_audio_type(const char* audio_type);
725 static int vce_default_set_domain(const char* domain);
726 static int vce_default_process_text(const char* text);
727 static int vce_default_process_list_event(const char* event);
728 static int vce_default_process_haptic_event(const char* event);
730 // Optional callback function
731 static int vce_default_private_data_set_cb(const char* key, const char* data);
733 int main(int argc, char* argv[])
735 // 1. Create a structure 'vce_request_callback_s'
736 vce_request_callback_s callback = {0,};
738 callback.version = 1;
740 callback.initialize = vce_default_initialize;
741 callback.deinitialize = vce_default_deinitialize;
743 callback.get_info = vce_default_get_info;
744 callback.get_recording_format = vce_default_get_recording_format;
745 callback.foreach_langs = vce_default_foreach_langs;
746 callback.is_lang_supported = vce_default_is_lang_supported;
748 callback.set_language = vce_default_set_language;
749 callback.set_commands = vce_default_set_commands;
750 callback.unset_commands = vce_default_unset_commands;
752 callback.start = vce_default_start;
753 callback.set_recording = vce_default_set_recording;
754 callback.stop = vce_default_stop;
755 callback.cancel = vce_default_cancel;
757 callback.set_audio_type = vce_default_set_audio_type;
758 callback.set_domain = vce_default_set_domain;
759 callback.process_text = vce_default_process_text;
760 callback.process_list_event = vce_default_process_list_event;
761 callback.process_haptic_event = vce_default_process_haptic_event;
763 // 2. Run 'vce_main()'
764 if (0 != vce_main(argc, argv, &callback)) {
765 SLOG(LOG_ERROR, TAG_VCE, "[ERROR] Fail to vce main");
770 vce_set_private_data_set_cb(vce_default_private_data_set_cb);
772 // 3. Set event callbacks for service app and Run 'service_app_main()'
774 service_app_lifecycle_callback_s event_callback;
775 app_event_handler_h handlers[5] = {NULL, };
777 event_callback.create = service_app_create;
778 event_callback.terminate = service_app_terminate;
779 event_callback.app_control = service_app_control;
781 service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad);
782 service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad);
783 service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad);
784 service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad);
786 return service_app_main(argc, argv, &event_callback, ad);
791 int vce_main(int argc, char** argv, vce_request_callback_s* callback);
794 * @brief Sends the results to the engine service user.
795 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
796 * @param[in] event A result event
797 * @param[in] result_id Result ids
798 * @param[in] count Result count
799 * @param[in] all_result All result text
800 * @param[in] non_fixed_result Non-fixed command result text
801 * @param[in] nlu_result NLU result text
802 * @param[in] msg Engine message (e.g. #VC_RESULT_MESSAGE_NONE, #VC_RESULT_MESSAGE_ERROR_TOO_LOUD)
803 * @param[out] user_info A user info (e.g. If ASR result is consumed, the value is 0x01. If not, the value is 0x00.)
804 * @param[in] user_data The user data passed from set callback function
805 * @return @c 0 on success, otherwise a negative error value
806 * @retval #VCE_ERROR_NONE Successful
807 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
808 * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
809 * @retval #VCE_ERROR_INVALID_STATE Invalid state
810 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
811 * @pre The vce_main() function should be invoked before this function is called.
812 * vce_stop_cb() will invoke this callback.
815 int vce_send_result(vce_result_event_e event, int* result_id, int count, const char* all_result, const char* non_fixed_result, const char* nlu_result, const char* msg, int* user_info, void* user_data);
818 * @brief Sends the ASR result to the engine service user.
819 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
820 * @param[in] event A asr result event
821 * @param[in] asr_result A asr result text
822 * @param[in] user_data The user data passed from the start
823 * @return @c 0 on success, otherwise a negative error value
824 * @retval #VCE_ERROR_NONE Successful
825 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
826 * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
827 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
828 * @pre The vce_main() function should be invoked before this function is called.
829 * @see vce_start_cb()
831 int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, void* user_data);
834 * @brief Sends the NLG (Natural Language Generation) result to the engine service user.
835 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
836 * @param[in] nlg_result A nlg result
837 * @param[in] user_data The user data passed from the start
838 * @return @c 0 on success, otherwise a negative error value
839 * @retval #VCE_ERROR_NONE Successful
840 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
841 * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
842 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
843 * @pre The vce_main() function should be invoked before this function is called.
844 * @see vce_start_cb()
846 int vce_send_nlg_result(const char* nlg_result, void* user_data);
849 * @brief Sends the specific engine result to the engine service user.
850 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
852 * @param[in] engine_app_id A specific engine's app id
853 * @param[in] event A specific engine result event
854 * @param[in] result A specific engine result text
855 * @param[in] user_info The user info passed from the start
857 * @return 0 on success, otherwise a negative error value
858 * @retval #VCE_ERROR_NONE Successful
859 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
860 * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
861 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
862 * @pre The vce_main() function should be invoked before this function is called.
864 int vce_send_specific_engine_result(const char* engine_app_id, const char* event, const char* result, void *user_info);
867 * @brief Sends the error to the engine service user.
868 * @details The following error codes can be delivered. \n
869 * #VCE_ERROR_NONE, \n
870 * #VCE_ERROR_OUT_OF_MEMORY, \n
871 * #VCE_ERROR_IO_ERROR, \n
872 * #VCE_ERROR_INVALID_PARAMETER, \n
873 * #VCE_ERROR_OUT_OF_NETWORK, \n
874 * #VCE_ERROR_RECORDER_BUSY, \n
875 * #VCE_ERROR_NOT_SUPPORTED, \n
876 * #VCE_ERROR_INVALID_STATE, \n
877 * #VCE_ERROR_INVALID_LANGUAGE, \n
878 * #VCE_ERROR_OPERATION_FAILED, \n
879 * #VCE_ERROR_PERMISSION_DENIED, \n
880 * #VCE_ERROR_NOT_SUPPORTED_FEATURE.
881 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
882 * @param[in] error Error type
883 * @param[in] msg Error message
884 * @param[in] user_data The user data passed from set callback function
885 * @return @c 0 on success, otherwise a negative error value
886 * @retval #VCE_ERROR_NONE Successful
887 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
888 * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
889 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
890 * @pre The vce_main() function should be invoked before this function is called.
892 int vce_send_error(vce_error_e error, const char* msg, void* user_data);
895 * @brief Sets a callback function for setting the private data to the engine service.
896 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
898 * @privilege %http://tizen.org/privilege/recorder
899 * @remarks The vce_private_data_set_cb() function is called when the engine service user sets the private data to the engine service.
900 * @param[in] callback_func vce_private_data_set event callback function
901 * @return @c 0 on success, otherwise a negative error value
902 * @retval #VCE_ERROR_NONE Successful
903 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
904 * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
905 * @retval #VCE_ERROR_NOT_SUPPORTED Not supported
906 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
907 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
908 * @pre The vce_main() function should be invoked before this function is called.
909 * @see vce_private_data_set_cb()
911 int vce_set_private_data_set_cb(vce_private_data_set_cb callback_func);
914 * @brief Sets a callback function for requesting the private data to the engine service.
915 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
917 * @privilege %http://tizen.org/privilege/recorder
918 * @remarks The vce_private_data_requested_cb() function is called when the engine service user requests the private data to the engine service.
919 * @param[in] callback_func vce_private_data_requested event callback function
920 * @return @c 0 on success, otherwise a negative error value
921 * @retval #VCE_ERROR_NONE Successful
922 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
923 * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
924 * @retval #VCE_ERROR_NOT_SUPPORTED Not supported
925 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
926 * @see vce_private_data_requested_cb()
928 int vce_set_private_data_requested_cb(vce_private_data_requested_cb callback_func);
931 * @brief Sets a callback function for requesting the NLU base information to the engine service.
932 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
933 * @remarks The vce_nlu_base_info_requested_cb() function is called when the engine service user requests the NLU base information to the engine service.
934 * @param[in] callback_func vce_nlu_base_info_requested event callback function
935 * @return @c 0 on success, otherwise a negative error value
936 * @retval #VCE_ERROR_NONE Successful
937 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
938 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
939 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
940 * @see vce_nlu_base_info_requested_cb()
942 int vce_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_func);
945 * @brief Sets a callback function for getting the engine service request.
946 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
948 * @param[in] callback_func Callback function to register
950 * @return 0 on success, otherwise a negative error value
951 * @retval #VCE_ERROR_NONE Successful
952 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
953 * @retval #VCE_ERROR_NOT_SUPPORTED Not supported
955 * @see vce_unset_specific_engine_request_cb()
957 int vce_set_specific_engine_request_cb(vce_specific_engine_request_cb callback_func);
960 * @brief Unsets the engine service request callback function.
961 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
963 * @return 0 on success, otherwise a negative error value
964 * @retval #VC_ERROR_NONE Successful
965 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
967 * @see vce_set_specific_engine_request_cb()
969 int vce_unset_specific_engine_request_cb(void);
972 * @brief Retrieves all commands using callback function.
973 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
975 * @param[in] vce_command The handle to be passed to the vce_set_commands() function
976 * @param[in] callback The callback function to invoke
977 * @param[in] user_data The user data to be passed to the callback function
979 * @return 0 on success, otherwise a negative error value
980 * @retval #VCE_ERROR_NONE Successful
981 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
982 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
983 * @retval #VCE_ERROR_INVALID_STATE Invalid state
984 * @post This function invokes vce_command_cb() repeatedly for getting commands.
985 * @see vce_foreach_command_cb()
986 * @see vce_set_commands()
988 int vce_get_foreach_command(vce_cmd_h vce_command, vce_command_cb callback, void* user_data);
991 * @brief Gets command length.
992 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
994 * @param[in] vce_command The handle to be passed to the vce_set_commands() function
995 * @param[out] count The command count value
997 * @return 0 on success, otherwise a negative error value.
998 * @retval #VCE_ERROR_NONE Successful
999 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
1000 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
1001 * @see vce_set_commands()
1003 int vce_get_command_count(vce_cmd_h vce_command, int* count);
1006 * @brief Gets current audio type.
1007 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
1009 * @privilege %http://tizen.org/privilege/recorder
1010 * @remarks The @a audio_type must be released using free() when it is no longer required.
1011 * @param[in] audio_type Current audio type (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI)
1012 * @return the value greater than 0 on success, otherwise a negative error value
1013 * @retval #VCE_ERROR_NONE Successful
1014 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
1015 * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
1016 * @retval #VCE_ERROR_NOT_SUPPORTED Not supported
1018 int vce_get_audio_type(char** audio_type);
1021 * @brief Sets private data to a voice manager client.
1022 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
1024 * @privilege %http://tizen.org/privilege/recorder
1025 * @param[in] key Private key
1026 * @param[in] data Private data
1027 * @return 0 on success, otherwise a negative error value.
1028 * @retval #VCE_ERROR_NONE Successful
1029 * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
1030 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
1031 * @retval #VCE_ERROR_INVALID_STATE Invalid state
1032 * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
1033 * @retval #VCE_ERROR_NOT_SUPPORTED Not supported
1034 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
1036 int vce_set_private_data(const char* key, const char* data);
1039 * @brief Gets private data from a voice manager client.
1040 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
1042 * @privilege %http://tizen.org/privilege/recorder
1043 * @remarks The @a data must be released using free() when it is no longer required.
1044 * @param[in] key Private key
1045 * @param[out] data Private data
1046 * @return 0 on success, otherwise a negative error value.
1047 * @retval #VCE_ERROR_NONE Successful
1048 * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
1049 * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
1050 * @retval #VCE_ERROR_NOT_SUPPORTED Not supported
1051 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
1052 * @retval #VCE_ERROR_INVALID_STATE Invalid state
1053 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
1055 int vce_get_private_data(const char* key, char** data);
1058 * @brief Starts recording voice.
1059 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
1061 * @privilege %http://tizen.org/privilege/recorder
1062 * @return 0 on success, otherwise a negative error value.
1063 * @retval #VCE_ERROR_NONE Successful
1064 * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
1065 * @retval #VCE_ERROR_NOT_SUPPORTED Not supported
1066 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
1067 * @retval #VCE_ERROR_RECORDER_BUSY Busy recorder
1069 int vce_start_recording(void);
1072 * @brief Stops recording voice.
1073 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
1075 * @privilege %http://tizen.org/privilege/recorder
1076 * @return 0 on success, otherwise a negative error value.
1077 * @retval #VCE_ERROR_NONE Successful
1078 * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
1079 * @retval #VCE_ERROR_NOT_SUPPORTED Not supported
1080 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
1082 int vce_stop_recording(void);
1085 * @brief Sends audio formats necessary for playing TTS feedback.
1086 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
1088 * @param[in] rate A sampling rate
1089 * @param[in] channel The audio channel
1090 * @param[in] audio_type The audio type
1092 * @return 0 on success, otherwise a negative error value.
1093 * @retval #VCE_ERROR_NONE Successful
1094 * @retval #VCE_ERROR_NOT_SUPPORTED Not supported
1095 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
1096 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
1097 * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
1099 int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_audio_type_e audio_type);
1102 * @brief Sends audio streaming necessary for playing TTS feedback.
1103 * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
1105 * @param[in] event A feedback event
1106 * @param[in] buffer The feedback data
1107 * @param[in] len The length of the feedback data
1109 * @return 0 on success, otherwise a negative error value.
1110 * @retval #VCE_ERROR_NONE Successful
1111 * @retval #VCE_ERROR_NOT_SUPPORTED Not supported
1112 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
1113 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
1114 * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
1116 int vce_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int len);
1119 * @brief Sets a callback function for getting the request of sending TTS feedback from the engine service user.
1122 * @param[in] callback_func Callback function to be registered
1123 * @param[in] user_data The user data passed to the callback function
1125 * @return 0 on success, otherwise a negative error value
1126 * @retval #VCE_ERROR_NONE Successful
1127 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
1128 * @retval #VCE_ERROR_NOT_SUPPORTED Not supported
1130 * @see vce_request_tts_cb()
1131 * @see vce_unset_request_tts_cb()
1133 int vce_set_request_tts_cb(vce_request_tts_cb callback_func, void* user_data);
1136 * @brief Unsets the TTS feedback request callback function.
1139 * @return 0 on success, otherwise a negative error value
1140 * @retval #VC_ERROR_NONE Successful
1141 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
1143 * @see vce_set_request_tts_cb()
1145 int vce_unset_request_tts_cb(void);
1148 * @brief Sets a callback function for getting the request of canceling TTS feedback from the engine service user.
1151 * @param[in] callback_func Callback function to be registered
1152 * @param[in] user_data The user data passed to the callback function
1154 * @return 0 on success, otherwise a negative error value
1155 * @retval #VCE_ERROR_NONE Successful
1156 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
1157 * @retval #VCE_ERROR_NOT_SUPPORTED Not supported
1159 * @see vce_cancel_tts_cb()
1160 * @see vce_unset_cancel_tts_cb()
1162 int vce_set_cancel_tts_cb(vce_cancel_tts_cb callback_func, void* user_data);
1165 * @brief Unsets the TTS feedback cancellation callback function.
1168 * @return 0 on success, otherwise a negative error value
1169 * @retval #VC_ERROR_NONE Successful
1170 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
1172 * @see vce_set_cancel_tts_cb()
1174 int vce_unset_cancel_tts_cb(void);
1177 * @brief Sets a callback function for sending TTS audio format to the engine service user.
1180 * @param[in] callback_func Callback function to be registered
1181 * @param[in] user_data The user data passed to the callback function
1183 * @return 0 on success, otherwise a negative error value
1184 * @retval #VCE_ERROR_NONE Successful
1185 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
1186 * @retval #VCE_ERROR_NOT_SUPPORTED Not supported
1188 * @see vce_tts_audio_format_request_cb()
1189 * @see vce_unset_get_tts_audio_format_cb()
1191 int vce_set_tts_audio_format_request_cb(vce_tts_audio_format_request_cb callback_func, void* user_data);
1194 * @brief Unsets the TTS audio format request callback function.
1197 * @return 0 on success, otherwise a negative error value
1198 * @retval #VC_ERROR_NONE Successful
1199 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
1201 * @see vce_set_tts_audio_format_cb()
1203 int vce_unset_get_tts_audio_format_cb(void);
1214 #endif /* __VCE_H__ */