tizen 2.3 release
[framework/system/swap-probe.git] / custom_chart / da_chart.h
1 /*
2  *  DA probe
3  *
4  * Copyright (c) 2000 - 2013 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_CHART_H__
32 #define __DA_CHART_H__
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 // Error code
39 #define ERR_MAX_CHART_NUMBER    -1001   // no more chart or series can be added
40 #define ERR_WRONG_HANDLE                -1002   // chart or series handle is wrong handle
41 #define ERR_WRONG_PARAMETER             -1003   // wrong parameter
42
43 typedef enum
44 {
45         CHART_TYPE_AUTO = 0,
46         CHART_TYPE_LINE = 1,
47         CHART_TYPE_BAR = 2,
48         CHART_TYPE_AREA = 3,
49         CHART_TYPE_STEP = 4
50 } series_type;
51
52 typedef enum
53 {
54         CHART_COLOR_AUTO = 0,
55         CHART_COLOR_BLUE = 1,
56         CHART_COLOR_GREEN = 2,
57         CHART_COLOR_RED = 3,
58         CHART_COLOR_BROWN = 4,
59         CHART_COLOR_PURPLE = 5,
60         CHART_COLOR_NAVY = 6,
61         CHART_COLOR_CHOCOLATE = 7,
62         CHART_COLOR_INDIGO = 8,
63         CHART_COLOR_MAGENTA = 9,
64         CHART_COLOR_TEAL = 10
65 } chart_color;
66
67 typedef enum
68 {
69         CHART_NO_CYCLE = 0,
70         CHART_INTERVAL_10MSEC = 1,
71         CHART_INTERVAL_100MSEC = 2,
72         CHART_INTERVAL_1SEC = 3
73 } chart_interval;
74
75 typedef int da_handle;
76 typedef float (* da_user_data_2_chart_data) (void* data_addr);
77
78
79 // api definition
80 #ifdef _USE_DA_
81
82 extern da_handle da_create_chart (char* chart_name);
83 extern da_handle da_create_series (da_handle charthandle, char* seriesname,
84                 series_type type, chart_color color);
85 extern da_handle da_create_default_series (da_handle charthandle, char* seriesname);
86 extern int da_set_callback (da_handle series_handle,    da_user_data_2_chart_data callback,
87                 void* data_addr, chart_interval interval);
88 extern void da_log (da_handle series_handle, float uservalue);
89
90
91 extern void da_mark (chart_color color, char* mark_text);
92
93 #else // _USE_DA_ (do not use da custom chart)
94
95 #define da_create_chart(a)                                              0
96 #define da_create_series(a, b, c, d)                    0
97 #define da_create_default_series(a, b)                  0
98 #define da_set_callback(a, b, c, d)                             0
99 #define da_log(a, b)
100
101
102 #define da_mark(color, text)
103
104 #endif  // _USE_DA_
105
106 #ifdef __cplusplus
107 }
108 #endif
109
110 #endif // __DA_CHART_H__