Add logic to avoid reconnetion when finalize
[platform/core/uifw/voice-control.git] / include / voice_control_command_expand.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_COMMAND_EXPAND_H__
19 #define __VOICE_CONTROL_COMMAND_EXPAND_H__
20
21 #include <time.h>
22 #include <tizen.h>
23 #include <voice_control_command.h>
24
25
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30
31 /**
32  * @brief Enumerations of command format.
33  * @since_tizen 3.0
34  */
35 typedef enum {
36         VC_CMD_FORMAT_FIXED = 0,                /**< Fixed command only */
37         VC_CMD_FORMAT_FIXED_AND_VFIXED,         /**< Fixed + variable fixed command */
38         VC_CMD_FORMAT_VFIXED_AND_FIXED,         /**< Variable fixed + fixed command */
39         VC_CMD_FORMAT_FIXED_AND_NONFIXED,       /**< Fixed + non fixed command */
40         VC_CMD_FORMAT_NONFIXED_AND_FIXED,       /**< Non fixed + fixed command */
41         VC_CMD_FORMAT_ACTION,                   /**< Action command */
42         VC_CMD_FORMAT_PARTIAL                   /**< Partial matched command */
43 } vc_cmd_format_e;
44
45 #define VC_SEARCH_NONE_LEVEL 0
46 #define VC_SEARCH_TEXT_LEVEL 1
47 #define VC_SEARCH_WORD_LEVEL 2
48 #define VC_SEARCH_CHAR_LEVEL 3
49 #define VC_SEARCH_PRON_LEVEL 4
50
51 /**
52 * @brief Sets command domain
53 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
54 *
55 * @param[in] vc_command The command handle
56 * @param[in] domain The domain
57 *
58 * @return 0 on success, otherwise a negative error value
59 * @retval #VC_ERROR_NONE Successful
60 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
61 * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
62 * @retval #VC_ERROR_NOT_SUPPORTED Not supported feature
63 *
64 * @see vc_cmd_get_domain()
65 */
66 int vc_cmd_set_domain(vc_cmd_h vc_command, int domain);
67
68 /**
69 * @brief Gets command domain.
70 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
71 *
72 * @param[in] vc_command The command handle
73 * @param[out] domain The domain
74 *
75 * @return 0 on success, otherwise a negative error value
76 * @retval #VC_ERROR_NONE Successful
77 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
78 * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
79 * @retval #VC_ERROR_NOT_SUPPORTED Not supported feature
80 *
81 * @see vc_cmd_set_domain()
82 */
83 int vc_cmd_get_domain(vc_cmd_h vc_command, int* domain);
84
85 /**
86 * @brief Remove all commands from command list.
87 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
88 *
89 * @param[in] vc_cmd_list The command list handle
90 * @param[in] free_command The command free option @c true = release each commands in list,
91 *                       @c false = remove command from list
92 *
93 * @return 0 on success, otherwise a negative error value
94 * @retval #VC_CMD_ERROR_NONE Successful
95 * @retval #VC_CMD_ERROR_INVALID_PARAMETER Invalid parameter
96 * @retval #VC_CMD_ERROR_PERMISSION_DENIED Permission denied
97 * @retval #VC_CMD_ERROR_NOT_SUPPORTED Not supported feature
98 *
99 * @see vc_cmd_list_add()
100 */
101 int vc_cmd_list_remove_all(vc_cmd_list_h vc_cmd_list, bool free_command);
102
103 /**
104 * @brief Gets the commands list which consists of specific type of commands such as foreground or background.
105 * @since_tizen 3.0
106 * @privilege %http://tizen.org/privilege/recorder
107 * @param[in] original The original command list handle
108 * @param[in] type The command type wants to get
109 * @param[out] filtered The filtered command list handle
110 * @return @c 0 on success,
111 *                 otherwise a negative error value
112 * @retval #VC_ERROR_NONE Successful
113 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
114 * @retval #VC_ERROR_OPERATION_FAILED Operation failure
115 * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
116 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
117 */
118 int vc_cmd_list_filter_by_type(vc_cmd_list_h original, int type, vc_cmd_list_h* filtered);
119
120 /**
121 * @brief Sets pid.
122 * @since_tizen 3.0
123 *
124 * @param[in] vc_command The command handle
125 * @param[in] pid Process id
126 *
127 * @return 0 on success, otherwise a negative error value
128 * @retval #VC_CMD_ERROR_NONE Successful
129 * @retval #VC_CMD_ERROR_INVALID_PARAMETER Invalid parameter
130 *
131 * @see vc_cmd_get_pid()
132 */
133 int vc_cmd_set_pid(vc_cmd_h vc_command, int pid);
134
135 /**
136 * @brief Sets command domain
137 * @since_tizen 3.0
138 *
139 * @param[in] vc_command The command handle
140 * @param[out] pid Process id
141 *
142 * @return 0 on success, otherwise a negative error value
143 * @retval #VC_CMD_ERROR_NONE Successful
144 * @retval #VC_CMD_ERROR_INVALID_PARAMETER Invalid parameter
145 * @retval #VC_CMD_ERROR_PERMISSION_DENIED Permission denied
146 * @retval #VC_CMD_ERROR_NOT_SUPPORTED Not supported feature
147 *
148 * @see vc_cmd_set_pid()
149 */
150 int vc_cmd_get_pid(vc_cmd_h vc_command, int* pid);
151
152 /**
153 * @brief Sets unfixed command.
154 * @since_tizen 3.0
155 *
156 * @param[in] vc_command The command handle
157 * @param[in] command The unfixed command
158 *
159 * @return 0 on success, otherwise a negative error value
160 * @retval #VC_CMD_ERROR_NONE Successful
161 * @retval #VC_CMD_ERROR_INVALID_PARAMETER Invalid parameter
162 * @retval #VC_CMD_ERROR_NOT_SUPPORTED Not supported feature
163 *
164 * @see vc_cmd_get_unfixed_command()
165 */
166 int vc_cmd_set_unfixed_command(vc_cmd_h vc_command, const char* command);
167
168 /**
169 * @brief Gets nlu json data.
170 * @since_tizen 3.0
171 *
172 * @param[in] vc_command The command handle
173 * @param[out] json The nlu json data
174 *
175 * @return 0 on success, otherwise a negative error value
176 * @retval #VC_ERROR_NONE Successful
177 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
178 * @retval #VC_ERROR_NOT_SUPPORTED Not supported feature
179 *
180 */
181 int vc_cmd_get_nlu_json(vc_cmd_h vc_cmd, char** json);
182
183 /**
184 * @brief Gets the datetime value from the sentence.
185 * @since_tizen 3.0
186 *
187 * @param[in] text The sentence to analyze
188 * @param[out] result The datetime value in the sentence
189 * @param[out] remain Remained text except time
190 *
191 * @remark If the function succeeds, @a remain must be released with free() by you when you no longer need it.
192 *       If there is no time value in @a text or the function does not work correctly,
193 *       @a result is -1. Otherwise @a result has the time value in @a text.
194 *
195 * @return 0 on success, otherwise a negative error value
196 * @retval #VC_CMD_ERROR_NONE Successful
197 * @retval #VC_ERROR_OPERATION_FAILED operation failure
198 * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory
199 * @retval #VC_CMD_ERROR_INVALID_PARAMETER Invalid parameter
200 *
201 * @see vc_cmd_set_datetime_lang()
202 */
203 int vc_cmd_get_datetime(const char *text, time_t *result, char **remain);
204
205 /**
206 * @brief Gets the commands list of commands similar to the text
207 * @since_tizen 4.0
208 *
209 * @param[in] command The text to find the similar commands
210 * @param[in] src_list The command list handle of all registered foreground and widget type commands
211 * @param[out] dst_list The commands list handle to similar commands
212 * @param[in] search_level The search level selecting depth of algorithm
213 *
214 * @remark This function can modify @a src_list by the result, So if you want to keep the content of @a src_list,
215 *       make a copy of @a src_list before running this function. And also, you need to create the list handle of
216 *       @a dst_list before running this function, because this function does not create the handle internally.
217 *
218 * @return 0 on success, otherwise a negative error value
219 * @retval #VC_ERROR_NONE Successful
220 * @retval #VC_ERROR_OPERATION_FAILED operation failure
221 * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory
222 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
223 */
224 int vc_cmd_get_partially_matched_cmd_list(const char *command, vc_cmd_list_h src_list, vc_cmd_list_h dst_list, int search_level);
225
226 #ifdef __cplusplus
227 }
228 #endif
229
230 /**
231  * @}
232  */
233
234 #endif /* __VOICE_CONTROL_COMMAND_EXPAND_H__ */