2 * Copyright (c) 2011-2015 Samsung Electronics Co., Ltd All Rights Reserved
\r
4 * Licensed under the Apache License, Version 2.0 (the License);
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an AS IS BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
18 #ifndef __VOICE_CONTROL_PLUGIN_ENGINE_H__
\r
19 #define __VOICE_CONTROL_PLUGIN_ENGINE_H__
\r
24 * @addtogroup VOICE_CONTROL_PLUGIN_ENGINE
\r
33 * @brief Enumerations of error codes.
\r
36 VCP_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
\r
37 VCP_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */
\r
38 VCP_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
\r
39 VCP_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,/**< Invalid parameter */
\r
40 VCP_ERROR_OUT_OF_NETWORK = TIZEN_ERROR_NETWORK_DOWN, /**< Out of network */
\r
41 VCP_ERROR_INVALID_STATE = -0x0100031, /**< Invalid state */
\r
42 VCP_ERROR_INVALID_LANGUAGE = -0x0100032, /**< Invalid language */
\r
43 VCP_ERROR_OPERATION_FAILED = -0x0100034, /**< Operation failed */
\r
44 VCP_ERROR_NOT_SUPPORTED_FEATURE = -0x0100035 /**< Not supported feature */
\r
48 * @brief Enumerations of audio type.
\r
51 VCP_AUDIO_TYPE_PCM_S16_LE = 0, /**< Signed 16bit audio type, Little endian */
\r
52 VCP_AUDIO_TYPE_PCM_U8 /**< Unsigned 8bit audio type */
\r
56 * @brief Enumerations of callback event.
\r
59 VCP_RESULT_EVENT_SUCCESS = 0, /**< Event when the recognition full result is ready */
\r
60 VCP_RESULT_EVENT_REJECTED, /**< Event when the recognition result is rejected */
\r
61 VCP_RESULT_EVENT_ERROR /**< Event when the recognition has failed */
\r
62 } vcp_result_event_e;
\r
65 * @brief Enumerations of command type.
\r
68 VCP_COMMAND_FORMAT_FIXED = 0, /**< Fixed command */
\r
69 VCP_COMMAND_FORMAT_FIXED_AND_VFIXED, /**< Fixed command + variable-fixed command */
\r
70 VCP_COMMAND_FORMAT_VFIXED_AND_FIXED, /**< variable-fixed command + Fixed command */
\r
71 VCP_COMMAND_FORMAT_FIXED_AND_NONFIXED, /**< Fixed command + Non-fixed command */
\r
72 VCP_COMMAND_FORMAT_NONFIXED_AND_FIXED, /**< Non-fixed command + Fixed command */
\r
73 VCP_COMMAND_FORMAT_ACTION,
\r
74 VCP_COMMAND_FORMAT_PARTIAL
\r
75 } vcp_command_format_e;
\r
78 * @brief Definition for foreground command type.
\r
79 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
\r
81 #define VCP_COMMAND_TYPE_FOREGROUND 1
\r
84 * @brief Definition for background command type.
\r
85 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
\r
87 #define VCP_COMMAND_TYPE_BACKGROUND 2
\r
90 * @brief Definition for widget command type.
\r
91 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
\r
93 #define VCP_COMMAND_TYPE_WIDGET 3
\r
96 * @brief Definition for system command type.
\r
97 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
\r
99 #define VCP_COMMAND_TYPE_SYSTEM 4
\r
102 * @brief Definition for exclusive command type.
\r
103 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
\r
105 #define VCP_COMMAND_TYPE_SYSTEM_BACKGROUND 5
\r
108 * @brief Definitions for exclusive command type.
\r
111 #define VCP_COMMAND_TYPE_EXCLUSIVE 6
\r
115 * @brief Enumerations of speech detect.
\r
118 VCP_SPEECH_DETECT_NONE = 0, /**< No event */
\r
119 VCP_SPEECH_DETECT_BEGIN, /**< Begin of speech detected */
\r
120 VCP_SPEECH_DETECT_END, /**< End of speech detected */
\r
121 } vcp_speech_detect_e;
\r
124 VCP_ASR_RESULT_EVENT_FINAL_RESULT = 0,
\r
125 VCP_ASR_RESULT_EVENT_PARTIAL_RESULT,
\r
126 VCP_ASR_RESULT_EVENT_ERROR
\r
127 } vcp_asr_result_event_e;
\r
130 * @brief A structure of handle for VC command
\r
132 typedef int vcp_cmd_h;
\r
135 * @brief Definition of bluetooth audio id.
\r
137 #define VCP_AUDIO_ID_BLUETOOTH "VC_AUDIO_ID_BLUETOOTH" /**< Bluetooth audio id */
\r
140 * @brief Definition of MSF(wifi) audio id.
\r
142 #define VCP_AUDIO_ID_MSF "VC_AUDIO_ID_MSF" /**< MSF (wifi) audio id */
\r
145 * @brief Definition for none message.
\r
147 #define VC_RESULT_MESSAGE_NONE "vc.result.message.none"
\r
150 * @brief Definition for failed recognition because the speech is too loud to listen.
\r
152 #define VC_RESULT_MESSAGE_ERROR_TOO_LOUD "vc.result.message.error.too.loud"
\r
156 * @brief Called when the daemon gets synthesized result.
\r
158 * @param[in] event A result event
\r
159 * @param[in] result_id Result ids
\r
160 * @param[in] count Result count
\r
161 * @param[in] all_result All result text
\r
162 * @param[in] non_fixed_result Non-fixed command result text
\r
163 * @param[in] nlu_result NLU result text
\r
164 * @param[in] msg Engine message (e.g. #VC_RESULT_MESSAGE_NONE, #VC_RESULT_MESSAGE_ERROR_TOO_LOUD)
\r
165 * @param[out] user_info A user info (e.g. If ASR result is consumed, the value is 0x01. If not, the value is 0x00.)
\r
166 * @param[in] user_data The user data passed from set callback function
\r
168 * @pre vcpe_stop() will invoke this callback.
\r
172 typedef void (*vcpe_result_cb)(vcp_result_event_e event, int* result_id, int count,
\r
173 const char* all_result, const char* non_fixed_result, const char* nlu_result, const char* msg, int* user_info, void *user_data);
\r
177 * @brief Called when the daemon gets ASR result.
\r
179 * @param[in] event A asr result event
\r
180 * @param[in] pre_result result text
\r
181 * @param[in] user_data The user data passed from the start
\r
183 typedef void (*vcpe_asr_result_cb)(vcp_asr_result_event_e event, const char* asr_result, void *user_data);
\r
186 * @brief Called when the daemon gets nlg result.
\r
188 * @param[in] nlg_result Nlg result
\r
189 * @param[in] user_data The user data passed from the start
\r
191 typedef void (*vcpe_nlg_result_cb)(const char* nlg_result, void *user_data);
\r
194 * @brief Called when the daemon gets error.
\r
196 * @param[in] error Error type
\r
197 * @param[in] msg Error message
\r
198 * @param[in] user_data The user data passed from set callback function
\r
201 typedef void (*vcpe_error_cb)(vcp_error_e error, const char* msg, void *user_data);
\r
204 * @brief Called to retrieve the supported languages.
\r
206 * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code
\r
207 * followed by ISO 639-1 for the two-letter language code \n
\r
208 * For example, "ko_KR" for Korean, "en_US" for American English
\r
209 * @param[in] user_data The user data passed from the foreach function
\r
211 * @return @c true to continue with the next iteration of the loop \n @c false to break out of the loop
\r
213 * @pre vcpe_foreach_supported_languages() will invoke this callback.
\r
215 * @see vcpe_foreach_supported_languages()
\r
217 typedef bool (*vcpe_supported_language_cb)(const char* language, void* user_data);
\r
220 * @brief Initializes the engine.
\r
222 * @param[in] result_cb A callback function for recognition result
\r
223 * @param[in] silence_cb A callback function for silence detection
\r
225 * @return 0 on success, otherwise a negative error value
\r
226 * @retval #VCP_ERROR_NONE Successful
\r
227 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
\r
228 * @retval #VCP_ERROR_INVALID_STATE Already initialized
\r
229 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
\r
231 * @see vcpe_deinitialize()
\r
233 typedef int (*vcpe_initialize)(void);
\r
236 * @brief Deinitializes the engine
\r
238 * @return 0 on success, otherwise a negative error value
\r
239 * @retval #VCP_ERROR_NONE Successful
\r
240 * @retval #VCP_ERROR_INVALID_STATE Not initialized
\r
242 * @see vcpe_initialize()
\r
244 typedef void (*vcpe_deinitialize)(void);
\r
247 * @brief Registers a callback function for getting recognition result.
\r
249 * @param[in] callback Callback function to register
\r
250 * @param[in] user_data The user data to be passed to the callback function
\r
252 * @return 0 on success, otherwise a negative error value
\r
253 * @retval #VCP_ERROR_NONE Successful
\r
254 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
\r
256 * @see vcpe_result_cb()
\r
258 typedef int (*vcpe_set_result_cb)(vcpe_result_cb callback, void* user_data);
\r
261 * @brief Registers a callback function for getting ASR recognition result.
\r
263 * @param[in] callback Callback function to register
\r
264 * @param[in] user_data The user data to be passed to the callback function
\r
266 * @return 0 on success, otherwise a negative error value
\r
268 * @see vcpe_asr_result_cb()
\r
270 typedef int (*vcpe_set_asr_result_cb)(vcpe_asr_result_cb callback, void* user_data);
\r
273 * @brief Registers a callback function for getting nlg result.
\r
275 * @param[in] callback Callback function to register
\r
276 * @param[in] user_data The user data to be passed to the callback function
\r
278 * @return 0 on success, otherwise a negative error value
\r
281 typedef int (*vcpe_set_nlg_result_cb)(vcpe_nlg_result_cb, void* user_data);
\r
285 * @brief Registers a callback function for getting partial recognition result.
\r
287 * @param[in] callback Callback function to register
\r
288 * @param[in] user_data The user data to be passed to the callback function
\r
290 * @return 0 on success, otherwise a negative error value
\r
292 * @see vcpe_pre_result_cb()
\r
294 typedef int (*vcpe_set_pre_result_cb)(vcpe_pre_result_cb callback, void* user_data);
\r
298 * @brief Registers a callback function for error.
\r
300 * @param[in] callback Callback function to register
\r
301 * @param[in] user_data The user data to be passed to the callback function
\r
303 * @return 0 on success, otherwise a negative error value
\r
306 typedef int (*vcpe_set_error_cb)(vcpe_error_cb callback, void* user_data);
\r
310 * @brief Registers a callback function for getting NLU result.
\r
312 * @param[in] callback Callback function to register
\r
313 * @param[in] user_data The user data to be passed to the callback function
\r
315 * @return 0 on success, otherwise a negative error value
\r
318 typedef int (*vcpe_set_nlu_result_cb)(vcpe_nlu_result_cb, void* user_data);
\r
322 * @brief Gets recording format of the engine.
\r
324 * @param[in] audio_id The audio device id.
\r
325 * @param[out] types The format used by the recorder.
\r
326 * @param[out] rate The sample rate used by the recorder.
\r
327 * @param[out] channels The number of channels used by the recorder.
\r
329 * @return 0 on success, otherwise a negative error value
\r
330 * @retval #VCP_ERROR_NONE Successful
\r
331 * @retval #VCP_ERROR_INVALID_PARAMETER Not initialized
\r
333 typedef int (*vcpe_get_recording_format)(const char* audio_id, vcp_audio_type_e* types, int* rate, int* channels);
\r
336 * @brief Retrieves all supported languages of the engine.
\r
338 * @param[in] callback a callback function
\r
339 * @param[in] user_data The user data to be passed to the callback function
\r
341 * @return 0 on success, otherwise a negative error value
\r
342 * @retval #VCP_ERROR_NONE Successful
\r
343 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
\r
344 * @retval #VCP_ERROR_INVALID_STATE Not initialized
\r
346 * @post This function invokes vcpe_supported_language_cb() repeatedly for getting supported languages.
\r
348 * @see vcpe_supported_language_cb()
\r
350 typedef int (*vcpe_foreach_supported_languages)(vcpe_supported_language_cb callback, void* user_data);
\r
353 * @brief Checks whether a language is supported or not.
\r
355 * @param[in] language A language
\r
357 * @return @c true = supported, \n @c false = not supported.
\r
359 typedef bool (*vcpe_is_language_supported)(const char* language);
\r
362 * @brief Sets language.
\r
364 * @param[in] language language.
\r
366 * @return 0 on success, otherwise a negative error value
\r
367 * @retval #VCP_ERROR_NONE Successful
\r
368 * @retval #VCP_ERROR_INVALID_LANGUAGE Invalid language
\r
369 * @retval #VCP_ERROR_INVALID_STATE Not initialized
\r
371 typedef int (*vcpe_set_language)(const char* language);
\r
374 * @brief Sets command list before recognition.
\r
376 * @remark This function should set commands via vcpd_foreach_command().
\r
378 * @param[in] vcp_command command handle.
\r
380 * @return 0 on success, otherwise a negative error value
\r
381 * @retval #VCP_ERROR_NONE Successful
\r
382 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
\r
383 * @retval #VCP_ERROR_INVALID_STATE Invalid state
\r
384 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
\r
385 * @retval #VCP_ERROR_NOT_SUPPORTED_FEATURE Not supported command type
\r
387 * @post vcpe_start() is called after this function is successful.
\r
389 * @see vcpe_start()
\r
390 * @see vcpd_foreach_command()
\r
391 * @see vcpe_unset_commands()
\r
393 typedef int (*vcpe_set_commands)(vcp_cmd_h vcp_command);
\r
396 * @brief Unset command list for reset.
\r
398 * @return 0 on success, otherwise a negative error value
\r
399 * @retval #VCP_ERROR_NONE Successful
\r
400 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
\r
401 * @retval #VCP_ERROR_INVALID_STATE Invalid state
\r
402 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
\r
404 * @see vcpe_set_commands()
\r
406 typedef int (*vcpe_unset_commands)();
\r
409 * @brief Start recognition.
\r
411 * @return 0 on success, otherwise a negative error value
\r
412 * @retval #VCP_ERROR_NONE Successful
\r
413 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
\r
414 * @retval #VCP_ERROR_INVALID_STATE Invalid state
\r
415 * @retval #VCP_ERROR_INVALID_LANGUAGE Invalid language
\r
416 * @retval #VCP_ERROR_OUT_OF_NETWORK Out of network
\r
417 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
\r
419 * @pre vcpd_foreach_command() is successful.
\r
421 * @see vcpe_set_recording_data()
\r
423 * @see vcpe_cancel()
\r
425 typedef int (*vcpe_start)(bool stop_by_silence);
\r
428 * @brief Sets recording data for speech recognition from recorder.
\r
430 * @remark This function should be returned immediately after recording data copy.
\r
432 * @param[in] data A recording data
\r
433 * @param[in] length A length of recording data
\r
434 * @param[out] silence_detected @c true Silence detected \n @c false No silence detected
\r
436 * @return 0 on success, otherwise a negative error value
\r
437 * @retval #VCP_ERROR_NONE Successful
\r
438 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
\r
439 * @retval #VCP_ERROR_INVALID_STATE Invalid state
\r
440 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
\r
442 * @pre vcpe_start() is successful.
\r
444 * @see vcpe_start()
\r
445 * @see vcpe_cancel()
\r
448 typedef int(*vcpe_set_recording_data)(const void* data, unsigned int length, vcp_speech_detect_e* speech_detected);
\r
451 * @brief Stops to get the result of recognition.
\r
453 * @return 0 on success, otherwise a negative error value
\r
454 * @retval #VCP_ERROR_NONE Successful
\r
455 * @retval #VCP_ERROR_INVALID_STATE Invalid state
\r
456 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
\r
457 * @retval #VCP_ERROR_OUT_OF_NETWORK Out of network
\r
459 * @pre vcpe_set_recording_data() is successful.
\r
461 * @see vcpe_start()
\r
462 * @see vcpe_set_recording_data()
\r
463 * @see vcpe_result_cb()
\r
464 * @see vcpe_cancel()
\r
466 typedef int (*vcpe_stop)(void);
\r
469 * @brief Cancels the recognition process.
\r
471 * @return 0 on success, otherwise a negative error value.
\r
472 * @retval #VCP_ERROR_NONE Successful.
\r
473 * @retval #VCP_ERROR_INVALID_STATE Invalid state.
\r
475 * @pre vcpe_start() is successful.
\r
477 * @see vcpe_start()
\r
480 typedef int (*vcpe_cancel)(void);
\r
483 * @brief Set audio recording type.
\r
485 * @return 0 on success, otherwise a negative error value.
\r
486 * @retval #VCP_ERROR_NONE Successful.
\r
489 typedef int (*vcpe_set_audio_type)(const char* audio);
\r
492 * @brief Sets domain (Agent or device type)
\r
494 * @param[in] domain available Agent or device type
\r
496 * @return 0 on success, otherwise a negative error value.
\r
499 typedef int (*vcpe_set_domain)(const char* domain);
\r
502 * @brief Gets essential value from nlu result. This function is available inside vcpe_nlu_result_cb()
\r
504 * @param[in] key NLU base info key
\r
505 * @parma[out] value NLU base info value
\r
507 * @return 0 on success, otherwise a negative error value.
\r
510 typedef int (*vcpe_get_nlu_base_info)(const char* key, char** value);
\r
513 * @brief Sets private data between app and engine.
\r
515 * @param[in] key Private key
\r
516 * @param[in] data Private data
\r
518 * @return 0 on success, otherwise a negative error value.
\r
521 typedef int (*vcpe_set_private_data)(const char* key, const char* data);
\r
524 * @brief Gets private data between app and engine.
\r
526 * @param[in] key Private key
\r
527 * @param[out] data Private data
\r
529 * @return 0 on success, otherwise a negative error value.
\r
532 typedef int (*vcpe_get_private_data)(const char* key, char** data);
\r
535 * @brief Request process text.
\r
537 * @param[in] text Requested text
\r
539 * @return 0 on success, otherwise a negative error value.
\r
542 typedef int (*vcpe_process_text)(const char* text);
\r
545 * @brief Request list event.
\r
547 * @param[in] event Requested list event
\r
549 * @return 0 on success, otherwise a negative error value.
\r
552 typedef int (*vcpe_process_list_event)(const char* event);
\r
555 * @brief Request haptic event.
\r
557 * @param[in] event Requested haptic event
\r
559 * @return 0 on success, otherwise a negative error value.
\r
562 typedef int (*vcpe_process_haptic_event)(const char* event);
\r
569 * @brief Called to retrieve the commands.
\r
571 * @param[in] id command id
\r
572 * @param[in] type command type
\r
573 * @param[in] format command format
\r
574 * @param[in] command command text
\r
575 * @param[in] param parameter text
\r
576 * @param[in] domain command domain
\r
577 * @param[in] user_data The user data passed from the foreach function
\r
579 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
\r
580 * @pre vcpd_foreach_command() will invoke this callback.
\r
582 * @see vcpd_foreach_command()
\r
584 typedef bool (*vcpd_foreach_command_cb)(int id, int type, int format, const char* command, const char* param, int domain, void* user_data);
\r
587 * @brief Retrieves all commands using callback function.
\r
589 * @param[in] vcp_command The handle to be passed to the vcpe_set_commands() function
\r
590 * @param[in] callback The callback function to invoke
\r
591 * @param[in] user_data The user data to be passed to the callback function
\r
593 * @return 0 on success, otherwise a negative error value
\r
594 * @retval #VCP_ERROR_NONE Successful
\r
595 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
\r
596 * @retval #VCP_ERROR_OPERATION_FAILED Operation failure
\r
597 * @retval #VCP_ERROR_INVALID_STATE Invalid state
\r
599 * @post This function invokes vcpd_foreach_command_cb() repeatedly for getting commands.
\r
601 * @see vcpd_foreach_command_cb()
\r
602 * @see vcpe_set_commands()
\r
604 typedef int (*vcpd_foreach_command)(vcp_cmd_h vcp_command, vcpd_foreach_command_cb callback, void* user_data);
\r
607 * @brief Gets command length.
\r
609 * @param[in] vcp_command The handle to be passed to the vcpe_set_commands() function
\r
611 * @return the value greater than 0 on success, otherwise a negative error value
\r
613 * @see vcpe_set_commands()
\r
615 typedef int (*vcpd_get_command_count)(vcp_cmd_h vcp_command);
\r
618 * @brief Gets current audio type.
\r
620 * @remarks audio_type must be released using free() when it is no longer required.
\r
622 * @param[in] audio_type Current audio type (e.g. #VCP_AUDIO_ID_BLUETOOTH or usb device id)
\r
624 * @return the value greater than 0 on success, otherwise a negative error value
\r
627 typedef int (*vcpd_get_audio_type)(char** audio_type);
\r
630 * @brief Sets private data to Manager client.
\r
632 * @param[in] key Private key
\r
633 * @param[in] data Private data
\r
635 * @return 0 on success, otherwise a negative error value.
\r
638 typedef int (*vcpd_set_private_data)(const char* key, const char* data);
\r
641 * @brief Gets private data from Manager client.
\r
643 * @param[in] key Private key
\r
644 * @param[out] data Private data
\r
646 * @return 0 on success, otherwise a negative error value.
\r
649 typedef int (*vcpd_get_private_data)(const char* key, char** data);
\r
652 * @brief Request start recording.
\r
654 * @return 0 on success, otherwise a negative error value.
\r
657 typedef int (*vcpd_start_recording)();
\r
660 * @brief Request stop recording.
\r
662 * @return 0 on success, otherwise a negative error value.
\r
665 typedef int (*vcpd_stop_recording)();
\r
668 * @brief A structure of the engine functions.
\r
671 int size; /**< Size of structure */
\r
672 int version; /**< Version */
\r
674 vcpe_initialize initialize; /**< Initialize engine */
\r
675 vcpe_deinitialize deinitialize; /**< Shutdown engine */
\r
677 /* Get engine information */
\r
678 vcpe_get_recording_format get_recording_format; /**< Get recording format */
\r
679 vcpe_foreach_supported_languages foreach_langs; /**< Foreach language list */
\r
680 vcpe_is_language_supported is_lang_supported; /**< Check language */
\r
683 vcpe_set_result_cb set_result_cb; /**< Set result callback */
\r
684 vcpe_set_language set_language; /**< Set language */
\r
685 vcpe_set_commands set_commands; /**< Request to set current commands */
\r
686 vcpe_unset_commands unset_commands; /**< Request to unset current commands */
\r
688 /* Control recognition */
\r
689 vcpe_start start; /**< Start recognition */
\r
690 vcpe_set_recording_data set_recording; /**< Set recording data */
\r
691 vcpe_stop stop; /**< Stop recording for getting result */
\r
692 vcpe_cancel cancel; /**< Cancel recording and processing */
\r
694 vcpe_set_audio_type set_audio_type; /**< Set audio type */
\r
696 //vcpe_set_pre_result_cb set_pre_result_cb; /**< Set pre result callback */
\r
697 vcpe_set_asr_result_cb set_asr_result_cb; /**< Set asr result callback */
\r
698 vcpe_set_nlg_result_cb set_nlg_result_cb; /**< Set nlg result callback */
\r
699 vcpe_set_error_cb set_error_cb; /**< Set error callback */
\r
700 vcpe_set_domain set_domain; /**< Set domain */
\r
701 vcpe_get_nlu_base_info get_nlu_base_info; /**< Get essential info */
\r
702 //vcpe_set_nlu_result_cb set_nlu_result_cb; /**< Set nlu result callback */
\r
703 vcpe_set_private_data set_private_data; /**< Set private data */
\r
704 vcpe_get_private_data get_private_data; /**< Get private data */
\r
705 vcpe_process_text process_text; /**< Request to process text */
\r
706 vcpe_process_list_event process_list_event; /**< Request to process list event */
\r
707 vcpe_process_haptic_event process_haptic_event; /**< Request to process haptic event */
\r
711 * @brief A structure of the daemon functions.
\r
714 int size; /**< Size of structure */
\r
715 int version; /**< Version */
\r
717 vcpd_foreach_command foreach_command; /**< Foreach command */
\r
718 vcpd_get_command_count get_command_count; /**< Get command count */
\r
720 vcpd_get_audio_type get_audio_type; /**< Get audio type */
\r
722 vcpd_set_private_data set_private_data; /**< Set private data to Manager */
\r
723 vcpd_get_private_data get_private_data; /**< Get private data from Manager */
\r
725 vcpd_start_recording start_recording; /**< Request start recording */
\r
726 vcpd_stop_recording stop_recording; /**< Request stop recording */
\r
730 * @brief Loads the engine.
\r
732 * @param[in] pdfuncs The daemon functions
\r
733 * @param[out] pefuncs The engine functions
\r
735 * @return This function returns zero on success, or negative with error code on failure
\r
736 * @retval #VCP_ERROR_NONE Successful
\r
737 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
\r
738 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
\r
740 * @pre The vcp_get_engine_info() should be successful.
\r
741 * @post The daemon calls engine functions of vcpe_funcs_s.
\r
743 * @see vcp_get_engine_info()
\r
744 * @see vcp_unload_engine()
\r
746 int vcp_load_engine(vcpd_funcs_s* pdfuncs, vcpe_funcs_s* pefuncs);
\r
749 * @brief Unloads this engine by the daemon.
\r
751 * @pre The vcp_load_engine() should be successful.
\r
753 * @see vcp_load_engine()
\r
755 void vcp_unload_engine(void);
\r
758 * @brief Called to get the engine base information.
\r
760 * @param[in] engine_uuid The engine id
\r
761 * @param[in] engine_name The engine name
\r
762 * @param[in] engine_setting The setting ug name
\r
763 * @param[in] use_network @c true to need network @c false not to need network.
\r
764 * @param[in] user_data The User data passed from vcp_get_engine_info()
\r
766 * @pre vcp_get_engine_info() will invoke this callback.
\r
768 * @see vcp_get_engine_info()
\r
770 typedef void (*vcpe_engine_info_cb)(const char* engine_uuid, const char* engine_name, const char* engine_setting,
\r
771 bool use_network, void* user_data);
\r
774 * @brief Gets the engine base information before the engine is loaded by the daemon.
\r
776 * @param[in] callback Callback function
\r
777 * @param[in] user_data User data to be passed to the callback function
\r
779 * @return This function returns zero on success, or negative with error code on failure
\r
780 * @retval #VCP_ERROR_NONE Successful
\r
781 * @retval #VCP_ERROR_INVALID_PARAMETER Invalid parameter
\r
782 * @retval #VCP_ERROR_OPERATION_FAILED Operation failed
\r
784 * @post This function invokes vcpe_engine_info_cb() for getting engine information.
\r
786 * @see vcpe_engine_info_cb()
\r
787 * @see vcp_load_engine()
\r
789 int vcp_get_engine_info(vcpe_engine_info_cb callback, void* user_data);
\r
800 #endif /* __VOICE_CONTROL_PLUGIN_ENGINE_H__ */
\r