Merge "Update header and doc files written in English" into tizen
[platform/core/uifw/voice-control.git] / include / voice_control_plugin_engine.h
1 /*
2 * Copyright (c) 2011-2015 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_PLUGIN_ENGINE_H__
19 #define __VOICE_CONTROL_PLUGIN_ENGINE_H__
20
21 #include <tizen.h>
22
23 /**
24 * @addtogroup VOICE_CONTROL_PLUGIN_ENGINE
25 * @{
26 */
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /**
33 * @brief Enumerations of error codes.
34 */
35 typedef enum {
36         VCP_ERROR_NONE                  = TIZEN_ERROR_NONE,             /**< Successful */
37         VCP_ERROR_OUT_OF_MEMORY         = TIZEN_ERROR_OUT_OF_MEMORY,    /**< Out of Memory */
38         VCP_ERROR_IO_ERROR              = TIZEN_ERROR_IO_ERROR,         /**< I/O error */
39         VCP_ERROR_INVALID_PARAMETER     = TIZEN_ERROR_INVALID_PARAMETER,/**< Invalid parameter */
40         VCP_ERROR_OUT_OF_NETWORK        = TIZEN_ERROR_NETWORK_DOWN,     /**< Out of network */
41         VCP_ERROR_INVALID_STATE         = -0x0100031,                   /**< Invalid state */
42         VCP_ERROR_INVALID_LANGUAGE      = -0x0100032,                   /**< Invalid language */
43         VCP_ERROR_OPERATION_FAILED      = -0x0100034,                   /**< Operation failed */
44         VCP_ERROR_NOT_SUPPORTED_FEATURE = -0x0100035                    /**< Not supported feature */
45 } vcp_error_e;
46
47 /**
48 * @brief Enumerations of audio type.
49 */
50 typedef enum {
51         VCP_AUDIO_TYPE_PCM_S16_LE = 0,  /**< Signed 16bit audio type, Little endian */
52         VCP_AUDIO_TYPE_PCM_U8           /**< Unsigned 8bit audio type */
53 } vcp_audio_type_e;
54
55 /**
56 * @brief Enumerations of callback event.
57 */
58 typedef enum {
59         VCP_RESULT_EVENT_SUCCESS = 0,           /**< Event when the recognition full result is ready  */
60         VCP_RESULT_EVENT_REJECTED,              /**< Event when the recognition result is rejected */
61         VCP_RESULT_EVENT_ERROR                  /**< Event when the recognition has failed */
62 } vcp_result_event_e;
63
64 /**
65 * @brief Enumerations of command type.
66 */
67 typedef enum {
68         VCP_COMMAND_FORMAT_FIXED = 0,           /**< Fixed command */
69         VCP_COMMAND_FORMAT_FIXED_AND_VFIXED, /**< Fixed command + variable-fixed command */
70         VCP_COMMAND_FORMAT_VFIXED_AND_FIXED, /**< variable-fixed command + Fixed command */
71         VCP_COMMAND_FORMAT_FIXED_AND_NONFIXED,  /**< Fixed command + Non-fixed command */
72         VCP_COMMAND_FORMAT_NONFIXED_AND_FIXED,  /**< Non-fixed command + Fixed command */
73         VCP_COMMAND_FORMAT_ACTION,
74         VCP_COMMAND_FORMAT_PARTIAL
75 } vcp_command_format_e;
76
77 /**
78 * @brief Definition for foreground command type.
79 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
80 */
81 #define VCP_COMMAND_TYPE_FOREGROUND     1
82
83 /**
84 * @brief Definition for background command type.
85 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
86 */
87 #define VCP_COMMAND_TYPE_BACKGROUND     2
88
89 /**
90 * @brief Definition for widget command type.
91 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
92 */
93 #define VCP_COMMAND_TYPE_WIDGET         3
94
95 /**
96 * @brief Definition for system command type.
97 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
98 */
99 #define VCP_COMMAND_TYPE_SYSTEM         4
100
101 /**
102 * @brief Definition for exclusive command type.
103 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
104 */
105 #define VCP_COMMAND_TYPE_SYSTEM_BACKGROUND      5
106
107 /**
108 * @brief Definitions for exclusive command type.
109 * @since_tizen 2.4
110 */
111 #define VCP_COMMAND_TYPE_EXCLUSIVE      6
112
113
114 /**
115 * @brief Enumerations of speech detect.
116 */
117 typedef enum {
118         VCP_SPEECH_DETECT_NONE = 0,     /**< No event */
119         VCP_SPEECH_DETECT_BEGIN,        /**< Begin of speech detected */
120         VCP_SPEECH_DETECT_END,          /**< End of speech detected */
121 } vcp_speech_detect_e;
122
123 typedef enum {
124         VCP_ASR_RESULT_EVENT_FINAL_RESULT = 0,
125         VCP_ASR_RESULT_EVENT_PARTIAL_RESULT,
126         VCP_ASR_RESULT_EVENT_ERROR
127 } vcp_asr_result_event_e;
128
129 /**
130 * @brief A structure of handle for VC command
131 */
132 typedef int vcp_cmd_h;
133
134 /**
135  * @brief Definition of bluetooth audio id.
136 */
137 #define VCP_AUDIO_ID_BLUETOOTH          "VC_AUDIO_ID_BLUETOOTH"         /**< Bluetooth audio id */
138
139 /**
140  * @brief Definition of MSF(wifi) audio id.
141 */
142 #define VCP_AUDIO_ID_MSF                "VC_AUDIO_ID_MSF"               /**< MSF (wifi) audio id */
143
144 /**
145 * @brief Definition for none message.
146 */
147 #define VC_RESULT_MESSAGE_NONE                  "vc.result.message.none"
148
149 /**
150 * @brief Definition for failed recognition because the speech is too loud to listen.
151 */
152 #define VC_RESULT_MESSAGE_ERROR_TOO_LOUD        "vc.result.message.error.too.loud"
153
154
155 /**
156 * @brief Called when the daemon gets synthesized result.
157 *
158 * @param[in] event A result event
159 * @param[in] result_id Result ids
160 * @param[in] count Result count
161 * @param[in] all_result All result text
162 * @param[in] non_fixed_result Non-fixed command result text
163 * @param[in] nlu_result NLU result text
164 * @param[in] msg Engine message (e.g. #VC_RESULT_MESSAGE_NONE, #VC_RESULT_MESSAGE_ERROR_TOO_LOUD)
165 * @param[in] user_data The user data passed from set callback function
166 *
167 * @pre vcpe_stop() will invoke this callback.
168 *
169 * @see vcpe_stop()
170 */
171 typedef void (*vcpe_result_cb)(vcp_result_event_e event, int* result_id, int count,
172                                const char* all_result, const char* non_fixed_result, const char* nlu_result, const char* msg, void *user_data);
173
174
175 /**
176 * @brief Called when the daemon gets ASR result.
177 *
178 * @param[in] event A asr result event
179 * @param[in] pre_result result text
180 * @param[in] user_data The user data passed from the start
181 */
182 typedef void (*vcpe_asr_result_cb)(vcp_asr_result_event_e event, const char* asr_result, void *user_data);
183
184 /**
185 * @brief Called when the daemon gets error.
186 *
187 * @param[in] error Error type
188 * @param[in] msg Error message
189 * @param[in] user_data The user data passed from set callback function
190 *
191 */
192 typedef void (*vcpe_error_cb)(vcp_error_e error, const char* msg, void *user_data);
193
194 /**
195 * @brief Called to retrieve the supported languages.
196 *
197 * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code
198 *               followed by ISO 639-1 for the two-letter language code \n
199 *               For example, "ko_KR" for Korean, "en_US" for American English
200 * @param[in] user_data The user data passed from the foreach function
201 *
202 * @return @c true to continue with the next iteration of the loop \n @c false to break out of the loop
203 *
204 * @pre vcpe_foreach_supported_languages() will invoke this callback.
205 *
206 * @see vcpe_foreach_supported_languages()
207 */
208 typedef bool (*vcpe_supported_language_cb)(const char* language, void* user_data);
209
210 /**
211 * @brief Initializes the engine.
212 *
213 * @param[in] result_cb A callback function for recognition result
214 * @param[in] silence_cb A callback function for silence detection
215 *
216 * @return 0 on success, otherwise a negative error value
217 * @retval #VCP_ERROR_NONE Successful
218 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
219 * @retval #VCP_ERROR_INVALID_STATE Already initialized
220 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
221 *
222 * @see vcpe_deinitialize()
223 */
224 typedef int (*vcpe_initialize)(void);
225
226 /**
227 * @brief Deinitializes the engine
228 *
229 * @return 0 on success, otherwise a negative error value
230 * @retval #VCP_ERROR_NONE Successful
231 * @retval #VCP_ERROR_INVALID_STATE Not initialized
232 *
233 * @see vcpe_initialize()
234 */
235 typedef void (*vcpe_deinitialize)(void);
236
237 /**
238 * @brief Registers a callback function for getting recognition result.
239 *
240 * @param[in] callback Callback function to register
241 * @param[in] user_data The user data to be passed to the callback function
242 *
243 * @return 0 on success, otherwise a negative error value
244 * @retval #VCP_ERROR_NONE Successful
245 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
246 *
247 * @see vcpe_result_cb()
248 */
249 typedef int (*vcpe_set_result_cb)(vcpe_result_cb callback, void* user_data);
250
251 /**
252 * @brief Registers a callback function for getting ASR recognition result.
253 *
254 * @param[in] callback Callback function to register
255 * @param[in] user_data The user data to be passed to the callback function
256 *
257 * @return 0 on success, otherwise a negative error value
258 *
259 * @see vcpe_asr_result_cb()
260 */
261 typedef int (*vcpe_set_asr_result_cb)(vcpe_asr_result_cb callback, void* user_data);
262
263 #if 0
264 /**
265 * @brief Registers a callback function for getting partial recognition result.
266 *
267 * @param[in] callback Callback function to register
268 * @param[in] user_data The user data to be passed to the callback function
269 *
270 * @return 0 on success, otherwise a negative error value
271 *
272 * @see vcpe_pre_result_cb()
273 */
274 typedef int (*vcpe_set_pre_result_cb)(vcpe_pre_result_cb callback, void* user_data);
275 #endif
276
277 /**
278 * @brief Registers a callback function for error.
279 *
280 * @param[in] callback Callback function to register
281 * @param[in] user_data The user data to be passed to the callback function
282 *
283 * @return 0 on success, otherwise a negative error value
284 *
285 */
286 typedef int (*vcpe_set_error_cb)(vcpe_error_cb callback, void* user_data);
287
288 #if 0
289 /**
290 * @brief Registers a callback function for getting NLU result.
291 *
292 * @param[in] callback Callback function to register
293 * @param[in] user_data The user data to be passed to the callback function
294 *
295 * @return 0 on success, otherwise a negative error value
296 *
297 */
298 typedef int (*vcpe_set_nlu_result_cb)(vcpe_nlu_result_cb, void* user_data);
299 #endif
300
301 /**
302 * @brief Gets recording format of the engine.
303 *
304 * @param[in] audio_id The audio device id.
305 * @param[out] types The format used by the recorder.
306 * @param[out] rate The sample rate used by the recorder.
307 * @param[out] channels The number of channels used by the recorder.
308 *
309 * @return 0 on success, otherwise a negative error value
310 * @retval #VCP_ERROR_NONE Successful
311 * @retval #VCP_ERROR_INVALID_PARAMETER Not initialized
312 */
313 typedef int (*vcpe_get_recording_format)(const char* audio_id, vcp_audio_type_e* types, int* rate, int* channels);
314
315 /**
316 * @brief Retrieves all supported languages of the engine.
317 *
318 * @param[in] callback a callback function
319 * @param[in] user_data The user data to be passed to the callback function
320 *
321 * @return 0 on success, otherwise a negative error value
322 * @retval #VCP_ERROR_NONE Successful
323 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
324 * @retval #VCP_ERROR_INVALID_STATE Not initialized
325 *
326 * @post This function invokes vcpe_supported_language_cb() repeatedly for getting supported languages.
327 *
328 * @see vcpe_supported_language_cb()
329 */
330 typedef int (*vcpe_foreach_supported_languages)(vcpe_supported_language_cb callback, void* user_data);
331
332 /**
333 * @brief Checks whether a language is supported or not.
334 *
335 * @param[in] language A language
336 *
337 * @return @c true = supported, \n @c false = not supported.
338 */
339 typedef bool (*vcpe_is_language_supported)(const char* language);
340
341 /**
342 * @brief Sets language.
343 *
344 * @param[in] language language.
345 *
346 * @return 0 on success, otherwise a negative error value
347 * @retval #VCP_ERROR_NONE Successful
348 * @retval #VCP_ERROR_INVALID_LANGUAGE Invalid language
349 * @retval #VCP_ERROR_INVALID_STATE Not initialized
350 */
351 typedef int (*vcpe_set_language)(const char* language);
352
353 /**
354 * @brief Sets command list before recognition.
355 *
356 * @remark This function should set commands via vcpd_foreach_command().
357 *
358 * @param[in] vcp_command command handle.
359 *
360 * @return 0 on success, otherwise a negative error value
361 * @retval #VCP_ERROR_NONE Successful
362 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
363 * @retval #VCP_ERROR_INVALID_STATE Invalid state
364 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
365 * @retval #VCP_ERROR_NOT_SUPPORTED_FEATURE Not supported command type
366 *
367 * @post vcpe_start() is called after this function is successful.
368 *
369 * @see vcpe_start()
370 * @see vcpd_foreach_command()
371 * @see vcpe_unset_commands()
372 */
373 typedef int (*vcpe_set_commands)(vcp_cmd_h vcp_command);
374
375 /**
376 * @brief Unset command list for reset.
377 *
378 * @return 0 on success, otherwise a negative error value
379 * @retval #VCP_ERROR_NONE Successful
380 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
381 * @retval #VCP_ERROR_INVALID_STATE Invalid state
382 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
383 *
384 * @see vcpe_set_commands()
385 */
386 typedef int (*vcpe_unset_commands)();
387
388 /**
389 * @brief Start recognition.
390 *
391 * @return 0 on success, otherwise a negative error value
392 * @retval #VCP_ERROR_NONE Successful
393 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
394 * @retval #VCP_ERROR_INVALID_STATE Invalid state
395 * @retval #VCP_ERROR_INVALID_LANGUAGE Invalid language
396 * @retval #VCP_ERROR_OUT_OF_NETWORK Out of network
397 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
398 *
399 * @pre vcpd_foreach_command() is successful.
400 *
401 * @see vcpe_set_recording_data()
402 * @see vcpe_stop()
403 * @see vcpe_cancel()
404 */
405 typedef int (*vcpe_start)(bool stop_by_silence);
406
407 /**
408 * @brief Sets recording data for speech recognition from recorder.
409 *
410 * @remark This function should be returned immediately after recording data copy.
411 *
412 * @param[in] data A recording data
413 * @param[in] length A length of recording data
414 * @param[out] silence_detected @c true Silence detected \n @c false No silence detected
415 *
416 * @return 0 on success, otherwise a negative error value
417 * @retval #VCP_ERROR_NONE Successful
418 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
419 * @retval #VCP_ERROR_INVALID_STATE Invalid state
420 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
421 *
422 * @pre vcpe_start() is successful.
423 *
424 * @see vcpe_start()
425 * @see vcpe_cancel()
426 * @see vcpe_stop()
427 */
428 typedef int(*vcpe_set_recording_data)(const void* data, unsigned int length, vcp_speech_detect_e* speech_detected);
429
430 /**
431 * @brief Stops to get the result of recognition.
432 *
433 * @return 0 on success, otherwise a negative error value
434 * @retval #VCP_ERROR_NONE Successful
435 * @retval #VCP_ERROR_INVALID_STATE Invalid state
436 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
437 * @retval #VCP_ERROR_OUT_OF_NETWORK Out of network
438 *
439 * @pre vcpe_set_recording_data() is successful.
440 *
441 * @see vcpe_start()
442 * @see vcpe_set_recording_data()
443 * @see vcpe_result_cb()
444 * @see vcpe_cancel()
445 */
446 typedef int (*vcpe_stop)(void);
447
448 /**
449 * @brief Cancels the recognition process.
450 *
451 * @return 0 on success, otherwise a negative error value.
452 * @retval #VCP_ERROR_NONE Successful.
453 * @retval #VCP_ERROR_INVALID_STATE Invalid state.
454 *
455 * @pre vcpe_start() is successful.
456 *
457 * @see vcpe_start()
458 * @see vcpe_stop()
459 */
460 typedef int (*vcpe_cancel)(void);
461
462 /**
463 * @brief Sets domain (Agent or device type)
464 *
465 * @param[in] domain available Agent or device type
466 *
467 * @return 0 on success, otherwise a negative error value.
468 *
469 */
470 typedef int (*vcpe_set_domain)(const char* domain);
471
472 /**
473 * @brief Gets essential value from nlu result. This function is available inside vcpe_nlu_result_cb()
474 *
475 * @param[in] key NLU base info key
476 * @parma[out] value NLU base info value
477 *
478 * @return 0 on success, otherwise a negative error value.
479 *
480 */
481 typedef int (*vcpe_get_nlu_base_info)(const char* key, char** value);
482
483 /**
484 * @brief Sets private data between app and engine.
485 *
486 * @param[in] key Private key
487 * @param[in] data Private data
488 *
489 * @return 0 on success, otherwise a negative error value.
490 *
491 */
492 typedef int (*vcpe_set_private_data)(const char* key, const char* data);
493
494 /**
495 * @brief Gets private data between app and engine.
496 *
497 * @param[in] key Private key
498 * @param[out] data Private data
499 *
500 * @return 0 on success, otherwise a negative error value.
501 *
502 */
503 typedef int (*vcpe_get_private_data)(const char* key, char** data);
504
505 /**
506 * @brief Request process text.
507 *
508 * @param[in] text Requested text
509 *
510 * @return 0 on success, otherwise a negative error value.
511 *
512 */
513 typedef int (*vcpe_process_text)(const char* text);
514
515 /**
516 * @brief Request list event.
517 *
518 * @param[in] event Requested list event
519 *
520 * @return 0 on success, otherwise a negative error value.
521 *
522 */
523 typedef int (*vcpe_process_list_event)(const char* event);
524
525 /**
526 * @brief Request haptic event.
527 *
528 * @param[in] event Requested haptic event
529 *
530 * @return 0 on success, otherwise a negative error value.
531 *
532 */
533 typedef int (*vcpe_process_haptic_event)(const char* event);
534
535 /**
536 * Daemon API.
537 */
538
539 /**
540 * @brief Called to retrieve the commands.
541 *
542 * @param[in] id command id
543 * @param[in] type command type
544 * @param[in] format command format
545 * @param[in] command command text
546 * @param[in] param parameter text
547 * @param[in] domain command domain
548 * @param[in] user_data The user data passed from the foreach function
549 *
550 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
551 * @pre vcpd_foreach_command() will invoke this callback.
552 *
553 * @see vcpd_foreach_command()
554 */
555 typedef bool (*vcpd_foreach_command_cb)(int id, int type, int format, const char* command, const char* param, int domain, void* user_data);
556
557 /**
558 * @brief Retrieves all commands using callback function.
559 *
560 * @param[in] vcp_command The handle to be passed to the vcpe_set_commands() function
561 * @param[in] callback The callback function to invoke
562 * @param[in] user_data The user data to be passed to the callback function
563 *
564 * @return 0 on success, otherwise a negative error value
565 * @retval #VCP_ERROR_NONE Successful
566 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
567 * @retval #VCP_ERROR_OPERATION_FAILED Operation failure
568 * @retval #VCP_ERROR_INVALID_STATE Invalid state
569 *
570 * @post This function invokes vcpd_foreach_command_cb() repeatedly for getting commands.
571 *
572 * @see vcpd_foreach_command_cb()
573 * @see vcpe_set_commands()
574 */
575 typedef int (*vcpd_foreach_command)(vcp_cmd_h vcp_command, vcpd_foreach_command_cb callback, void* user_data);
576
577 /**
578 * @brief Gets command length.
579 *
580 * @param[in] vcp_command The handle to be passed to the vcpe_set_commands() function
581 *
582 * @return the value greater than 0 on success, otherwise a negative error value
583 *
584 * @see vcpe_set_commands()
585 */
586 typedef int (*vcpd_get_command_count)(vcp_cmd_h vcp_command);
587
588 /**
589 * @brief Gets current audio type.
590 *
591 * @remarks audio_type must be released using free() when it is no longer required.
592 *
593 * @param[in] audio_type Current audio type  (e.g. #VCP_AUDIO_ID_BLUETOOTH or usb device id)
594 *
595 * @return the value greater than 0 on success, otherwise a negative error value
596 *
597 */
598 typedef int (*vcpd_get_audio_type)(char** audio_type);
599
600 /**
601 * @brief A structure of the engine functions.
602 */
603 typedef struct {
604         int size;                                               /**< Size of structure */
605         int version;                                            /**< Version */
606
607         vcpe_initialize                 initialize;             /**< Initialize engine */
608         vcpe_deinitialize               deinitialize;           /**< Shutdown engine */
609
610         /* Get engine information */
611         vcpe_get_recording_format       get_recording_format;   /**< Get recording format */
612         vcpe_foreach_supported_languages foreach_langs;         /**< Foreach language list */
613         vcpe_is_language_supported      is_lang_supported;      /**< Check language */
614
615         /* Set info */
616         vcpe_set_result_cb              set_result_cb;          /**< Set result callback */
617         vcpe_set_language               set_language;           /**< Set language */
618         vcpe_set_commands               set_commands;           /**< Request to set current commands */
619         vcpe_unset_commands             unset_commands;         /**< Request to unset current commands */
620
621         /* Control recognition */
622         vcpe_start                      start;                  /**< Start recognition */
623         vcpe_set_recording_data         set_recording;          /**< Set recording data */
624         vcpe_stop                       stop;                   /**< Stop recording for getting result */
625         vcpe_cancel                     cancel;                 /**< Cancel recording and processing */
626
627         //vcpe_set_pre_result_cb                set_pre_result_cb;      /**< Set pre result callback */
628         vcpe_set_asr_result_cb          set_asr_result_cb;      /**< Set asr result callback */
629         vcpe_set_error_cb               set_error_cb;           /**< Set error callback */
630         vcpe_set_domain                 set_domain;             /**< Set domain */
631         vcpe_get_nlu_base_info          get_nlu_base_info;      /**< Get essential info */
632         //vcpe_set_nlu_result_cb                set_nlu_result_cb;      /**< Set nlu result callback */
633         vcpe_set_private_data           set_private_data;       /**< Set private data */
634         vcpe_get_private_data           get_private_data;       /**< Get private data */
635         vcpe_process_text               process_text;           /**< Request to process text */
636         vcpe_process_list_event         process_list_event;     /**< Request to process list event */
637         vcpe_process_haptic_event       process_haptic_event;   /**< Request to process haptic event */
638 } vcpe_funcs_s;
639
640 /**
641 * @brief A structure of the daemon functions.
642 */
643 typedef struct {
644         int size;                                               /**< Size of structure */
645         int version;                                            /**< Version */
646
647         vcpd_foreach_command            foreach_command;        /**< Foreach command */
648         vcpd_get_command_count          get_command_count;      /**< Get command count */
649
650         vcpd_get_audio_type             get_audio_type;         /**< Get audio type */
651 } vcpd_funcs_s;
652
653 /**
654 * @brief Loads the engine.
655 *
656 * @param[in] pdfuncs The daemon functions
657 * @param[out] pefuncs The engine functions
658 *
659 * @return This function returns zero on success, or negative with error code on failure
660 * @retval #VCP_ERROR_NONE Successful
661 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
662 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
663 *
664 * @pre The vcp_get_engine_info() should be successful.
665 * @post The daemon calls engine functions of vcpe_funcs_s.
666 *
667 * @see vcp_get_engine_info()
668 * @see vcp_unload_engine()
669 */
670 int vcp_load_engine(vcpd_funcs_s* pdfuncs, vcpe_funcs_s* pefuncs);
671
672 /**
673 * @brief Unloads this engine by the daemon.
674 *
675 * @pre The vcp_load_engine() should be successful.
676 *
677 * @see vcp_load_engine()
678 */
679 void vcp_unload_engine(void);
680
681 /**
682 * @brief Called to get the engine base information.
683 *
684 * @param[in] engine_uuid The engine id
685 * @param[in] engine_name The engine name
686 * @param[in] engine_setting The setting ug name
687 * @param[in] use_network @c true to need network @c false not to need network.
688 * @param[in] user_data The User data passed from vcp_get_engine_info()
689 *
690 * @pre vcp_get_engine_info() will invoke this callback.
691 *
692 * @see vcp_get_engine_info()
693 */
694 typedef void (*vcpe_engine_info_cb)(const char* engine_uuid, const char* engine_name, const char* engine_setting,
695                                                                         bool use_network, void* user_data);
696
697 /**
698 * @brief Gets the engine base information before the engine is loaded by the daemon.
699 *
700 * @param[in] callback Callback function
701 * @param[in] user_data User data to be passed to the callback function
702 *
703 * @return This function returns zero on success, or negative with error code on failure
704 * @retval #VCP_ERROR_NONE Successful
705 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
706 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
707 *
708 * @post This function invokes vcpe_engine_info_cb() for getting engine information.
709 *
710 * @see vcpe_engine_info_cb()
711 * @see vcp_load_engine()
712 */
713 int vcp_get_engine_info(vcpe_engine_info_cb callback, void* user_data);
714
715
716 #ifdef __cplusplus
717 }
718 #endif
719
720 /**
721 * @}@}
722 */
723
724 #endif /* __VOICE_CONTROL_PLUGIN_ENGINE_H__ */