a921cd1a8d2474782834bbb3fa5f6bd3c3b3adbb
[platform/core/uifw/voice-control.git] / include / vce.h
1 /*
2 * Copyright (c) 2011-2017 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 __VCE_H__
19 #define __VCE_H__
20
21 #include <tizen.h>
22
23 /**
24 * @addtogroup CAPI_UIX_VCE_MODULE
25 * @{
26 */
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /**
33 * @brief Enumerations of error codes.
34 * @since_tizen 5.0
35 */
36 typedef enum {
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_INVALID_STATE         = TIZEN_ERROR_VOICE_CONTROL | 0x011, /**< Invalid state */
43         VCE_ERROR_INVALID_LANGUAGE      = TIZEN_ERROR_VOICE_CONTROL | 0x012, /**< Invalid language */
44         VCE_ERROR_OPERATION_FAILED      = TIZEN_ERROR_VOICE_CONTROL | 0x014, /**< Operation failed */
45         VCE_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_VOICE_CONTROL | 0x022 /**< Not supported feature of current engine */
46 } vce_error_e;
47
48 /**
49 * @brief Enumerations of audio type.
50 * @since_tizen 5.0
51 */
52 typedef enum {
53         VCE_AUDIO_TYPE_PCM_S16_LE = 0,  /**< Signed 16bit audio type, Little endian */
54         VCE_AUDIO_TYPE_PCM_U8           /**< Unsigned 8bit audio type */
55 } vce_audio_type_e;
56
57 /**
58 * @brief Enumerations of callback event.
59 * @since_tizen 5.0
60 */
61 typedef enum {
62         VCE_RESULT_EVENT_SUCCESS = 0,           /**< Event when the recognition full result is ready  */
63         VCE_RESULT_EVENT_REJECTED,              /**< Event when the recognition result is rejected */
64         VCE_RESULT_EVENT_ERROR                  /**< Event when the recognition has failed */
65 } vce_result_event_e;
66
67 /**
68 * @brief Enumerations of command type.
69 * @since_tizen 5.0
70 */
71 typedef enum {
72         VCE_COMMAND_FORMAT_FIXED = 0,                   /**< Fixed command */
73         VCE_COMMAND_FORMAT_FIXED_AND_VFIXED,    /**< Fixed command + variable-fixed command */
74         VCE_COMMAND_FORMAT_VFIXED_AND_FIXED,    /**< variable-fixed command + Fixed command */
75         VCE_COMMAND_FORMAT_FIXED_AND_NONFIXED,  /**< Fixed command + Non-fixed command */
76         VCE_COMMAND_FORMAT_NONFIXED_AND_FIXED,  /**< Non-fixed command + Fixed command */
77         VCE_COMMAND_FORMAT_ACTION,
78         VCE_COMMAND_FORMAT_PARTIAL
79 } vce_command_format_e;
80
81 /**
82 * @brief Definition for foreground command type.
83 * @since_tizen 5.0
84 */
85 #define VCE_COMMAND_TYPE_FOREGROUND     1
86
87 /**
88 * @brief Definition for background command type.
89 * @since_tizen 5.0
90 */
91 #define VCE_COMMAND_TYPE_BACKGROUND     2
92
93 /**
94 * @brief Definition for widget command type.
95 * @since_tizen 5.0
96 */
97 #define VCE_COMMAND_TYPE_WIDGET         3
98
99 /**
100 * @brief Definition for system command type.
101 * @since_tizen 5.0
102 */
103 #define VCE_COMMAND_TYPE_SYSTEM         4
104
105 /**
106 * @brief Definition for system background command type.
107 * @since_tizen 5.0
108 */
109 #define VCE_COMMAND_TYPE_SYSTEM_BACKGROUND      5
110
111 /**
112 * @brief Definitions for exclusive command type.
113 * @since_tizen 5.0
114 */
115 #define VCE_COMMAND_TYPE_EXCLUSIVE      6
116
117
118 /**
119 * @brief Enumerations of speech detect.
120 * @since_tizen 5.0
121 */
122 typedef enum {
123         VCE_SPEECH_DETECT_NONE = 0,     /**< No event */
124         VCE_SPEECH_DETECT_BEGIN,        /**< Begin of speech detected */
125         VCE_SPEECH_DETECT_END,          /**< End of speech detected */
126 } vce_speech_detect_e;
127
128 /**
129 * @brief Enumerations of ASR result events
130 * @since_tizen 5.0
131 */
132 typedef enum {
133         VCE_ASR_RESULT_EVENT_FINAL_RESULT = 0,
134         VCE_ASR_RESULT_EVENT_PARTIAL_RESULT,
135         VCE_ASR_RESULT_EVENT_ERROR
136 } vce_asr_result_event_e;
137
138 /**
139 * @brief A structure of handle for VC command
140 * @since_tizen 5.0
141 */
142 typedef int vce_cmd_h;
143
144 /**
145 * @brief Definition of bluetooth audio id.
146 * @since_tizen 5.0
147 */
148 #define VCE_AUDIO_ID_BLUETOOTH          "VC_AUDIO_ID_BLUETOOTH"         /**< Bluetooth audio id */
149
150 /**
151 * @brief Definition of Wi-Fi audio id.
152 * @since_tizen 5.0
153 */
154 #define VCE_AUDIO_ID_WIFI               "VC_AUDIO_ID_WIFI"              /**< Wi-Fi audio id */
155
156 /**
157 * @brief Definition for none message.
158 */
159 #define VC_RESULT_MESSAGE_NONE                  "vc.result.message.none"
160
161 /**
162 * @brief Definition for failed recognition because the speech is too loud to listen.
163 */
164 #define VC_RESULT_MESSAGE_ERROR_TOO_LOUD        "vc.result.message.error.too.loud"
165
166
167
168 /**
169 * @brief Called when VC engine informs the engine service user about whole supported languages.
170 * @details This callback function is implemented by the engine service user. Therefore, the engine developer does NOT have to implement this callback function.
171 * @since_tizen 5.0
172 * @remarks This callback function is called by vce_foreach_supported_languages_cb() to retrieve the whole supported language list.
173 *               @a user_data must be transferred from vce_foreach_supported_languages_cb().
174 *
175 * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code
176 *               followed by ISO 639-1 for the two-letter language code \n
177 *               For example, "ko_KR" for Korean, "en_US" for American English
178 * @param[in] user_data The user data passed from the foreach function
179 *
180 * @return @c true to continue with the next iteration of the loop \n @c false to break out of the loop
181 *
182 * @pre vce_foreach_supported_languages() will invoke this callback.
183 *
184 * @see vce_foreach_supported_languages()
185 */
186 typedef bool (*vce_supported_language_cb)(const char* language, void* user_data);
187
188 /**
189 * @brief Called when the engine service user initializes VC engine.
190 * @since_tizen 5.0
191 * @remarks This callback function is mandatory and must be registered using vce_main().
192 *
193 * @return 0 on success, otherwise a negative error value
194 * @retval #VCE_ERROR_NONE Successful
195 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
196 * @retval #VCE_ERROR_INVALID_STATE Already initialized
197 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
198 *
199 * @see vce_deinitialize_cb()
200 */
201 typedef int (*vce_initialize_cb)(void);
202
203 /**
204 * @brief Called when the engine service user deinitializes VC engine
205 * @since_tizen 5.0
206 * @remarks This callback function is mandatory and must be registered using vce_main().
207 *
208 * @return 0 on success, otherwise a negative error value
209 * @retval #VCE_ERROR_NONE Successful
210 * @retval #VCE_ERROR_INVALID_STATE Not initialized
211 *
212 * @see vce_initialize_cb()
213 */
214 typedef int (*vce_deinitialize_cb)(void);
215
216 /**
217 * @brief Called when the engine service user requests the recording format of VC engine.
218 *
219 * @param[in] audio_id The audio device id.
220 * @param[out] types The format used by the recorder.
221 * @param[out] rate The sample rate used by the recorder.
222 * @param[out] channels The number of channels used by the recorder.
223 *
224 * @return 0 on success, otherwise a negative error value
225 * @retval #VCE_ERROR_NONE Successful
226 * @retval #VCE_ERROR_INVALID_PARAMETER Not initialized
227 */
228 typedef int (*vce_get_recording_format_cb)(const char* audio_id, vce_audio_type_e* types, int* rate, int* channels);
229
230 /**
231 * @brief Called when the engine service user retrieves all supported languages of VC engine.
232 *
233 * @param[in] callback a callback function
234 * @param[in] user_data The user data to be passed to the callback function
235 *
236 * @return 0 on success, otherwise a negative error value
237 * @retval #VCE_ERROR_NONE Successful
238 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
239 * @retval #VCE_ERROR_INVALID_STATE Not initialized
240 *
241 * @post This function invokes vce_supported_language_cb() repeatedly for getting supported languages.
242 *
243 * @see vce_supported_language_cb()
244 */
245 typedef int (*vce_foreach_supported_languages_cb)(vce_supported_language_cb callback, void* user_data);
246
247 /**
248 * @brief Called when the engine service user checks whether a language is supported or not.
249 *
250 * @param[in] language A language
251 *
252 * @return @c true = supported, \n @c false = not supported.
253 */
254 typedef bool (*vce_is_language_supported_cb)(const char* language);
255
256 /**
257 * @brief Called when the engine service user sets language.
258 *
259 * @param[in] language A language.
260 *
261 * @return 0 on success, otherwise a negative error value
262 * @retval #VCE_ERROR_NONE Successful
263 * @retval #VCE_ERROR_INVALID_LANGUAGE Invalid language
264 * @retval #VCE_ERROR_INVALID_STATE Not initialized
265 */
266 typedef int (*vce_set_language_cb)(const char* language);
267
268 /**
269 * @brief Called when the engine service user sets command list before recognition.
270 *
271 * @remark This function should set commands via vcd_foreach_command().
272 *
273 * @param[in] vc_command command handle.
274 *
275 * @return 0 on success, otherwise a negative error value
276 * @retval #VCE_ERROR_NONE Successful
277 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
278 * @retval #VCE_ERROR_INVALID_STATE Invalid state
279 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
280 * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported command type
281 *
282 * @post vce_start() is called after this function is successful.
283 *
284 * @see vce_start()
285 * @see vcd_foreach_command()
286 * @see vce_unset_commands()
287 */
288 typedef int (*vce_set_commands_cb)(vce_cmd_h vc_command);
289
290 /**
291 * @brief Called when the engine service user unsets command list for reset.
292 *
293 * @return 0 on success, otherwise a negative error value
294 * @retval #VCE_ERROR_NONE Successful
295 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
296 * @retval #VCE_ERROR_INVALID_STATE Invalid state
297 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
298 *
299 * @see vce_set_commands()
300 */
301 typedef int (*vce_unset_commands_cb)();
302
303 /**
304 * @brief Called when the engine service user starts recognition.
305 *
306 * @return 0 on success, otherwise a negative error value
307 * @retval #VCE_ERROR_NONE Successful
308 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
309 * @retval #VCE_ERROR_INVALID_STATE Invalid state
310 * @retval #VCE_ERROR_INVALID_LANGUAGE Invalid language
311 * @retval #VCE_ERROR_OUT_OF_NETWORK Out of network
312 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
313 *
314 * @pre vcd_foreach_command() is successful.
315 *
316 * @see vce_set_recording_data()
317 * @see vce_stop()
318 * @see vce_cancel()
319 */
320 typedef int (*vce_start_cb)(bool stop_by_silence);
321
322 /**
323 * @brief Called when the engine service user sets recording data for speech recognition from recorder.
324 *
325 * @remark This function should be returned immediately after recording data copy.
326 *
327 * @param[in] data A recording data
328 * @param[in] length A length of recording data
329 * @param[out] silence_detected @c true Silence detected \n @c false No silence detected
330 *
331 * @return 0 on success, otherwise a negative error value
332 * @retval #VCE_ERROR_NONE Successful
333 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
334 * @retval #VCE_ERROR_INVALID_STATE Invalid state
335 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
336 *
337 * @pre vce_start() is successful.
338 *
339 * @see vce_start()
340 * @see vce_cancel()
341 * @see vce_stop()
342 */
343 typedef int(*vce_set_recording_data_cb)(const void* data, unsigned int length, vce_speech_detect_e* speech_detected);
344
345 /**
346 * @brief Called when the engine service user stops to get the result of recognition.
347 *
348 * @return 0 on success, otherwise a negative error value
349 * @retval #VCE_ERROR_NONE Successful
350 * @retval #VCE_ERROR_INVALID_STATE Invalid state
351 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
352 * @retval #VCE_ERROR_OUT_OF_NETWORK Out of network
353 *
354 * @pre vce_set_recording_data() is successful.
355 *
356 * @see vce_start()
357 * @see vce_set_recording_data()
358 * @see vce_result_cb()
359 * @see vce_cancel()
360 */
361 typedef int (*vce_stop_cb)(void);
362
363 /**
364 * @brief Called when the engine service user cancels the recognition process.
365 *
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 *
370 * @pre vce_start() is successful.
371 *
372 * @see vce_start()
373 * @see vce_stop()
374 */
375 typedef int (*vce_cancel_cb)(void);
376
377 /**
378 * @brief Set audio recording type.
379 *
380 * @return 0 on success, otherwise a negative error value.
381 * @retval #VCE_ERROR_NONE Successful.
382 *
383 */
384 typedef int (*vce_set_audio_type)(const char* audio);
385
386
387 /**
388 * @brief Called when the engine service user sets domain (Agent or device type)
389 *
390 * @param[in] domain Available agent or device type
391 *
392 * @return 0 on success, otherwise a negative error value.
393 *
394 */
395 typedef int (*vce_set_domain_cb)(const char* domain);
396
397 /**
398 * @brief Called when the engine service user requests essential value from nlu result.
399 * @since_tizen 5.0
400 * @remarks This function is available inside vce_nlu_result_cb()
401 *
402 * @param[in] key NLU base info key
403 * @parma[out] value NLU base info value
404 *
405 * @return 0 on success, otherwise a negative error value.
406 *
407 */
408 typedef int (*vce_nlu_base_info_requested_cb)(const char* key, char** value);
409
410 /**
411 * @brief Called when the engine service user sets private data between app and engine.
412 *
413 * @param[in] key Private key
414 * @param[in] data Private data
415 *
416 * @return 0 on success, otherwise a negative error value.
417 *
418 */
419 typedef int (*vce_private_data_set_cb)(const char* key, const char* data);
420
421 /**
422 * @brief Called when the engine service user requests private data between app and engine.
423 *
424 * @param[in] key Private key
425 * @param[out] data Private data
426 *
427 * @return 0 on success, otherwise a negative error value.
428 *
429 */
430 typedef int (*vce_private_data_requested_cb)(const char* key, char** data);
431
432 /**
433 * @brief Called when the engine service user requests process text.
434 *
435 * @param[in] text Requested text
436 *
437 * @return 0 on success, otherwise a negative error value.
438 *
439 */
440 typedef int (*vce_process_text_cb)(const char* text);
441
442 /**
443 * @brief Called when the engine service user requests list event.
444 *
445 * @param[in] event Requested list event
446 *
447 * @return 0 on success, otherwise a negative error value.
448 *
449 */
450 typedef int (*vce_process_list_event_cb)(const char* event);
451
452 /**
453 * @brief Called when the engine service user requests haptic event.
454 *
455 * @param[in] event Requested haptic event
456 *
457 * @return 0 on success, otherwise a negative error value.
458 *
459 */
460 typedef int (*vce_process_haptic_event_cb)(const char* event);
461
462 /**
463 * @brief Called when the engine service user requests the base information of VC engine.
464 * @since_tizen 5.0
465 *
466 * @param[out] engine_uuid The engine id
467 * @param[out] engine_name The engine name
468 * @param[out] engine_setting The setting path name
469 * @param[out] use_network @c true to need network @c false not to need network.
470 */
471 typedef int (*vce_get_info_cb)(char** engine_uuid, char** engine_name, char** engine_setting, bool* use_network);
472
473
474 /**
475 * Daemon API.
476 */
477
478 /**
479 * @brief Called to retrieve the commands.
480 *
481 * @param[in] id command id
482 * @param[in] type command type
483 * @param[in] format command format
484 * @param[in] command command text
485 * @param[in] param parameter text
486 * @param[in] domain command domain
487 * @param[in] user_data The user data passed from the foreach function
488 *
489 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
490 * @pre vce_get_foreach_command() will invoke this callback.
491 *
492 * @see vce_get_foreach_command()
493 */
494 typedef bool (*vce_command_cb)(int id, int type, int format, const char* command, const char* param, int domain, void* user_data);
495
496 /**
497 * @brief Retrieves all commands using callback function.
498 *
499 * @param[in] vce_command The handle to be passed to the vce_set_commands() function
500 * @param[in] callback The callback function to invoke
501 * @param[in] user_data The user data to be passed to the callback function
502 *
503 * @return 0 on success, otherwise a negative error value
504 * @retval #VCE_ERROR_NONE Successful
505 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
506 * @retval #VCE_ERROR_OPERATION_FAILED Operation failure
507 * @retval #VCE_ERROR_INVALID_STATE Invalid state
508 *
509 * @post This function invokes vce_command_cb() repeatedly for getting commands.
510 *
511 * @see vce_foreach_command_cb()
512 * @see vce_set_commands()
513 */
514 int vce_get_foreach_command(vce_cmd_h vce_command, vce_command_cb callback, void* user_data);
515
516 /**
517 * @brief Gets command length.
518 *
519 * @param[in] vce_command The handle to be passed to the vce_set_commands() function
520 *
521 * @return the value greater than 0 on success, otherwise a negative error value
522 *
523 * @see vce_set_commands()
524 */
525 int vce_get_command_count(vce_cmd_h vce_command);
526
527 /**
528 * @brief Gets current audio type.
529 *
530 * @remarks audio_type must be released using free() when it is no longer required.
531 *
532 * @param[in] audio_type Current audio type  (e.g. #VCE_AUDIO_ID_BLUETOOTH or usb device id)
533 *
534 * @return the value greater than 0 on success, otherwise a negative error value
535 *
536 */
537 int vce_get_audio_type(char** audio_type);
538
539 /**
540 * @brief Sets private data to Manager client.
541 *
542 * @param[in] key Private key
543 * @param[in] data Private data
544 *
545 * @return 0 on success, otherwise a negative error value.
546 *
547 */
548 int vce_set_private_data(const char* key, const char* data);
549
550 /**
551 * @brief Gets private data from Manager client.
552 *
553 * @param[in] key Private key
554 * @param[out] data Private data
555 *
556 * @return 0 on success, otherwise a negative error value.
557 *
558 */
559 int vce_get_private_data(const char* key, char** data);
560
561 /**
562 * @brief Request start recording.
563 *
564 * @return 0 on success, otherwise a negative error value.
565 *
566 */
567 int vce_start_recording();
568
569 /**
570 * @brief Request stop recording.
571 *
572 * @return 0 on success, otherwise a negative error value.
573 *
574 */
575 int vce_stop_recording();
576
577
578 /**
579 * @brief A structure for the VC engine functions.
580 * @details This structure contains essential callback functions for operating VC engine.
581 * @since_tizen 5.0
582 * @remarks These functions ar mandatory for operating VC engine. Therefore, all functions MUST be implemented.
583 */
584 typedef struct {
585         int version;                                            /**< Version */
586
587         /* Get engine information */
588         vce_get_info_cb         get_info;               /**< Called when the engine service user requests the basic information of VC engine */
589         vce_get_recording_format_cb     get_recording_format;   /**< Get recording format */
590         vce_foreach_supported_languages_cb foreach_langs;               /**< Foreach language list */
591         vce_is_language_supported_cb    is_lang_supported;      /**< Check language */
592
593         vce_initialize_cb                       initialize;             /**< Initialize engine */
594         vce_deinitialize_cb             deinitialize;           /**< Shutdown engine */
595
596         /* Set info */
597         vce_set_language_cb             set_language;           /**< Set language */
598         vce_set_commands_cb             set_commands;           /**< Request to set current commands */
599         vce_unset_commands_cb           unset_commands;         /**< Request to unset current commands */
600
601         /* Control recognition */
602         vce_start_cb                    start;                  /**< Start recognition */
603         vce_set_recording_data_cb               set_recording;          /**< Set recording data */
604         vce_stop_cb                     stop;                   /**< Stop recording for getting result */
605         vce_cancel_cb                   cancel;                 /**< Cancel recording and processing */
606
607         vce_set_audio_type              set_audio_type;         /**< Set audio type */
608
609         vce_set_domain_cb                       set_domain;             /**< Set domain */
610         vce_process_text_cb             process_text;           /**< Request to process text */
611         vce_process_list_event_cb               process_list_event;     /**< Request to process list event */
612         vce_process_haptic_event_cb     process_haptic_event;   /**< Request to process haptic event */
613 } vce_request_callback_s;
614
615 /**
616 * @brief Loads the engine.
617 *
618 * @param[in] argc The argument count(original)
619 * @param[in] argv The argument(original)
620 * @param[in] callback The structure of engine request callback function
621 *
622 * @return This function returns zero on success, or negative with error code on failure
623 * @retval #VCE_ERROR_NONE Successful
624 * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
625 * @retval #VCE_ERROR_OPERATION_FAILED Operation failed
626 *
627 * @pre The vce_get_engine_info() should be successful.
628 * @post The daemon calls engine functions of vce_funcs_s.
629 *
630 * @see vce_get_engine_info()
631 * @see vce_unload_engine()
632 */
633 int vce_main(int argc, char** argv, vce_request_callback_s *callback);
634
635
636 /**
637 * @brief Sends the results to the engine service user.
638 * @since_tizen 5.0
639 *
640 * @param[in] event A result event
641 * @param[in] result_id Result ids
642 * @param[in] count Result count
643 * @param[in] all_result All result text
644 * @param[in] non_fixed_result Non-fixed command result text
645 * @param[in] nlu_result NLU result text
646 * @param[in] msg Engine message (e.g. #VC_RESULT_MESSAGE_NONE, #VC_RESULT_MESSAGE_ERROR_TOO_LOUD)
647 * @param[out] user_info A user info (e.g. If ASR result is consumed, the value is 0x01. If not, the value is 0x00.)
648 * @param[in] user_data The user data passed from set callback function
649 *
650 * @pre The vce_main() function should be invoked before this function is called.
651 *               vce_stop_cb() will invoke this callback.
652 *
653 * @see vce_stop_cb()
654 */
655 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);
656
657 /**
658 * @brief Sends the ASR result to the engine service user.
659 * @since_tizen 5.0
660 *
661 * @param[in] event A asr result event
662 * @param[in] asr_result A asr result text
663 * @param[in] user_data The user data passed from the start
664 *
665 * @pre The vce_main() function should be invoked before this function is called.
666 */
667 int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, void *user_data);
668
669 /**
670 * @brief Called when the daemon gets nlg(natural language generation) result.
671 *
672 * @param[in] nlg_result A nlg result
673 * @param[in] user_data The user data passed from the start
674 */
675 int vce_send_nlg_result(const char* nlg_result, void *user_data);
676
677 /**
678 * @brief Sends the error to the engine service user.
679 * @details The following error codes can be delivered.
680 *               #VCE_ERROR_NONE,
681 *               #VCE_ERROR_OUT_OF_MEMORY,
682 *               #VCE_ERROR_IO_ERROR,
683 *               #VCE_ERROR_INVALID_PARAMETER,
684 *               #VCE_ERROR_OUT_OF_NETWORK,
685 *               #VCE_ERROR_INVALID_STATE,
686 *               #VCE_ERROR_INVALID_LANGUAGE,
687 *               #VCE_ERROR_OPERATION_FAILED,
688 *               #VCE_ERROR_NOT_SUPPORTED_FEATURE.
689 * @since_tizen 5.0
690 *
691 * @param[in] error Error type
692 * @param[in] msg Error message
693 * @param[in] user_data The user data passed from set callback function
694 *
695 * @pre The vce_main() function should be invoked before this function is called.
696 */
697 int vce_send_error(vce_error_e error, const char* msg, void *user_data);
698
699 /**
700 * @brief Sets a callback function for setting the private data to the engine service.
701 * @since_tizen 5.0
702 * @remarks The vce_private_data_set_cb() function is called when the engine service user sets the private data to the engine service.
703 *
704 * @param[in] callback_func vce_private_data_set event callback function
705 * @return
706 *
707 * @see vce_private_data_set_cb()
708 */
709 int vce_set_private_data_set_cb(vce_private_data_set_cb callback_func);
710
711 /**
712 * @brief Sets a callback function for requesting the private data to the engine service.
713 * @since_tizen 5.0
714 * @remarks The vce_private_data_requested_cb() function is called when the engine service user requests the private data to the engine service.
715 *
716 * @param[in] callback_func vce_private_data_requested event callback function
717 * @return
718 *
719 * @see vce_private_data_requested_cb()
720 */
721 int vce_set_private_data_requested_cb(vce_private_data_requested_cb callback_func);
722
723 /**
724 * @brief Sets a callback function for requesting the NLU base information to the engine service.
725 * @since_tizen 5.0
726 * @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.
727 *
728 * @param[in] callback_func vce_nlu_base_info_requested event callback function
729 * @return
730 *
731 * @see vce_nlu_base_info_requested_cb()
732 */
733 int vce_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_func);
734
735
736 #ifdef __cplusplus
737 }
738 #endif
739
740 /**
741 * @}@}
742 */
743
744 #endif /* __VCE_H__ */
745
746