summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rwxr-xr-xinclude/langs.h32
-rwxr-xr-xinclude/pwlock.h164
-rwxr-xr-xinclude/tapi.h84
-rwxr-xr-xinclude/ui-callback.h38
-rwxr-xr-xinclude/ui.h86
-rwxr-xr-xinclude/util.h126
6 files changed, 530 insertions, 0 deletions
diff --git a/include/langs.h b/include/langs.h
new file mode 100755
index 0000000..e0a94a2
--- /dev/null
+++ b/include/langs.h
@@ -0,0 +1,32 @@
+/*
+ * pwlock
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __PWLOCK_LANG_H__
+#define __PWLOCK_LANG_H__
+
+typedef struct _pwlock_lang_entry {
+ char* title;
+ char* locale;
+ int number;
+} pwlock_lang_entry;
+
+int pwlock_langlist_load(void);
+int pwlock_langlist_destroy(void);
+const char *pwlock_get_lang_title(void);
+#endif /* __PWLOCK_LANG_H__ */
diff --git a/include/pwlock.h b/include/pwlock.h
new file mode 100755
index 0000000..a07d546
--- /dev/null
+++ b/include/pwlock.h
@@ -0,0 +1,164 @@
+/*
+ * pwlock
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __PWLOCK_H__
+#define __PWLOCK_H__
+
+#include <Elementary.h>
+#include <glib.h>
+#include <aul.h>
+#include <openssl/sha.h>
+#include <sysman.h>
+
+#include "tapi.h"
+#include "ui-gadget.h"
+
+#if !defined(PACKAGE)
+#define PACKAGE "org.tizen.pwlock"
+#endif
+
+#if !defined(LOCALEDIR)
+#define LOCALEDIR "/usr/apps/org.tizen.pwlock/res/locale"
+#endif
+
+#if !defined(EDJDIR)
+#define EDJDIR "/usr/apps/"PACKAGE"/res/edje"
+#endif
+
+#if !defined(IMAGEDIR)
+#define IMAGEDIR "/usr/apps/"PACKAGE"/res/images"
+#endif
+
+#define EDJFILE EDJDIR"/"PACKAGE".edj"
+
+typedef enum _BUTTON_STATE {
+ BUTTON_STATE_NONE = 0,
+ BUTTON_STATE_NEXT_CLICKED = 1,
+ BUTTON_STATE_PREV_CLICKED = 2
+} BUTTON_STATE;
+
+struct appdata {
+ Evas_Object *win;
+
+ Evas_Object *layout_main;
+ Evas_Object *layout_contents;
+ Evas_Object *layout_entry;
+ Evas_Object *layout_second_entry;
+
+ Evas_Object *elm_bg;
+ Evas_Object *elm_navigation_frame;
+ Evas_Object *elm_button_dial;
+ Evas_Object *elm_button_done;
+ Evas_Object *elm_conform;
+
+ int ui_type;
+ int previous_ui_type;
+
+ int state;
+ TelSimLockType_t sub_state; /* for lock sub state */
+ Ecore_Idler *idler;
+
+ int is_first_boot; /* for checking first boot */
+ int is_exec_after_bootup; /* for calling pwlock from other module */
+ int is_no_sim;
+ int retry_cnt;
+
+ int alpha_window_status; /* for alpha */
+ int date_and_time_settings_loaded;
+ int language_settings_loaded; /* check the language ug first loaded or not */
+ int lock_view_loaded; /* check the lock view loaded for sim card changed */
+ int wifi_ug_loaded;
+
+ char *entry_str;
+ char *pin_str; /* only for new pin */
+ char *msg;
+ Ecore_Timer *pTimerId; /* for vconf timer id */
+ int pin_changed;
+ enum sim_stat sim_status;
+ struct tapi *t;
+ ui_gadget_h dialer_ug;
+ ui_gadget_h language_ug;
+ ui_gadget_h connection_ug;
+ ui_gadget_h date_ug;
+ ui_gadget_h current_ug;
+ Evas_Object *time_ug_layout;
+ Evas_Object *wifi_ug_layout;
+ int kill_ug; /* If 1 killed by "previous", else killed by "next" button */
+ int date_and_time_previous;
+ int cancel_setup; /* 1 means not show setup wizard,0 means show */
+ Evas_Object *popup;
+ Evas_Object *waiting_popup;
+ int win_type; /* it is set if pwlock is set to ECORE_X_WINDOW_TYPE_NOTIFICATION */
+ int tapi_smc_sid; /* it is tapi resgistered sid for smc lab test */
+
+ BUTTON_STATE btn_evt_state;
+};
+
+enum {
+ STR_E_PW, /* 0 */
+ STR_E_PIN,
+ STR_E_NEW,
+ STR_R_PIN,
+ STR_E_PUK,
+ STR_I_PUN, /* 5 */
+ STR_I_PUK,
+ STR_A_LEFT,
+ STR_DONE,
+ STR_DIAL,
+ STR_W_PW, /* 10 */
+ STR_N_MAT,
+ STR_LANG,
+ STR_SET,
+ STR_CANCEL,
+ STR_ERR_SIMLANG, /* 15 */
+ STR_ERR_UNSUPP,
+ STR_BLOCK,
+ STR_SIM_LOCK,
+ STR_NETWORK_LOCK_NCK,
+ STR_NETWORK_LOCK_NSCK, /* 20 */
+ STR_NETWORK_LOCK_SPCK,
+ STR_NETWORK_LOCK_CCK,
+ STR_PW_LENGTH, /* 23 */
+};
+
+enum {
+ _ST_FIRST,
+ _ST_TAPI_INIT,
+ _ST_SIM,
+ _ST_SIM_PINCNF,
+ _ST_SIM_PUKCNF,
+ _ST_SIM_LOCKCNF,
+ _ST_NETWORK_LOCKCNF,
+ _ST_EXIT,
+ _ST_LANG,
+ _ST_NOSIM,
+ _ST_TIME,
+ _ST_GREETING,
+ _ST_CONNECTION,
+ _ST_TUTORIAL,
+ _ST_FINISH,
+ _ST_MAX,
+};
+
+extern const char *strtbl[];
+void set_win_prop(struct appdata *ad, int type);
+void do_state(struct appdata *ad);
+void do_state_directly(int state, void *data);
+
+#endif /* __PWLOCK_H__ */
diff --git a/include/tapi.h b/include/tapi.h
new file mode 100755
index 0000000..ca76a2d
--- /dev/null
+++ b/include/tapi.h
@@ -0,0 +1,84 @@
+/*
+ * pwlock
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __PWLOCK_TAPI_H__
+#define __PWLOCK_TAPI_H__
+
+#include <tapi_common.h>
+#include <TapiUtility.h>
+#include <ITapiSim.h>
+
+enum sim_stat {
+ SIM_ERROR = -1,
+ SIM_RETRY = 0,
+ SIM_OK,
+ SIM_EMPTY,
+ SIM_REQ_PIN,
+ SIM_REQ_PUK,
+ SIM_REQ_LOCK,
+ SIM_REQ_NCK,
+ SIM_REQ_NSCK,
+ SIM_REQ_SPCK,
+ SIM_REQ_CCK,
+ SIM_BLOCKED,
+ SIM_WAITING,
+ SIM_REQUIRED_EVENT,
+ SIM_LOCK_INFO
+};
+
+struct pwlock_tapi_info {
+ enum sim_stat st; /* RETRY, OK, ERROR */
+ int retry_cnt;
+};
+
+struct tapi {
+ TapiHandle *handle;
+ struct tapi_event *evt;
+ int evt_sz;
+
+ void *cb_data;
+ void (*cb) (struct pwlock_tapi_info *, void *);
+};
+
+struct tapi_event {
+ char *event;
+ void (*tapi_notification_cb)(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
+};
+
+struct tapi *pwlock_tapi_init(void (*cb) (struct pwlock_tapi_info *, void *), void *data);
+void pwlock_tapi_exit(struct tapi **t);
+int pwlock_tapi_ready_check(void);
+int pwlock_tapi_get_sim_lock_info(struct tapi* t);
+
+enum sim_stat pwlock_tapi_check_sim(struct tapi *t, int *changed);
+
+/* tapi wrapper */
+int pwlock_tapi_verify_pins(struct tapi *t, char *code);
+int pwlock_tapi_verify_puks(struct tapi *t, char *code, char *newcode);
+int pwlock_tapi_verify_lock(struct tapi *t, char *code);
+int pwlock_tapi_disable_net_pers(struct tapi *t, char *code, TelSimLockType_t type);
+
+/* callbacks */
+void pwlock_tapi_noti_modem_power_cb(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
+void pwlock_tapi_noti_sim_status_cb(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
+void pwlock_tapi_verify_sim_pins_and_puks_cb(TapiHandle *handle, int result, void *data, void *user_data);
+void pwlock_tapi_disable_sim_facility_cb(TapiHandle *handle, int result, void *data, void *user_data);
+void pwlock_tapi_get_sim_lock_info_cb(TapiHandle *handle, int result, void *data, void *user_data);
+
+#endif /* __PWLOCK_TAPI_H__ */
diff --git a/include/ui-callback.h b/include/ui-callback.h
new file mode 100755
index 0000000..570938c
--- /dev/null
+++ b/include/ui-callback.h
@@ -0,0 +1,38 @@
+/*
+ * pwlock
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __PWLOCK_UI_CALLBACK_H__
+#define __PWLOCK_UI_CALLBACK_H__
+
+void pwlock_greeting_next_cb(void *data, Evas_Object * obj, void *e);
+void pwlock_nosim_prev_cb(void *data, Evas_Object * obj, void *e);
+void pwlock_nosim_skip_cb(void *data, Evas_Object * obj, void *e);
+void pwlock_tutorial_prev_cb(void *data, Evas_Object * obj, void *e);
+void pwlock_tutorial_next_cb(void *data, Evas_Object * obj, void *e);
+void pwlock_ug_connection_layout_cb(ui_gadget_h ug, enum ug_mode mode,
+ void *priv);
+void pwlock_ug_connection_result_cb(ui_gadget_h ug, service_h service,
+ void *priv);
+void pwlock_ug_connection_destroy_cb(ui_gadget_h ug, void *priv);
+void pwlock_popup_exit_ok_cb(void *data, Evas_Object * e, void *ei);
+void pwlock_popup_exit_cancel_cb(void *data, Evas_Object * e, void *ei);
+void pwlock_finish_prev_cb(void *data, Evas_Object * obj, void *e);
+void pwlock_finish_cb(void *data, Evas_Object * obj, void *e);
+
+#endif /* __PWLOCK_UI_CALLBACK_H__ */
diff --git a/include/ui.h b/include/ui.h
new file mode 100755
index 0000000..1e00f58
--- /dev/null
+++ b/include/ui.h
@@ -0,0 +1,86 @@
+/*
+ * pwlock
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __PWLOCK_UI_H__
+#define __PWLOCK_UI_H__
+
+#include "pwlock.h"
+
+#define PWLOCK_PASSWORD_MIN_LENGTH 4
+#define PWLOCK_PIN_PASSWORD_MAX_LENGTH 8
+#define PWLOCK_PHONE_PASSWORD_MAX_LENGTH 16
+
+enum {
+ _UI_PIN = 0,
+ _UI_PUK,
+ _UI_PUK_PIN,
+ _UI_PUK_CNF,
+ _UI_BLOCK,
+ _UI_SIM_LOCK,
+ _UI_NETWORK_LOCK_NCK,
+ _UI_NETWORK_LOCK_NSCK,
+ _UI_NETWORK_LOCK_SPCK,
+ _UI_NETWORK_LOCK_CCK,
+ _UI_LANG, //skipable view starts from here
+ _UI_NOSIM,
+ _UI_TIME,
+ _UI_KEYBOARD,
+ _UI_FACEBOOK,
+ _UI_DIALER,
+ _UI_GREETING,
+ _UI_CONNECTION,
+ _UI_DATA_MIGRATION,
+ _UI_TUTORIAL,
+ _UI_FINISH,
+ /*_UI_POPUP,*/
+};
+
+int show_splash_screen(struct appdata *ad);
+int show_greeting(struct appdata *ad);
+int show_connection(struct appdata *ad);
+int show_tutorial(struct appdata *ad);
+void show_pin(struct appdata *ad);
+void show_puk(struct appdata *ad);
+void show_puk_pin(struct appdata *ad);
+void show_block(struct appdata *ad);
+void show_sim_lock(struct appdata *ad);
+int show_lang(struct appdata *ad);
+int show_nosim(struct appdata *ad);
+int show_time(struct appdata *ad);
+int show_keyboard_setting(struct appdata *ad);
+int show_finish(struct appdata *ad);
+int show_dialer(struct appdata *ad);
+
+void pwlock_destroy(struct appdata *ad);
+void load_main(struct appdata *ad, int ui_type);
+
+void show_msg(struct appdata *ad, int strid);
+void clear_entry(struct appdata *ad);
+void _show_popup(void *data, char *msg_str);
+void show_popup_accesibility(struct appdata *ad);
+void show_popup(struct appdata *ad, const char *mesg, Eina_Bool mode);
+void show_popup_ask_exit(struct appdata *ad, const char *mesg);
+void show_waiting_popup(struct appdata *ad, const char *msg_str);
+void remove_waiting_popup(struct appdata *ad);
+Eina_Bool show_puk_do(void *data);
+void update_pw_entry(struct appdata *ad, char *input_data);
+
+Evas_Object *pwlock_add_layout_from_edj(Evas_Object *parent, const char *file,
+ const char *group);
+#endif /* __PWLOCK_UI_H__ */
diff --git a/include/util.h b/include/util.h
new file mode 100755
index 0000000..0f66c7e
--- /dev/null
+++ b/include/util.h
@@ -0,0 +1,126 @@
+/*
+ * pwlock
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __PWLOCK_UTIL_H__
+#define __PWLOCK_UTIL_H__
+
+#include<dlog.h>
+#include<Elementary.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "pwlock"
+#define LOGFILE "/tmp/pwlock.log"
+
+#define ENABLE_LOG_SYSTEM
+
+void pwlock_log(char *fmt, ...);
+void pwlock_log_t(char *fmt, ...);
+
+#ifdef ENABLE_LOG_SYSTEM
+#define PWLOCK_ERR(fmt, arg...) LOGE("["LOG_TAG"%s:%d:E] "fmt, __FILE__, __LINE__, ##arg)
+#define PWLOCK_DBG(fmt, arg...) LOGD("["LOG_TAG"%s:%d:D] "fmt, __FILE__, __LINE__, ##arg)
+#define PWLOCK_WARN(fmt, arg...) LOGW("["LOG_TAG"%s:%d:D] "fmt, __FILE__, __LINE__, ##arg)
+#else
+#define PWLOCK_ERR(fmt, arg...)
+#define PWLOCK_DBG(fmt, arg...)
+#define PWLOCK_WARN(fmt, arg...)
+#endif
+
+#ifdef ENABLE_LOG_SYSTEM
+#define _ERR(fmt, arg...) do { PWLOCK_ERR(fmt, ##arg); pwlock_log_t("["LOG_TAG":%d:E] "fmt, __LINE__, ##arg); } while (0)
+#define _DBG(fmt, arg...) do { PWLOCK_DBG(fmt, ##arg); pwlock_log_t("["LOG_TAG":%d:D] "fmt, __LINE__, ##arg); } while (0)
+#else
+#define _ERR(...)
+#define _DBG(...)
+#endif
+
+#define PWLOCK_MEMFREE(ptr) \
+ do { \
+ if (ptr != NULL) { \
+ free(ptr); \
+ ptr = NULL; \
+ } \
+ } while(0);
+
+enum {
+ IDS_COM_SK_DONE = 0,
+ IDS_COM_BODY_ENTER_PASSWORD,
+ IDS_COM_BODY_PREVIOUS,
+ IDS_COM_SK_NEXT,
+ IDS_COM_SK_OK,
+ IDS_COM_SK_CANCEL,
+ IDS_COM_SK_START,
+
+ IDS_PWLOCK_SYSTEM_STRING_MAX,
+};
+
+enum {
+ IDS_IDLE_BODY_AUTOMATIC = IDS_PWLOCK_SYSTEM_STRING_MAX,
+ IDS_IDLE_HEADER_NETWORK_LOCK,
+ IDS_IDLE_HEADER_PIN_LOCK,
+ IDS_IDLE_HEADER_PUK_LOCK,
+ IDS_IDLE_HEADER_SIM_BLOCKED,
+ IDS_IDLE_HEADER_SIM_LOCK,
+ IDS_IDLE_BODY_1_ATTEMPT_LEFT,
+ IDS_IDLE_BODY_CORPORATE_PERSONALISATION_ON_ENTER_CONTROL_KEY,
+ IDS_IDLE_BODY_ENTER_NEW_PIN,
+ IDS_IDLE_BODY_ENTER_PIN,
+ IDS_IDLE_BODY_ENTER_PUK,
+ IDS_IDLE_BODY_INCORRECT_PIN,
+ IDS_IDLE_BODY_INCORRECT_PIN_TRY_AGAIN,
+ IDS_IDLE_BODY_NETWORK_PERSONALISATION_ON_ENTER_CONTROL_KEY,
+ IDS_IDLE_BODY_NETWORK_SUBSET_PERSONALISATION_ON_ENTER_CONTROL_KEY,
+ IDS_IDLE_BODY_PD_ATTEMPTS_LEFT,
+ IDS_IDLE_BODY_SERVICE_PROVIDER_PERSONALISATION_ON_ENTER_CONTROL_KEY,
+ IDS_IDLE_BODY_SIM_CARD_NOT_AVAILABLE_CONTACT_YOUR_SERVICE_PROVIDER,
+ IDS_IDLE_BODY_WRONG_PASSWORD,
+ IDS_IDLE_BUTTON_DIALER,
+ IDS_IDLE_HEADER_DISPLAY_LANGUAGE,
+ IDS_IDLE_BODY_PASSWORD_EMPTY,
+ IDS_IDLE_BODY_PD_TO_PD_DIGITS_REQUIRED,
+ IDS_IDLE_POP_PASSWORDS_NOT_MATCH,
+ IDS_IDLE_POP_PIN_CHANGED,
+ IDS_IDLE_POP_SIM_CARD_ERROR,
+ IDS_IDLE_POP_CHECKING_SIM_CARD_ING,
+ IDS_IDLE_BODY_GREETING_WELCOME,
+ IDS_SCM_BODY_WELCOME_E,
+ IDS_STU_BODY_SELECT_LANGUAGE,
+ IDS_ST_SK_EMERGENCY_CALL,
+ IDS_ST_BODY_TAP_TO_SET_UP,
+ IDS_COM_SK_SKIP,
+ IDS_ST_BODY_INSTALTAB_FINISH,
+ IDS_STU_BODY_DEVICE_IS_SET_UP_AND_READY_TO_USE,
+ IDS_STU_POP_SETUP_COMPLETE,
+ IDS_COM_BODY_NO_SIM_CARD_IN_DEVICE,
+ IDS_STU_BODY_HOW_TO_INSERT_SIM_CARD_HELP_MSG,
+ IDS_ST_BUTTON_TRY_AGAIN_ABB,
+ IDS_ST_BODY_DATE_AND_TIME,
+ IDS_ST_BODY_SET_DATE_AND_TIME,
+ IDS_PWLOCK_APP_STRING_MAX,
+};
+
+char *pwlock_get_string(int id);
+Evas_Object *create_win(const char *name);
+Evas_Object *load_edj(Evas_Object * parent, const char *file,
+ const char *group);
+void pwlock_tolower(char *src, char *dest);
+#endif /* __PWLOCK_UTIL_H__ */