Add probe to ecore_event_evas_mouse_move
[platform/core/system/swap-probe.git] / probe_event / da_event.h
1 /*
2  *  DA probe
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: 
7  *
8  * Jaewon Lim <jaewon81.lim@samsung.com>
9  * Woojin Jung <woojin2.jung@samsung.com>
10  * Juyoung Kim <j0.kim@samsung.com>
11  * 
12  * This library is free software; you can redistribute it and/or modify it under
13  * the terms of the GNU Lesser General Public License as published by the
14  * Free Software Foundation; either version 2.1 of the License, or (at your option)
15  * any later version.
16  * 
17  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
18  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
19  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20  * License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * along with this library; if not, write to the Free Software Foundation, Inc., 51
24  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25  *
26  * Contributors:
27  * - S-Core Co., Ltd
28  * 
29  */
30
31 #ifndef __DA_EVENT_H__
32 #define __DA_EVENT_H__
33
34 #include "daprobe.h"
35
36 /*******************************************************************
37  * Type definition
38  *******************************************************************/
39
40 enum __event_type
41 {
42         _EVENT_KEY = 1,
43         _EVENT_TOUCH = 2,
44         _EVENT_GESTURE = 3,
45         _EVENT_ORIENTATION = 4,
46         _EVENT_LISTENER = 5
47 } EVENT_TYPE;
48
49 enum __key_status
50 {
51         _KEY_PRESSED = 0,
52         _KEY_RELEASED = 1
53 } KEY_STATUS;
54
55 enum __touch_status
56 {
57         _TOUCH_PRESSED = 0,
58         _TOUCH_LONG_PRESSED = 1,
59         _TOUCH_RELEASED = 2,
60         _TOUCH_MOVED = 3,
61         _TOUCH_DOUBLE_PRESSED = 4,
62         _TOUCH_FOCUS_IN = 5,
63         _TOUCH_FOCUS_OUT = 6,
64         _TOUCH_CANCELED = 7
65 } _TOUCH_STATUS;
66
67 enum __gesture_type
68 {
69         _GESTURE_FLICK = 0,
70         _GESTURE_LONGPRESS = 1,
71         _GESTURE_PANNING = 2,
72         _GESTURE_PINCH = 3,
73         _GESTURE_ROTATION = 4,
74         _GESTURE_TAP = 5,
75         _GESTURE_CUSTOM = 6
76 } GESTURE_TYPE;
77
78 enum _orientation_status
79 {
80         _OS_NONE = 0,
81         _OS_PORTRAIT = 1,
82         _OS_LANDSCAPE = 2,
83         _OS_PORTRAIT_REVERSE = 3,
84         _OS_LANDSCAPE_REVERSE = 4
85 } ORIENTATION_STATUS;
86
87
88 /*******************************************************************
89  * macros for event probe
90  *
91  * log format:
92  *              SeqNumber`,ApiName`,Time`,Pid`,Tid`,InputParm`,Return`,PCAddr`,Error`,x`,y`,\n
93  *              callstack_start`,callstack`,callstack_end
94  *
95  *******************************************************************/
96
97 #define DECLARE_VARIABLE_EVENT                  \
98         DECLARE_COMMON_VARIABLE;                        \
99         static unsigned int oldtime = 0;        \
100         int blockresult = 0
101
102 #define PRE_PROBEBLOCK_BEGIN_EVENT(FUNCNAME, LIBNAME, EVENTTYPE)        \
103         GET_REAL_FUNC(FUNCNAME, LIBNAME);                                                               \
104         do {                                                                                                                    \
105                 if(oldtime != timestamp && (EVENTTYPE != EVENT_TYPE_MOVE ||     \
106                         getTouchState() == EVENT_TYPE_DOWN ||                                   \
107                         getTouchState() == EVENT_TYPE_MOVE))                                    \
108                 {                                                                                                                       \
109                         blockresult = 1;                                                                                \
110                         detectTouchEvent(EVENTTYPE);                                                    \
111                         PRE_UNCONDITIONAL_BLOCK_BEGIN()
112
113 #define PRE_PROBEBLOCK_END_EVENT()                      \
114                         PRE_UNCONDITIONAL_BLOCK_END();  \
115                 }                                                                       \
116         } while(0)
117
118 #define BEFORE_ORIGINAL_EVENT(FUNCNAME, LIBNAME, EVENTTYPE)             \
119         DECLARE_VARIABLE_EVENT;                                                                         \
120         PRE_PROBEBLOCK_BEGIN_EVENT(FUNCNAME, LIBNAME, EVENTTYPE);       \
121         PRE_PROBEBLOCK_END_EVENT()
122
123 #define AFTER_ORIGINAL_EVENT(EVENTTYPE, INPUTFORMAT, ...)               \
124         do {                                                                                                            \
125                 if(blockresult == 1) {                                                                  \
126                         POST_UNCONDITIONAL_BLOCK_BEGIN(LC_UIEVENT);                     \
127                         APPEND_LOG_INPUT(INPUTFORMAT, __VA_ARGS__);                     \
128                         log.length += sprintf(log.data + log.length,            \
129                                         "`,`,`,`,1`,`,%d`,%d`,%d", x, y, EVENTTYPE);\
130                         APPEND_LOG_NULL_CALLSTACK();                                            \
131                         POST_UNCONDITIONAL_BLOCK_END();                                         \
132                         oldtime = timestamp;                                                            \
133                 }                                                                                                               \
134         } while(0)
135
136
137 #endif // __DA_EVENT_H__