d8d02c3b2fa1353c3420657ad60893593a0e0793
[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 Retrieves all commands of command list using callback function.
105 * @since_tizen 3.0
106 *
107 * @param[in] vc_cmd_list The command list handle
108 * @param[in] callback Callback function to invoke
109 * @param[in] user_data The user data to be passed to the callback function
110 *
111 * @return 0 on success, otherwise a negative error value
112 * @retval #VC_ERROR_NONE Successful
113 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
114 * @retval #VC_ERROR_PERMISSION_DENIED Permission denied
115 * @retval #VC_ERROR_NOT_SUPPORTED Not supported
116 *
117 * @post This function invokes vc_cmd_list_cb() repeatedly for getting commands.
118 *
119 * @see vc_cmd_list_cb()
120 */
121 int vc_cmd_list_filter_by_type(vc_cmd_list_h original, int type, vc_cmd_list_h* filtered);
122
123 /**
124 * @brief Sets pid.
125 * @since_tizen 3.0
126 *
127 * @param[in] vc_command The command handle
128 * @param[in] pid Process id
129 *
130 * @return 0 on success, otherwise a negative error value
131 * @retval #VC_CMD_ERROR_NONE Successful
132 * @retval #VC_CMD_ERROR_INVALID_PARAMETER Invalid parameter
133 *
134 * @see vc_cmd_get_pid()
135 */
136 int vc_cmd_set_pid(vc_cmd_h vc_command, int pid);
137
138 /**
139 * @brief Sets command domain
140 * @since_tizen 3.0
141 *
142 * @param[in] vc_command The command handle
143 * @param[out] pid Process id
144 *
145 * @return 0 on success, otherwise a negative error value
146 * @retval #VC_CMD_ERROR_NONE Successful
147 * @retval #VC_CMD_ERROR_INVALID_PARAMETER Invalid parameter
148 * @retval #VC_CMD_ERROR_PERMISSION_DENIED Permission denied
149 * @retval #VC_CMD_ERROR_NOT_SUPPORTED Not supported feature
150 *
151 * @see vc_cmd_set_pid()
152 */
153 int vc_cmd_get_pid(vc_cmd_h vc_command, int* pid);
154
155 /**
156 * @brief Sets unfixed command.
157 * @since_tizen 3.0
158 *
159 * @param[in] vc_command The command handle
160 * @param[in] command The unfixed command
161 *
162 * @return 0 on success, otherwise a negative error value
163 * @retval #VC_CMD_ERROR_NONE Successful
164 * @retval #VC_CMD_ERROR_INVALID_PARAMETER Invalid parameter
165 * @retval #VC_CMD_ERROR_NOT_SUPPORTED Not supported feature
166 *
167 * @see vc_cmd_get_unfixed_command()
168 */
169 int vc_cmd_set_unfixed_command(vc_cmd_h vc_command, const char* command);
170
171 /**
172 * @brief Gets nlu json data.
173 * @since_tizen 3.0
174 *
175 * @param[in] vc_command The command handle
176 * @param[out] json The nlu json data
177 *
178 * @return 0 on success, otherwise a negative error value
179 * @retval #VC_ERROR_NONE Successful
180 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
181 * @retval #VC_ERROR_NOT_SUPPORTED Not supported feature
182 *
183 */
184 int vc_cmd_get_nlu_json(vc_cmd_h vc_cmd, char** json);
185
186 /**
187 * @brief Gets the datetime value from the sentence.
188 * @since_tizen 3.0
189 *
190 * @param[in] text The sentence to analyze
191 * @param[out] result The datetime value in the sentence
192 * @param[out] remain Remained text except time
193 *
194 * @remark If the function succeeds, @a remain must be released with free() by you when you no longer need it.
195 *       If there is no time value in @a text or the function does not work correctly,
196 *       @a result is -1. Otherwise @a result has the time value in @a text.
197 *
198 * @return 0 on success, otherwise a negative error value
199 * @retval #VC_CMD_ERROR_NONE Successful
200 * @retval #VC_ERROR_OPERATION_FAILED operation failure
201 * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory
202 * @retval #VC_CMD_ERROR_INVALID_PARAMETER Invalid parameter
203 *
204 * @see vc_cmd_set_datetime_lang()
205 */
206 int vc_cmd_get_datetime(const char *text, time_t *result, char **remain);
207
208 /**
209 * @brief Gets the commands list of commands similar to the text
210 * @since_tizen 4.0
211 *
212 * @param[in] command The text to find the similar commands
213 * @param[in] src_list The command list handle of all registered foreground and widget type commands
214 * @param[out] dst_list The commands list handle to similar commands
215 * @param[in] search_level The search level selecting depth of algorithm
216 *
217 * @remark This function can modify @a src_list by the result, So if you want to keep the content of @a src_list,
218 *       make a copy of @a src_list before running this function. And also, you need to create the list handle of
219 *       @a dst_list before running this function, because this function does not create the handle internally.
220 *
221 * @return 0 on success, otherwise a negative error value
222 * @retval #VC_ERROR_NONE Successful
223 * @retval #VC_ERROR_OPERATION_FAILED operation failure
224 * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory
225 * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter
226 */
227 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);
228
229 #ifdef __cplusplus
230 }
231 #endif
232
233 /**
234  * @}
235  */
236
237 #endif /* __VOICE_CONTROL_COMMAND_EXPAND_H__ */