d45094ce263b41f06dd22b777bbf6ebadff71b5e
[platform/core/uifw/mmi-manager.git] / src / mmimgr / mmi-common.h
1 /*
2 * Copyright © 2021 Samsung Electronics co., Ltd. All Rights Reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24 #ifndef __MMI_COMMON_H__
25 #define __MMI_COMMON_H__
26
27 #include <stdbool.h>
28 #include <glib.h>
29 #include <tizen.h>
30
31 #ifndef MMI_API
32 #define MMI_API __attribute__ ((visibility("default")))
33 #endif
34
35 MMI_API extern int MMI_PROVIDER_EVENT_KEY;
36 MMI_API extern int MMI_PROVIDER_EVENT_GESTURE;
37 MMI_API extern int MMI_PROVIDER_EVENT_VOICE;
38 MMI_API extern int MMI_PROVIDER_EVENT_VISION;
39 MMI_API extern int MMI_PROVIDER_EVENT_SCREEN_ANALYZER;
40 MMI_API extern int MMI_PROVIDER_EVENT_VOICE_TOUCH;
41 MMI_API extern int MMI_VISION_EVENT_PROPAGATE;
42 MMI_API extern int MMI_VISION_EVENT_DROP;
43 MMI_API extern int MMI_VISION_EVENT_FINISH;
44
45 //TODO. not use mmi_vision_state, use mmi_event_vision_type
46 typedef enum {
47         MMI_INPUT_EVENT_TYPE_NONE,
48         MMI_INPUT_EVENT_TYPE_VOICE_TOUCH,
49         MMI_INPUT_EVENT_TYPE_VOICE_RECOGNITION
50 } mmi_input_event_type_e;
51
52 typedef enum mmi_vision_state
53 {
54     LIKE,
55     OKAY,
56     NO
57 } mmi_vision_state;
58
59 typedef enum mmi_event_key_type
60 {
61         MMI_EVENT_KEY_TYPE_DOWN,
62         MMI_EVENT_KEY_TYPE_UP
63 } mmi_event_key_type;
64
65 typedef enum mmi_event_gesture_type
66 {
67         MMI_EVENT_GESTURE_TYPE_SWIPE_UP,
68         MMI_EVENT_GESTURE_TYPE_SWIPE_DOWN,
69         MMI_EVENT_GESTURE_TYPE_SWIPE_LEFT,
70         MMI_EVENT_GESTURE_TYPE_SWIPE_RIGHT,
71         MMI_EVENT_GESTURE_TYPE_PUSH
72 } mmi_event_gesture_type;
73
74 typedef enum mmi_event_voice_type
75 {
76         MMI_EVENT_VOICE_TYPE_UP,
77         MMI_EVENT_VOICE_TYPE_DOWN,
78         MMI_EVENT_VOICE_TYPE_LEFT,
79         MMI_EVENT_VOICE_TYPE_RIGHT,
80         MMI_EVENT_VOICE_TYPE_CANCEL,
81         MMI_EVENT_VOICE_TYPE_PLAY,
82         MMI_EVENT_VOICE_TYPE_YES,
83         MMI_EVENT_VOICE_TYPE_EXECUTE,
84         MMI_EVENT_VOICE_TYPE_BACK,
85         MMI_EVENT_VOICE_TYPE_EXIT,
86         MMI_EVENT_VOICE_TYPE_STOP,
87         MMI_EVENT_VOICE_TYPE_TERMINATE,
88         MMI_EVENT_VOICE_TYPE_SHOW_NUMBER,
89         MMI_EVENT_VOICE_TYPE_SHOW_LABEL,
90         MMI_EVENT_VOICE_TYPE_TOUCH_ONE,
91         MMI_EVENT_VOICE_TYPE_TOUCH_TWO,
92         MMI_EVENT_VOICE_TYPE_TOUCH_THREE,
93         MMI_EVENT_VOICE_TYPE_TOUCH_FOUR,
94         MMI_EVENT_VOICE_TYPE_TOUCH_FIVE,
95         MMI_EVENT_VOICE_TYPE_TOUCH_SIX,
96         MMI_EVENT_VOICE_TYPE_TOUCH_SEVEN,
97         MMI_EVENT_VOICE_TYPE_TOUCH_EIGHT,
98         MMI_EVENT_VOICE_TYPE_TOUCH_NINE,
99         MMI_EVENT_VOICE_TYPE_TOUCH_TEN,
100         MMI_EVENT_VOICE_TYPE_TOUCH_ELEVEN,
101         MMI_EVENT_VOICE_TYPE_TOUCH_TWELVE,
102         MMI_EVENT_VOICE_TYPE_TOUCH_WIFI,
103         MMI_EVENT_VOICE_TYPE_TOUCH_DATETIME,
104         MMI_EVENT_VOICE_TYPE_TOUCH_AUTOMODE,
105         MMI_EVENT_VOICE_TYPE_TOUCH_GRID,
106 } mmi_event_voice_type;
107
108 typedef enum mmi_event_vision_type
109 {
110         MMI_EVENT_VISION_TYPE_USER_ENTER,
111         MMI_EVENT_VISION_TYPE_USER_LEAVE,
112         MMI_EVENT_VISION_TYPE_USER_MOVE_AWAY,
113         MMI_EVENT_VISION_TYPE_USER_MOVE_CLOSER,
114         MMI_EVENT_VISION_TYPE_YES,
115         MMI_EVENT_VISION_TYPE_NO,
116         MMI_EVENT_VISION_TYPE_REVOKE,
117         MMI_EVENT_VISION_TYPE_STOP
118 } mmi_event_vision_type;
119
120 typedef enum mmi_event_wakeup_type
121 {
122         MMI_EVENT_WAKEUP_TYPE_WAKEUP
123 } mmi_event_wakeup_type;
124
125 typedef enum mmi_event_action_type
126 {
127         MMI_EVENT_ACTION_TYPE_PLAY,
128         MMI_EVENT_ACTION_TYPE_PAUSE,
129         MMI_EVENT_ACTION_TYPE_RESUME,
130         MMI_EVENT_ACTION_TYPE_STOP,
131         MMI_EVENT_ACTION_TYPE_EXECUTE,
132         MMI_EVENT_ACTION_TYPE_LAUNCH,
133         MMI_EVENT_ACTION_TYPE_REVOKE,
134         MMI_EVENT_ACTION_TYPE_CANCEL
135 } mmi_event_action_type;
136
137 typedef enum mmi_event_feedback_type
138 {
139         MMI_EVENT_FEEDBACK_TYPE_FEEDBACK
140 } mmi_event_feedback_type;
141
142 typedef enum mmi_event_focus_type
143 {
144         MMI_EVENT_FOCUS_TYPE_IN,
145         MMI_EVENT_FOCUS_TYPE_OUT
146 } mmi_event_focus_type;
147
148 typedef enum mmi_event_state_change_type
149 {
150         MMI_EVENT_STATE_CHANGE_TYPE_STATE_CHANGE
151 } mmi_event_state_change_type;
152
153 typedef enum mmi_voice_touch_mode
154 {
155         MMI_VOICE_TOUCH_MODE_TOOLTIP,
156         MMI_VOICE_TOUCH_MODE_GRID
157 } mmi_voice_touch_mode;
158
159 typedef struct
160 {
161         int type;
162         int timestamp;
163         bool focus_in;
164 } focus_event_arg;
165
166 typedef struct
167 {
168         int type;
169         int timestamp;
170         int state;
171         int old_state;
172 } state_change_event_arg;
173
174 typedef struct
175 {
176         int type;
177         int timestamp;
178         char *source;
179 } wakeup_event_arg;
180
181 typedef struct
182 {
183         int type;
184         int timestamp;
185         bool key_down;
186         int keycode;
187         char *keyname;
188         char *source;
189 } key_event_arg;
190
191 typedef struct
192 {
193         int type;
194         int timestamp;
195         char *source;
196 } gesture_event_arg;
197
198 typedef struct
199 {
200         int type;
201         int timestamp;
202         char *source;
203 } voice_event_arg;
204
205 typedef struct
206 {
207         int type;
208         int timestamp;
209         char *cmd;
210         char **args;
211         int nargs;
212         char *source;
213 } action_event_arg;
214
215 typedef struct
216 {
217         int type;
218         int timestamp;
219         char *feedback;
220         char *comment;
221 } feedback_event_arg;
222
223 typedef struct
224 {
225         int type;//down or up
226         int timestamp;
227         int duration;
228         double confidence;
229         int keycode;
230         bool key_down;
231         char *keyname;
232         char *source;//event source information
233 } mmi_provider_event_key;
234
235 typedef struct
236 {
237         int type;//swipe up, down, left, palm open, palm cover
238         int timestamp;
239         int duration;
240         double confidence;
241         char *source;//event source information
242 } mmi_provider_event_gesture;
243
244 typedef struct
245 {
246         int type;//play, pause, ..., yes, no
247         int timestamp;
248         int duration;
249         double confidence;
250         char *cmd;
251         char **args;
252         int nargs;//num of args
253         int result_type;//partial or final result
254         char *source;//event source information
255 } mmi_provider_event_voice;
256
257 typedef struct
258 {
259         int type;//leave, enter, move away, move closer
260         int timestamp;
261         int duration;
262         double confidence;
263         char *cmd;
264         char **args;
265         int nargs;//num of args
266         char *source;//event source information
267 } mmi_provider_event_vision;
268
269 typedef struct
270 {
271         int coord_x;
272         int coord_y;
273         int width;
274         int height;
275         char *object_id;
276         char *label;
277 } clickable_item;
278
279 typedef struct
280 {
281         int type; // number, text, grid
282         int timestamp;
283         int duration;
284         double confidence;
285         int mode;
286         int grid_depth;
287         int n_items; //num of clickable_item
288         GList *list;  // clickable_item
289 } mmi_provider_event_screen_analyzer;
290
291 typedef struct
292 {
293         int mode;// tooltip, grid
294         int timestamp;
295         const char *object_id;
296         int coord_x;
297         int coord_y;
298 } mmi_output_modality_voice_touch;
299
300 typedef unsigned long long ull;
301
302 typedef enum mmi_state
303 {
304         MMI_STATE_NONE,
305         MMI_STATE_INITIATION,
306         MMI_STATE_EXPLORATION,
307         MMI_STATE_EXECUTION,
308         MMI_STATE_FEEDBACK,
309         MMI_STATE_OBSERVATION,
310         MMI_STATE_TERMINATION
311 } mmi_state;
312
313 typedef enum mmi_provider_op_mode
314 {
315         MODALITY_PROVIDER_MODE_NONE,
316         MODALITY_PROVIDER_MODE_PROPAGATE_EVENT,
317         MODALITY_PROVIDER_MODE_KEEP_EVENT,
318         MODALITY_PROVIDER_MODE_DROP_EVENT,
319 } mmi_provider_op_mode;
320
321 typedef enum mmi_provider_capability
322 {
323         MODALITY_PROVIDER_CAP_NONE = 0,
324         MODALITY_PROVIDER_CAP_KEY_EVENT = (1 << 0),
325         MODALITY_PROVIDER_CAP_MOUSE_EVENT = (1 << 1),
326         MODALITY_PROVIDER_CAP_TOUCH_EVENT = (1 << 2),
327         MODALITY_PROVIDER_CAP_GESTURE_EVENT = (1 << 3),
328         MODALITY_PROVIDER_CAP_VOICE_EVENT = (1 << 4),
329         MODALITY_PROVIDER_CAP_VISION_EVENT = (1 << 5),
330         MODALITY_PROVIDER_CAP_SCREEN_ANALYZER_EVENT = (1 << 6),
331         MODALITY_PROVIDER_CAP_UNKNOWN = ((ull)1 << 62),
332         MODALITY_PROVIDER_CAP_MAX = ((ull)1 << 63)
333 } mmi_provider_capability;
334
335 typedef enum mmi_provider_result
336 {
337         MODALITY_PROVIDER_RESULT_NONE,
338         MODALITY_PROVIDER_RESULT_FAIL,
339         MODALITY_PROVIDER_RESULT_SUCCESS
340 } mmi_provider_result;
341
342 typedef struct _mmi_provider_module_data mmi_provider_module_data;
343 typedef struct _mmi_provider_module mmi_provider_module;
344 typedef struct _mmi_provider_handle mmi_provider_handle;
345
346 #define TIZEN_ERROR_MMI        -0x030F0000
347
348 typedef enum {
349         MMI_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
350         MMI_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */
351         MMI_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
352         MMI_ERROR_INVALID_PARAMETER     = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
353         MMI_ERROR_OUT_OF_NETWORK = TIZEN_ERROR_NETWORK_DOWN, /**< Network is down */
354         MMI_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< No answer from the daemon */
355         MMI_ERROR_PERMISSION_DENIED     = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
356         MMI_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< MMI NOT supported */
357         MMI_ERROR_OPERATION_FAILED = TIZEN_ERROR_MMI | 0x01, /**< Operation failed */
358 } mmi_error_e;
359
360 typedef void (*mmi_result_cb)(int input_event_type, const char *result_out, void *user_data);
361
362 #endif //__MMI_COMMON_H__