Add refresh screen information event
[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 MMI_API extern int MMI_EVENT_REFRESH_SCREEN_INFORM;
45
46 //TODO. not use mmi_vision_state, use mmi_event_vision_type
47 typedef enum {
48         MMI_INPUT_EVENT_TYPE_NONE,
49         MMI_INPUT_EVENT_TYPE_VOICE_TOUCH,
50         MMI_INPUT_EVENT_TYPE_VOICE_RECOGNITION
51 } mmi_input_event_type_e;
52
53 typedef enum mmi_vision_state
54 {
55     LIKE,
56     OKAY,
57     NO
58 } mmi_vision_state;
59
60 typedef enum mmi_event_key_type
61 {
62         MMI_EVENT_KEY_TYPE_DOWN,
63         MMI_EVENT_KEY_TYPE_UP
64 } mmi_event_key_type;
65
66 typedef enum mmi_event_gesture_type
67 {
68         MMI_EVENT_GESTURE_TYPE_SWIPE_UP,
69         MMI_EVENT_GESTURE_TYPE_SWIPE_DOWN,
70         MMI_EVENT_GESTURE_TYPE_SWIPE_LEFT,
71         MMI_EVENT_GESTURE_TYPE_SWIPE_RIGHT,
72         MMI_EVENT_GESTURE_TYPE_PUSH
73 } mmi_event_gesture_type;
74
75 typedef enum mmi_event_voice_type
76 {
77         MMI_EVENT_VOICE_TYPE_UP,
78         MMI_EVENT_VOICE_TYPE_DOWN,
79         MMI_EVENT_VOICE_TYPE_LEFT,
80         MMI_EVENT_VOICE_TYPE_RIGHT,
81         MMI_EVENT_VOICE_TYPE_CANCEL,
82         MMI_EVENT_VOICE_TYPE_PLAY,
83         MMI_EVENT_VOICE_TYPE_YES,
84         MMI_EVENT_VOICE_TYPE_EXECUTE,
85         MMI_EVENT_VOICE_TYPE_BACK,
86         MMI_EVENT_VOICE_TYPE_EXIT,
87         MMI_EVENT_VOICE_TYPE_STOP,
88         MMI_EVENT_VOICE_TYPE_TERMINATE,
89         MMI_EVENT_VOICE_TYPE_SHOW_NUMBER,
90         MMI_EVENT_VOICE_TYPE_SHOW_LABEL,
91         MMI_EVENT_VOICE_TYPE_TOUCH_ONE,
92         MMI_EVENT_VOICE_TYPE_TOUCH_TWO,
93         MMI_EVENT_VOICE_TYPE_TOUCH_THREE,
94         MMI_EVENT_VOICE_TYPE_TOUCH_FOUR,
95         MMI_EVENT_VOICE_TYPE_TOUCH_FIVE,
96         MMI_EVENT_VOICE_TYPE_TOUCH_SIX,
97         MMI_EVENT_VOICE_TYPE_TOUCH_SEVEN,
98         MMI_EVENT_VOICE_TYPE_TOUCH_EIGHT,
99         MMI_EVENT_VOICE_TYPE_TOUCH_NINE,
100         MMI_EVENT_VOICE_TYPE_TOUCH_TEN,
101         MMI_EVENT_VOICE_TYPE_TOUCH_ELEVEN,
102         MMI_EVENT_VOICE_TYPE_TOUCH_TWELVE,
103         MMI_EVENT_VOICE_TYPE_TOUCH_WIFI,
104         MMI_EVENT_VOICE_TYPE_TOUCH_DATETIME,
105         MMI_EVENT_VOICE_TYPE_TOUCH_AUTOMODE,
106         MMI_EVENT_VOICE_TYPE_TOUCH_GRID,
107 } mmi_event_voice_type;
108
109 typedef enum mmi_event_vision_type
110 {
111         MMI_EVENT_VISION_TYPE_USER_ENTER,
112         MMI_EVENT_VISION_TYPE_USER_LEAVE,
113         MMI_EVENT_VISION_TYPE_USER_MOVE_AWAY,
114         MMI_EVENT_VISION_TYPE_USER_MOVE_CLOSER,
115         MMI_EVENT_VISION_TYPE_YES,
116         MMI_EVENT_VISION_TYPE_NO,
117         MMI_EVENT_VISION_TYPE_REVOKE,
118         MMI_EVENT_VISION_TYPE_STOP
119 } mmi_event_vision_type;
120
121 typedef enum mmi_event_wakeup_type
122 {
123         MMI_EVENT_WAKEUP_TYPE_WAKEUP
124 } mmi_event_wakeup_type;
125
126 typedef enum mmi_event_action_type
127 {
128         MMI_EVENT_ACTION_TYPE_PLAY,
129         MMI_EVENT_ACTION_TYPE_PAUSE,
130         MMI_EVENT_ACTION_TYPE_RESUME,
131         MMI_EVENT_ACTION_TYPE_STOP,
132         MMI_EVENT_ACTION_TYPE_EXECUTE,
133         MMI_EVENT_ACTION_TYPE_LAUNCH,
134         MMI_EVENT_ACTION_TYPE_REVOKE,
135         MMI_EVENT_ACTION_TYPE_CANCEL
136 } mmi_event_action_type;
137
138 typedef enum mmi_event_feedback_type
139 {
140         MMI_EVENT_FEEDBACK_TYPE_FEEDBACK
141 } mmi_event_feedback_type;
142
143 typedef enum mmi_event_focus_type
144 {
145         MMI_EVENT_FOCUS_TYPE_IN,
146         MMI_EVENT_FOCUS_TYPE_OUT
147 } mmi_event_focus_type;
148
149 typedef enum mmi_event_state_change_type
150 {
151         MMI_EVENT_STATE_CHANGE_TYPE_STATE_CHANGE
152 } mmi_event_state_change_type;
153
154 typedef enum mmi_voice_touch_mode
155 {
156         MMI_VOICE_TOUCH_MODE_TOOLTIP,
157         MMI_VOICE_TOUCH_MODE_GRID
158 } mmi_voice_touch_mode;
159
160 typedef struct
161 {
162         int type;
163         int timestamp;
164         bool focus_in;
165 } focus_event_arg;
166
167 typedef struct
168 {
169         int type;
170         int timestamp;
171         int state;
172         int old_state;
173 } state_change_event_arg;
174
175 typedef struct
176 {
177         int type;
178         int timestamp;
179         char *source;
180 } wakeup_event_arg;
181
182 typedef struct
183 {
184         int type;
185         int timestamp;
186         bool key_down;
187         int keycode;
188         char *keyname;
189         char *source;
190 } key_event_arg;
191
192 typedef struct
193 {
194         int type;
195         int timestamp;
196         char *source;
197 } gesture_event_arg;
198
199 typedef struct
200 {
201         int type;
202         int timestamp;
203         char *source;
204 } voice_event_arg;
205
206 typedef struct
207 {
208         int type;
209         int timestamp;
210         char *cmd;
211         char **args;
212         int nargs;
213         char *source;
214 } action_event_arg;
215
216 typedef struct
217 {
218         int type;
219         int timestamp;
220         char *feedback;
221         char *comment;
222 } feedback_event_arg;
223
224 typedef struct
225 {
226         int type;//down or up
227         int timestamp;
228         int duration;
229         double confidence;
230         int keycode;
231         bool key_down;
232         char *keyname;
233         char *source;//event source information
234 } mmi_provider_event_key;
235
236 typedef struct
237 {
238         int type;//swipe up, down, left, palm open, palm cover
239         int timestamp;
240         int duration;
241         double confidence;
242         char *source;//event source information
243 } mmi_provider_event_gesture;
244
245 typedef struct
246 {
247         int type;//play, pause, ..., yes, no
248         int timestamp;
249         int duration;
250         double confidence;
251         char *cmd;
252         char **args;
253         int nargs;//num of args
254         int result_type;//partial or final result
255         char *source;//event source information
256 } mmi_provider_event_voice;
257
258 typedef struct
259 {
260         int type;//leave, enter, move away, move closer
261         int timestamp;
262         int duration;
263         double confidence;
264         char *cmd;
265         char **args;
266         int nargs;//num of args
267         char *source;//event source information
268 } mmi_provider_event_vision;
269
270 typedef struct
271 {
272         int coord_x;
273         int coord_y;
274         int width;
275         int height;
276         char *object_id;
277         char *label;
278 } clickable_item;
279
280 typedef struct
281 {
282         int type; // number, text, grid
283         int timestamp;
284         int duration;
285         double confidence;
286         int mode;
287         int grid_depth;
288         int n_items; //num of clickable_item
289         GList *list;  // clickable_item
290 } mmi_provider_event_screen_analyzer;
291
292 typedef struct
293 {
294         double seconds; // refresh timer seconds value
295 } mmi_event_refresh_screen_inform;
296
297
298 typedef struct
299 {
300         int mode;// tooltip, grid
301         int timestamp;
302         const char *object_id;
303         int coord_x;
304         int coord_y;
305 } mmi_output_modality_voice_touch;
306
307 typedef unsigned long long ull;
308
309 typedef enum mmi_state
310 {
311         MMI_STATE_NONE,
312         MMI_STATE_INITIATION,
313         MMI_STATE_EXPLORATION,
314         MMI_STATE_EXECUTION,
315         MMI_STATE_FEEDBACK,
316         MMI_STATE_OBSERVATION,
317         MMI_STATE_TERMINATION
318 } mmi_state;
319
320 typedef enum mmi_provider_op_mode
321 {
322         MODALITY_PROVIDER_MODE_NONE,
323         MODALITY_PROVIDER_MODE_PROPAGATE_EVENT,
324         MODALITY_PROVIDER_MODE_KEEP_EVENT,
325         MODALITY_PROVIDER_MODE_DROP_EVENT,
326 } mmi_provider_op_mode;
327
328 typedef enum mmi_provider_capability
329 {
330         MODALITY_PROVIDER_CAP_NONE = 0,
331         MODALITY_PROVIDER_CAP_KEY_EVENT = (1 << 0),
332         MODALITY_PROVIDER_CAP_MOUSE_EVENT = (1 << 1),
333         MODALITY_PROVIDER_CAP_TOUCH_EVENT = (1 << 2),
334         MODALITY_PROVIDER_CAP_GESTURE_EVENT = (1 << 3),
335         MODALITY_PROVIDER_CAP_VOICE_EVENT = (1 << 4),
336         MODALITY_PROVIDER_CAP_VISION_EVENT = (1 << 5),
337         MODALITY_PROVIDER_CAP_SCREEN_ANALYZER_EVENT = (1 << 6),
338         MODALITY_PROVIDER_CAP_UNKNOWN = ((ull)1 << 62),
339         MODALITY_PROVIDER_CAP_MAX = ((ull)1 << 63)
340 } mmi_provider_capability;
341
342 typedef enum mmi_provider_result
343 {
344         MODALITY_PROVIDER_RESULT_NONE,
345         MODALITY_PROVIDER_RESULT_FAIL,
346         MODALITY_PROVIDER_RESULT_SUCCESS
347 } mmi_provider_result;
348
349 typedef struct _mmi_provider_module_data mmi_provider_module_data;
350 typedef struct _mmi_provider_module mmi_provider_module;
351 typedef struct _mmi_provider_handle mmi_provider_handle;
352
353 #define TIZEN_ERROR_MMI        -0x030F0000
354
355 typedef enum {
356         MMI_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
357         MMI_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */
358         MMI_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
359         MMI_ERROR_INVALID_PARAMETER     = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
360         MMI_ERROR_OUT_OF_NETWORK = TIZEN_ERROR_NETWORK_DOWN, /**< Network is down */
361         MMI_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< No answer from the daemon */
362         MMI_ERROR_PERMISSION_DENIED     = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
363         MMI_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< MMI NOT supported */
364         MMI_ERROR_OPERATION_FAILED = TIZEN_ERROR_MMI | 0x01, /**< Operation failed */
365 } mmi_error_e;
366
367 typedef void (*mmi_result_cb)(int input_event_type, const char *result_out, void *user_data);
368
369 #endif //__MMI_COMMON_H__