Fix genlist style
[apps/native/ug-wifi-efl.git] / sources / libraries / Common / include / common.h
1 /*
2  * Wi-Fi
3  *
4  * Copyright 2012 Samsung Electronics Co., Ltd
5  *
6  * Licensed under the Flora License, Version 1.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.tizenopensource.org/license
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __COMMON_H__
21 #define __COMMON_H__
22
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #endif
27
28 #include <dlog.h>
29 #include <assert.h>
30
31 #define COMMON_NAME_FUNC        "wifi/func"
32 #define COMMON_NAME_LIB         "wifi/lib"
33 #define COMMON_NAME_ERR         "wifi/err"
34 #define UG_NAME_NORMAL          "wifi_ug"
35 #define UG_NAME_RESP            "wifi_ug/resp"
36 #define UG_NAME_REQ                     "wifi_ug/req"
37 #define UG_NAME_SCAN            "wifi_ug/scan"
38 #define UG_NAME_ERR                     "wifi_ug/err"
39 #define SP_NAME_NORMAL          "wifi_sp"
40 #define SP_NAME_ERR                     "wifi_sp/err"
41
42 #define CUSTOM_EDITFIELD_PATH \
43                         "/usr/apps/wifi-efl-ug/res/edje/wifi-efl-UG/custom_editfield.edj"
44 #define SETUP_WIZARD_EDJ_PATH \
45                         "/usr/apps/wifi-efl-ug/res/edje/wifi-efl-UG/setup_wizard.edj"
46
47 /* Log Level */
48 #define COMMON_LOG_DEBUG        LOG_DEBUG
49 #define COMMON_LOG_INFO         LOG_INFO
50 #define COMMON_LOG_WARN         LOG_WARN
51 #define COMMON_LOG_ERROR        LOG_ERROR
52
53 #define MAX_DEVICE_ICON_PATH_STR_LEN                    256
54 #define SCREEN_TYPE_ID_KEY                              "screen_type_id_key"
55
56 /* Device-picker height for portrait mode*/
57 #define DEVICE_PICKER_POPUP_H           550
58
59 /* Device-picker height for portrait mode in EAP screen with keypad*/
60 #define DEVICE_PICKER_POPUP_EAP_KEYPAD_H                260
61
62 /* Device-picker height for landscape mode */
63 #define DEVICE_PICKER_POPUP_LN_H                220
64
65 /* Device-picker height for zero profiles (same as defined in EDC file)*/
66 #define DEVICE_PICKER_EMPTY_POPUP_H 100
67
68 /* Device-picker width for landscape mode */
69 #define DEVICE_PICKER_POPUP_LN_W                600
70
71 /* Genlist new style for Tizen 2.4 */
72 #define WIFI_GENLIST_1LINE_TEXT_STYLE "type1"
73 #define WIFI_GENLIST_1LINE_TEXT_ICON_STYLE "type1"
74 #define WIFI_GENLIST_2LINE_TOP_TEXT_STYLE "type1"
75 #define WIFI_GENLIST_2LINE_TOP_TEXT_ICON_STYLE "type1"
76 #define WIFI_GENLIST_2LINE_BOTTOM_TEXT_STYLE "type2"
77 #define WIFI_GENLIST_2LINE_BOTTOM_TEXT_ICON_STYLE "type2"
78 #define WIFI_GENLIST_MULTILINE_TEXT_STYLE "multiline"
79 #define WIFI_GENLIST_GROUP_INDEX_STYLE "group_index"
80
81 /* Icon Size*/
82 #define DEFAULT_BG_SIZE 96
83 #define DEFAULT_BUTTON_CIRCLE_SIZE 40
84
85 typedef enum {
86         UG_VIEW_DEFAULT = 0,
87         UG_VIEW_SETUP_WIZARD
88 } UG_TYPE;
89
90 typedef enum {
91         VIEW_MANAGER_VIEW_TYPE_MAIN,
92         VIEW_MANAGER_VIEW_TYPE_DETAIL,
93         VIEW_MANAGER_VIEW_TYPE_ADVANCED,
94         VIEW_MANAGER_VIEW_TYPE_EAP,
95         VIEW_MANAGER_VIEW_TYPE_PASSWD_POPUP,
96 } view_manager_view_type_t;
97
98 #define __COMMON_FUNC_ENTER__ \
99         FUNC_LOG(COMMON_NAME_FUNC, "[<Entering]: %s() [%d]", __func__, __LINE__)
100 #define __COMMON_FUNC_EXIT__ \
101         FUNC_LOG(COMMON_NAME_FUNC, "[Quit/>]: %s() [%d]", __func__, __LINE__)
102
103 #define FUNC_LOG(MID, format, args...) \
104         SLOG(LOG_INFO, MID, "\033[2m[%s:%d]\033[2m " format "\033[0m", __func__, __LINE__, ##args)
105 #define DEBUG_LOG(MID, format, args...) \
106         SLOG(LOG_DEBUG, MID, "\033[42m[%s:%d]\033[0m\033[32m " format "\033[0m", __func__, __LINE__, ##args)
107 #define INFO_LOG(MID, format, args...) \
108         SLOG(LOG_INFO, MID, "\033[0m[%s:%d]\033[0m " format, __func__, __LINE__, ##args)
109 #define WARN_LOG(MID, format, args...) \
110         SLOG(LOG_WARN, MID, "\033[43m[%s:%d]\033[0m\033[33m " format "\033[0m", __func__, __LINE__, ##args)
111 #define ERROR_LOG(MID, format, args...) \
112         SLOG(LOG_ERROR, MID, "\033[41m[%s:%d]\033[0m\033[31m " format "\033[0m", __func__, __LINE__, ##args)
113
114 #define SECURE_FUNC_LOG(MID, format, args...) \
115         SECURE_SLOG(LOG_INFO, MID, "\033[2m[%s:%d]\033[2m " format "\033[0m", __func__, __LINE__, ##args)
116 #define SECURE_DEBUG_LOG(MID, format, args...) \
117         SECURE_SLOG(LOG_DEBUG, MID, "\033[42m[%s:%d]\033[0m\033[32m " format "\033[0m", __func__, __LINE__, ##args)
118 #define SECURE_INFO_LOG(MID, format, args...) \
119         SECURE_SLOG(LOG_INFO, MID, "\033[0m[%s:%d]\033[0m " format, __func__, __LINE__, ##args)
120 #define SECURE_WARN_LOG(MID, format, args...) \
121         SECURE_SLOG(LOG_WARN, MID, "\033[43m[%s:%d]\033[0m\033[33m " format "\033[0m", __func__, __LINE__, ##args)
122 #define SECURE_ERROR_LOG(MID, format, args...) \
123         SECURE_SLOG(LOG_ERROR, MID, "\033[41m[%s:%d]\033[0m\033[31m " format "\033[0m", __func__, __LINE__, ##args)
124
125 #define retm_if(expr) do { \
126         if (expr) { \
127                 ERROR_LOG(COMMON_NAME_ERR, "[%s(): %d] (%s) [return]", __FUNCTION__, __LINE__, #expr); \
128                 return; \
129         } \
130 } while (0)
131
132 #define retvm_if(expr, val) do { \
133         if (expr) { \
134                 ERROR_LOG(COMMON_NAME_ERR, "[%s(): %d] (%s) [return]", __FUNCTION__, __LINE__, #expr); \
135                 return (val); \
136         } \
137 } while (0)
138
139 #define assertm_if(expr, fmt, arg...) do { \
140         if(expr) { \
141                 ERROR_LOG(COMMON_NAME_ERR, " ##(%s) -> %s() assert!!## "fmt, #expr, __FUNCTION__, ##arg); \
142                 assert(1); \
143         } \
144 } while (0) /* retvm if */
145
146 #ifdef __cplusplus
147 }
148 #endif
149
150 #endif