1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
/*
* DA probe
*
* Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
*
* Jaewon Lim <jaewon81.lim@samsung.com>
* Woojin Jung <woojin2.jung@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Contributors:
* - S-Core Co., Ltd
*
*/
#ifndef _DAHELPER_H_
#define _DAHELPER_H_
#include <stdbool.h>
#include <pthread.h> // for pthread_mutex_t
#include <Evas.h>
#include "daprobe.h"
#include "dacapture.h"
#ifdef __cplusplus
extern "C"{
#endif
#define MAX_PATH_LENGTH 256
#define MAX_STACK_DEPTH 128
#define TRIM_STACK_DEPTH 2
/*
#define WIN_RENDER_POST 0
#define CONTROLBAR_RENDER_POST 1
#define NAVIFRAME_RENDER_POST 2
#define PAGER_RENDER_POST 3
#define RENDER_POST_COUNT 4
#define SNAPSHOT_WAIT_TIME_MAX 10000
*/
#define SCREENSHOT_SET() \
do { \
int old; \
pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
old = gTraceInfo.screenshot.state; \
if(gTraceInfo.screenshot.state >= 0) \
gTraceInfo.screenshot.state = 1; \
pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
if(old == 2) { \
if(isOptionEnabled(OPT_SNAPSHOT)) \
captureScreen(); \
} \
} while(0)
#define SCREENSHOT_UNSET() \
do { \
pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
if(gTraceInfo.screenshot.state >= 0) \
gTraceInfo.screenshot.state = 0; \
pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
} while(0)
#define SCREENSHOT_DONE() \
do { \
int old; \
pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
old = gTraceInfo.screenshot.state; \
if(gTraceInfo.screenshot.state == 1) \
gTraceInfo.screenshot.state = 2; \
pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
if(old == 1) { \
activateCaptureTimer(); \
} \
} while(0)
#define SCREENSHOT_TIMEOUT() \
do { \
int old; \
pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
old = gTraceInfo.screenshot.state; \
if(gTraceInfo.screenshot.state == 2) \
gTraceInfo.screenshot.state = 1; \
pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
if(old == 2) { \
if(isOptionEnabled(OPT_SNAPSHOT)) \
captureScreen(); \
} \
} while(0)
#define NUM_ORIGINAL_LIBRARY 10
typedef enum
{
LIB_NO = -1,
LIBC = 0,
LIBPTHREAD = 1,
LIBELEMENTARY = 2,
LIBECORE_INPUT_EVAS = 3,
LIBDAEMON = 4,
LIBCAPI_APPFW_APPLICATION = 5,
LIBGLES20 = 6,
LIBGLES30 = 6,
LIBEGL = 7,
LIBSELF = 8,
LIBEVAS = 9
} ORIGINAL_LIBRARY;
extern const char *lib_string[NUM_ORIGINAL_LIBRARY];
extern void *lib_handle[NUM_ORIGINAL_LIBRARY];
// type definition for global variable
typedef struct
{
int eventIndex;
pthread_mutex_t eventMutex;
} __indexInfo;
typedef struct
{
int daemonSock;
pthread_mutex_t sockMutex;
} __socketInfo;
typedef struct
{
char appName[128];
} __appInfo;
typedef struct
{
int state;
pthread_mutex_t ssMutex;
} __screenshotInfo;
typedef struct
{
__indexInfo index;
__socketInfo socket;
__appInfo app;
__screenshotInfo screenshot;
int stateTouch;
int init_complete;
int custom_chart_callback_count;
uint64_t optionflag;
} __traceInfo;
extern __traceInfo gTraceInfo;
/* pid/tid values */
pid_t _getpid();
pid_t _gettid();
extern void reset_pid_tid();
//wchar_t* -> char*
char *absolutize_filepath(const char *fname, char *buf, size_t bufsiz);
/* returns the real absolute file path (resolves symlinks) */
char *real_abs_path(int fd, char *buffer, size_t bufsiz);
// event related functions
int initialize_event();
int finalize_event();
int getOrientation();
void on_orientation_changed(int angle, bool capi);
// query functions
#define isOptionEnabled(OPT) ((gTraceInfo.optionflag & OPT) != 0)
#ifdef __cplusplus
}
#endif
#endif // _DAHELPER_H_
|