11d2b67093e2351472b7475be355f519645577eb
[apps/home/pwlock.git] / include / util.h
1 /*
2  *  pwlock
3  *
4  * Copyright 2012  Samsung Electronics Co., Ltd
5  *
6  * Licensed under the Flora License, Version 1.1 (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://floralicense.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 __PWLOCK_UTIL_H__
21 #define __PWLOCK_UTIL_H__
22
23 #include<dlog.h>
24 #include<Elementary.h>
25
26 #ifdef  LOG_TAG
27 #undef  LOG_TAG
28 #endif
29
30 #define LOG_TAG "pwlock"
31 #define LOGFILE "/tmp/pwlock.log"
32
33 #define ENABLE_LOG_SYSTEM
34
35 void pwlock_log(char *fmt, ...);
36 void pwlock_log_t(char *fmt, ...);
37
38 #ifdef ENABLE_LOG_SYSTEM
39 #define PWLOCK_ERR(fmt, arg...)  LOGE("["LOG_TAG"%s:%d:E] "fmt, __FILE__, __LINE__, ##arg)
40 #define PWLOCK_DBG(fmt, arg...)  LOGD("["LOG_TAG"%s:%d:D] "fmt, __FILE__, __LINE__, ##arg)
41 #define PWLOCK_WARN(fmt, arg...) LOGW("["LOG_TAG"%s:%d:D] "fmt, __FILE__, __LINE__, ##arg)
42 #else
43 #define PWLOCK_ERR(fmt, arg...)
44 #define PWLOCK_DBG(fmt, arg...)
45 #define PWLOCK_WARN(fmt, arg...)
46 #endif
47
48 #ifdef ENABLE_LOG_SYSTEM
49 #define _ERR(fmt, arg...) do { PWLOCK_ERR(fmt, ##arg); pwlock_log_t("["LOG_TAG":%d:E] "fmt, __LINE__, ##arg); } while (0)
50 #define _DBG(fmt, arg...) do { PWLOCK_DBG(fmt, ##arg); pwlock_log_t("["LOG_TAG":%d:D] "fmt, __LINE__, ##arg); } while (0)
51 #else
52 #define _ERR(...)
53 #define _DBG(...)
54 #endif
55
56 #define PWLOCK_MEMFREE(ptr) \
57         do { \
58                 if (ptr != NULL) { \
59                         free(ptr); \
60                         ptr = NULL; \
61                 } \
62         } while(0);
63
64 enum {
65         IDS_COM_SK_DONE = 0,
66         IDS_COM_BODY_ENTER_PASSWORD,
67         IDS_COM_BODY_PREVIOUS,
68         IDS_COM_SK_NEXT,
69         IDS_COM_SK_OK,
70         IDS_COM_SK_CANCEL,
71         IDS_COM_SK_START,
72
73         IDS_PWLOCK_SYSTEM_STRING_MAX,
74 };
75
76 enum {
77         IDS_IDLE_BODY_AUTOMATIC = IDS_PWLOCK_SYSTEM_STRING_MAX,
78         IDS_IDLE_HEADER_NETWORK_LOCK,
79         IDS_IDLE_HEADER_PIN_LOCK,
80         IDS_IDLE_HEADER_PUK_LOCK,
81         IDS_IDLE_HEADER_SIM_BLOCKED,
82         IDS_IDLE_HEADER_SIM_LOCK,
83         IDS_IDLE_BODY_1_ATTEMPT_LEFT,
84         IDS_IDLE_BODY_CORPORATE_PERSONALISATION_ON_ENTER_CONTROL_KEY,
85         IDS_IDLE_BODY_ENTER_NEW_PIN,
86         IDS_IDLE_BODY_ENTER_PIN,
87         IDS_IDLE_BODY_ENTER_PUK,
88         IDS_IDLE_BODY_INCORRECT_PIN,
89         IDS_IDLE_BODY_INCORRECT_PIN_TRY_AGAIN,
90         IDS_IDLE_BODY_NETWORK_PERSONALISATION_ON_ENTER_CONTROL_KEY,
91         IDS_IDLE_BODY_NETWORK_SUBSET_PERSONALISATION_ON_ENTER_CONTROL_KEY,
92         IDS_IDLE_BODY_PD_ATTEMPTS_LEFT,
93         IDS_IDLE_BODY_SERVICE_PROVIDER_PERSONALISATION_ON_ENTER_CONTROL_KEY,
94         IDS_IDLE_BODY_SIM_CARD_NOT_AVAILABLE_CONTACT_YOUR_SERVICE_PROVIDER,
95         IDS_IDLE_BODY_WRONG_PASSWORD,
96         IDS_IDLE_BUTTON_DIALER,
97         IDS_IDLE_HEADER_DISPLAY_LANGUAGE,
98         IDS_IDLE_BODY_PASSWORD_EMPTY,
99         IDS_IDLE_BODY_PD_TO_PD_DIGITS_REQUIRED,
100         IDS_IDLE_POP_PASSWORDS_NOT_MATCH,
101         IDS_IDLE_POP_PIN_CHANGED,
102         IDS_IDLE_POP_SIM_CARD_ERROR,
103         IDS_IDLE_POP_CHECKING_SIM_CARD_ING,
104         IDS_IDLE_BODY_GREETING_WELCOME,
105         IDS_SCM_BODY_WELCOME_E,
106         IDS_STU_BODY_SELECT_LANGUAGE,
107         IDS_ST_SK_EMERGENCY_CALL,
108         IDS_ST_BODY_TAP_TO_SET_UP,
109         IDS_COM_SK_SKIP,
110         IDS_ST_BODY_INSTALTAB_FINISH,
111         IDS_STU_BODY_DEVICE_IS_SET_UP_AND_READY_TO_USE,
112         IDS_STU_POP_SETUP_COMPLETE,
113         IDS_COM_BODY_NO_SIM_CARD_IN_DEVICE,
114         IDS_STU_BODY_HOW_TO_INSERT_SIM_CARD_HELP_MSG,
115         IDS_ST_BUTTON_TRY_AGAIN_ABB,
116         IDS_PWLOCK_APP_STRING_MAX,
117 };
118
119 char *pwlock_get_string(int id);
120 Evas_Object *create_win(const char *name);
121 Evas_Object *load_edj(Evas_Object * parent, const char *file,
122                       const char *group);
123 void pwlock_tolower(char *src, char *dest);
124 #endif                          /* __PWLOCK_UTIL_H__ */