a4e570567f1e17f9fe4edf9e9ceddeeb9e4d43ce
[platform/core/uifw/voice-control.git] / server / vcd_main.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 __VCD_MAIN_H_
19 #define __VCD_MAIN_H_
20
21 #include <Ecore.h>
22 #include <dlog.h>
23 #include <errno.h>
24 #include <glib.h>
25 #include <stdio.h>
26 #include <stdbool.h>
27 #include <stdlib.h>
28 #include <string.h>
29 #include <tizen.h>
30 #include <unistd.h>
31
32 #include "vc_defs.h"
33
34 #include "vce.h"
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 /*
41 * Daemon Define
42 */
43
44 #define TAG_VCD "vcd"
45
46 /* for debug message */
47 /* #define RECORDER_DEBUG */
48 #define CLIENT_DATA_DEBUG
49 /* #define COMMAND_DATA_DEBUG */
50
51 typedef enum {
52         VCD_ERROR_NONE                  = TIZEN_ERROR_NONE,                     /**< Successful */
53         VCD_ERROR_OUT_OF_MEMORY         = TIZEN_ERROR_OUT_OF_MEMORY,            /**< Out of Memory */
54         VCD_ERROR_IO_ERROR              = TIZEN_ERROR_IO_ERROR,                 /**< I/O error */
55         VCD_ERROR_INVALID_PARAMETER     = TIZEN_ERROR_INVALID_PARAMETER,        /**< Invalid parameter */
56         VCD_ERROR_TIMED_OUT             = TIZEN_ERROR_TIMED_OUT,                /**< No answer from service */
57         VCD_ERROR_RECORDER_BUSY         = TIZEN_ERROR_RESOURCE_BUSY,            /**< Busy recorder */
58         VCD_ERROR_PERMISSION_DENIED     = TIZEN_ERROR_PERMISSION_DENIED,        /**< Permission denied */
59         VCD_ERROR_NOT_SUPPORTED         = TIZEN_ERROR_NOT_SUPPORTED,            /**< VC NOT supported */
60         VCD_ERROR_INVALID_STATE         = TIZEN_ERROR_VOICE_CONTROL | 0x011,    /**< Invalid state */
61         VCD_ERROR_INVALID_LANGUAGE      = TIZEN_ERROR_VOICE_CONTROL | 0x012,    /**< Invalid language */
62         VCD_ERROR_ENGINE_NOT_FOUND      = TIZEN_ERROR_VOICE_CONTROL | 0x013,    /**< No available engine */
63         VCD_ERROR_OPERATION_FAILED      = TIZEN_ERROR_VOICE_CONTROL | 0x014,    /**< Operation failed */
64         VCD_ERROR_OPERATION_REJECTED    = TIZEN_ERROR_VOICE_CONTROL | 0x015,    /**< Operation rejected */
65         VCD_ERROR_SERVICE_RESET         = TIZEN_ERROR_VOICE_CONTROL | 0x018     /**< Daemon Service reset */
66 } vcd_error_e;
67
68 typedef enum {
69         VCD_STATE_NONE = 0,
70         VCD_STATE_READY = 1,
71         VCD_STATE_RECORDING = 2,
72         VCD_STATE_PROCESSING = 3
73 } vcd_state_e;
74
75 typedef struct {
76         int version;                                            /**< Version */
77
78         /* Mandatory callbacks */
79         /* Get engine information */
80         vce_get_info_cb         get_info;               /**< Called when the engine service user requests the basic information of VC engine */
81         vce_get_recording_format_cb     get_recording_format;   /**< Get recording format */
82         vce_foreach_supported_languages_cb foreach_langs;               /**< Foreach language list */
83         vce_is_language_supported_cb    is_lang_supported;      /**< Check language */
84
85         vce_initialize_cb                       initialize;             /**< Initialize engine */
86         vce_deinitialize_cb             deinitialize;           /**< Shutdown engine */
87
88         /* Set info */
89         vce_set_language_cb             set_language;           /**< Set language */
90         vce_set_commands_cb             set_commands;           /**< Request to set current commands */
91         vce_unset_commands_cb           unset_commands;         /**< Request to unset current commands */
92
93         /* Control recognition */
94         vce_start_cb                    start;                  /**< Start recognition */
95         vce_set_recording_data_cb               set_recording;          /**< Set recording data */
96         vce_stop_cb                     stop;                   /**< Stop recording for getting result */
97         vce_cancel_cb                   cancel;                 /**< Cancel recording and processing */
98
99         vce_set_audio_type              set_audio_type;         /**< Set audio type */
100
101         vce_set_domain_cb                       set_domain;             /**< Set domain */
102         vce_process_text_cb             process_text;           /**< Request to process text */
103         vce_process_list_event_cb               process_list_event;     /**< Request to process list event */
104         vce_process_haptic_event_cb     process_haptic_event;   /**< Request to process haptic event */
105
106         /* Optional callbacks */
107         vce_private_data_set_cb         private_data_set;
108         vce_private_data_requested_cb   private_data_request;
109         vce_nlu_base_info_requested_cb  nlu_base_info_request;
110 } vc_engine_callback_s;
111
112
113 #ifdef __cplusplus
114 }
115 #endif
116
117 #endif  /* __VCD_MAIN_H_ */