diff options
author | jinwang.an <jinwang.an@samsung.com> | 2018-10-26 11:46:10 +0900 |
---|---|---|
committer | jinwang.an <jinwang.an@samsung.com> | 2018-11-16 15:46:35 +0900 |
commit | 2d551a1dad86086426158860f4d2a792db4b22ef (patch) | |
tree | be8656b53079a90b90c0ce61bc2595663221cef8 | |
parent | 8c91ba146cf9793f2faf17cd945e5bdf95bd4ddc (diff) | |
download | watch-setting-2d551a1dad86086426158860f4d2a792db4b22ef.tar.gz watch-setting-2d551a1dad86086426158860f4d2a792db4b22ef.tar.bz2 watch-setting-2d551a1dad86086426158860f4d2a792db4b22ef.zip |
Add mobile network menusubmit/tizen/20181120.075511
> Connections > Mobile Network
Change-Id: I99ed0fcd5a708224bb62f7135b5f1d0f39d57d5c
Signed-off-by: jinwang.an <jinwang.an@samsung.com>
-rwxr-xr-x | CMakeLists.txt | 1 | ||||
-rw-r--r-- | data/groups/progress.edc | 65 | ||||
-rw-r--r-- | data/watch-setting.edc | 1 | ||||
-rw-r--r-- | include/setting-connection.h | 3 | ||||
-rw-r--r-- | include/setting-mobile-networks.h | 60 | ||||
-rw-r--r-- | include/util.h | 1 | ||||
-rw-r--r-- | src/setting-connection.c | 43 | ||||
-rw-r--r-- | src/setting-mobile-networks.c | 1665 | ||||
-rw-r--r-- | src/setting.c | 3 |
9 files changed, 1813 insertions, 29 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3847df2..3251307 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ SET(SRCS src/setting_control_haptic.c src/setting_view_toast.c src/setting-datausage.c + src/setting-mobile-networks.c ) SET(VENDOR "samsung") diff --git a/data/groups/progress.edc b/data/groups/progress.edc index 3cf9b93..5dd9a68 100644 --- a/data/groups/progress.edc +++ b/data/groups/progress.edc @@ -8,37 +8,48 @@ * it only in accordance with the terms of the license agreement * you entered into with Samsung Electronics. */ -group { name: "setting-test/progress"; - parts { +group { + name: "eext_progressbar_layout"; + parts{ part { name: "base"; - type: RECT; + type: SPACER; scale: 1; description { state: "default" 0.0; - color: 0 0 0 255; - rel1 { - relative: 0.0 0.0; - } - rel2 { - relative: 1.0 1.0; - } + min: 360 360; + max: 360 360; + fixed: 1 1; + } + } + part { name: "elm.swallow.bg"; + type: SWALLOW; + scale: 1; + description { state: "default" 0.0; + } + } + part { name: "elm.swallow.content"; + type: SWALLOW; + scale: 1; + description { state: "default" 0.0; + rel1.to: "base"; + rel2.to: "base"; + } + } + part { name: "elm.text.progressbar.full"; + type: TEXT; + scale: 1; + description { state: "default" 0.0; + fixed: 1 1; + align: 0.0 0.5; + rel.to: "base"; + rel1.relative: 0.0 0.0; + rel2.relative: 1.0 1.0; + text { + font: "Tizen:style=Regular align=left"; + size: 30; + min: 1 1; + } + color: 255 255 255 255; } } - part { name: "process"; - type: SWALLOW; - scale: 1; - description { state: "default" 0.0; - fixed: 0 0; - rel1 { - relative: 0.0 0.0; - to: "base"; - } - rel2 { - relative: 1.0 1.0; - to: "base"; - } - align: 0.5 0.5; - } - } - } } diff --git a/data/watch-setting.edc b/data/watch-setting.edc index f76724c..cc9ec2d 100644 --- a/data/watch-setting.edc +++ b/data/watch-setting.edc @@ -32,6 +32,7 @@ base_scale: 1.4; #include "groups/setting_indicator.edc" #include "groups/open_licences_popup.edc" #include "groups/bg_spinner.edc" +#include "groups/progress.edc" group { name: "scroller_custom_layout"; parts { diff --git a/include/setting-connection.h b/include/setting-connection.h index 06b8679..e9e94e3 100644 --- a/include/setting-connection.h +++ b/include/setting-connection.h @@ -36,7 +36,8 @@ enum { SETTING_CONNECTION_FLIGHT_MODE, SETTING_CONNECTION_LOCATION, #ifndef FEATURE_SETTING_EMUL - SETTING_CONNECTION_DATAUSAGE + SETTING_CONNECTION_DATAUSAGE, + SETTING_CONNECTION_MOBILE_NETWORKS #endif }; diff --git a/include/setting-mobile-networks.h b/include/setting-mobile-networks.h new file mode 100644 index 0000000..8f1f5ff --- /dev/null +++ b/include/setting-mobile-networks.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * Licensed under the Flora License, Version 1.0 (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. + * + */ +/* + * setting-datausage.h + * + * Created on: Aug 22, 2018 + * Author: JinWang An + */ + +#ifndef SETTING_MOBILE_NETWORKS_H_ +#define SETTING_MOBILE_NETWORKS_H_ + +#include <Elementary.h> +#include <libintl.h> +#include <string.h> + +enum { + SETTING_MOBILE_NETWORKS_MOBILE_DATA, + SETTING_MOBILE_NETWORKS_DATA_ROAMING, + SETTING_MOBILE_NETWORKS_NETWORK_MODE, + SETTING_MOBILE_NETWORKS_NETWORK_OPERATORS, +// SETTING_MOBILE_NETWORKS_ACCESS_POINT_NAME +}; + +struct _mobile_networks_menu_item { + char *name; + int type; + void (*func)(void *data, Evas_Object *obj, void *event_info); +}; + +typedef struct mobile_networks_Item_Data { + int index; + int menu_array_idx; + Elm_Object_Item *item; + Evas_Object *check; +} mobile_networks_Item_Data; + + + + +void _update_mobile_networks_list(); +void _clear_mobile_networks_resource(); +Evas_Object *_create_mobile_networks_list(void *data); + + +#endif /* SETTING_MOBILE_NETWORKS_H_ */ diff --git a/include/util.h b/include/util.h index 77a4197..7b52657 100644 --- a/include/util.h +++ b/include/util.h @@ -141,6 +141,7 @@ typedef struct _appdata { Evas_Object *font_size_rdg; Evas_Object *font_style_rdg; Evas_Object *data_usage_cycle_rdg; + Evas_Object *network_mode_rdg; Evas_Object *popup; Evas_Object *language_rdg; Evas_Object *wake_up_guesture_rdg; diff --git a/src/setting-connection.c b/src/setting-connection.c index b5789f8..b004b01 100644 --- a/src/setting-connection.c +++ b/src/setting-connection.c @@ -29,6 +29,7 @@ #include "setting-connection.h" #include "setting-datausage.h" +#include "setting-mobile-networks.h" #include "util.h" #include "setting_view_toast.h" #include "setting_data_vconf.h" @@ -55,6 +56,7 @@ void _flight_mode_cb(void *data, Evas_Object *obj, void *event_info); void _nfc_cb(void *data, Evas_Object *obj, void *event_info); void _location_cb(void *data, Evas_Object *obj, void *event_info); void _datausage_cb(void *data, Evas_Object *obj, void *event_info); +void _mobile_networks_cb(void *data, Evas_Object *obj, void *event_info); static void bt_status_changed_cb(int result, bt_adapter_state_e adapter_state, void *user_data); static void wifi_status_changed_cb(wifi_manager_device_state_e state, void *user_data); @@ -71,6 +73,7 @@ static struct _connection_menu_item connection_menu_its[] = { { "IDS_ST_BODY_FLIGHT_MODE", SETTING_CONNECTION_FLIGHT_MODE, _flight_mode_cb }, #ifndef FEATURE_SETTING_EMUL { "Data usage", SETTING_CONNECTION_DATAUSAGE, _datausage_cb}, + { "Mobile networks", SETTING_CONNECTION_MOBILE_NETWORKS, _mobile_networks_cb}, #endif { "IDS_ST_BODY_LOCATION", SETTING_CONNECTION_LOCATION, _location_cb }, }; @@ -773,6 +776,9 @@ Evas_Object *_create_connection_list(void *data) case SETTING_CONNECTION_DATAUSAGE: itc_tmp = text1; break; + case SETTING_CONNECTION_MOBILE_NETWORKS: + itc_tmp = text1; + break; #endif case SETTING_CONNECTION_FLIGHT_MODE: itc_tmp = text_icon; @@ -859,6 +865,43 @@ Evas_Object *_create_connection_list(void *data) return genlist; } +void back_key_mobile_network_cb(void *data, Evas_Object *obj, void *event_info) +{ + appdata *ad = (appdata *)data; + if (ad) { + elm_naviframe_item_pop(ad->nf); + _clear_mobile_networks_resource(); + back_button_cb_pop(); + } else { + ERR("data ptr is NULL"); + } +} + +void _mobile_networks_cb(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *layout = NULL; + Elm_Object_Item *nf_it = NULL; + + appdata *ad = data; + + setting_ret_if(!data); + + + layout = _create_mobile_networks_list(data); + if (layout == NULL) { + ERR("%s", "connection_cb - genlist is null"); + return; + } + + nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, layout, "empty"); + back_button_cb_push(&back_key_mobile_network_cb, data, NULL, g_connection_genlist, "g_connection_genlist"); + elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE); + + elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); + + +} + void _datausage_cb(void *data, Evas_Object *obj, void *event_info) { Evas_Object *layout = NULL; diff --git a/src/setting-mobile-networks.c b/src/setting-mobile-networks.c new file mode 100644 index 0000000..5500b46 --- /dev/null +++ b/src/setting-mobile-networks.c @@ -0,0 +1,1665 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * Licensed under the Flora License, Version 1.0 (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. + * + */ +#include <sys/types.h> +#include <vconf.h> +#include <vconf-keys.h> +#include <stc.h> +#include <stc_internal.h> +#include <time.h> +#include <telephony.h> +#include <TapiUtility.h> +#include <ITapiModem.h> +#include <ITapiNetwork.h> +#include <ITapiSim.h> +#include <glib.h> +#include <unistd.h> + +#include "setting-mobile-networks.h" +#include "util.h" +#include "setting_view_toast.h" +#include "setting_data_vconf.h" +#include "setting-volume.h" + +#include <app_control.h> + +#define MESSAGE_TIMER_LOOP 10 + +static GMainLoop* multi_main_loop = NULL; + +typedef enum { + LTE_3G = 0, + ONLY_3G, +} Network_Mode_E; + + +char *progress_message[6] = { + "Searching...", + "Automatic registration...", + "Registered on network", + "Manual registration...", + "Registration failed", + "Searching... failed" +}; + +typedef struct _Progressbar_Data { + Ecore_Timer *p_timer_full; + Evas_Object *layout; + Evas_Object *progressbar_full; +} Progressbar_Data; + +int g_message_id = 0; +int g_message_stop = 0; +static Progressbar_Data g_pd = { NULL, }; + +Network_Mode_E g_network_mode = LTE_3G; +static void _mobile_data_cb(void *data, Evas_Object *obj, void *event_info); +static void _data_roaming_cb(void *data, Evas_Object *obj, void *event_info); +static void _network_operator_cb(void *data, Evas_Object *obj, void *event_info); +//static void _access_point_name_cb(void *data, Evas_Object *obj, void *event_info); + +static void _network_mode_cb(void *data, Evas_Object *obj, void *event_info); +static Evas_Object* _create_network_mode_list(void *data); +static void _find_networks_gl_cb(void *data, Evas_Object *obj, void *event_info); +static void _select_automatically_gl_cb(void *data, Evas_Object *obj, void *event_info); + +static void _mobile_networks_gl_del(void *data, Evas_Object *obj); + +static int set_disable_mobile_networks(); + +static void _set_data_roaming_cancel_cb(void *data, Evas_Object *obj, void *event_info); +static void back_key_mobile_networks_popup_cb(void *data, Evas_Object *obj, void *event_info); +static void _set_data_roaming_ok_clicked_cb(void *data, Evas_Object *obj, void *event_info); +static char *_gl_mobile_networks_title_get(void *data, Evas_Object *obj, const char *part); +static void _mobile_networks_mode_gl_cb(void *data, Evas_Object *obj, void *event_info); +static void on_set_network_mode(TapiHandle *handle, int result, void *data, void *user_data); +static void on_get_network_mode(TapiHandle *handle, int result, void *data, void *user_data); +static void back_key_network_searching_cb(void *data, Evas_Object *obj, void *event_info); +static void eext_progressbar_cb(void *data, Evas_Object *obj, void *event_info); + +static Evas_Object *g_mobile_networks_genlist = NULL; +static Evas_Object *g_networks_operator_genlist = NULL; + +static struct _mobile_networks_menu_item mobile_networks_menu_its[] = { + { "Mobile data", SETTING_MOBILE_NETWORKS_MOBILE_DATA, _mobile_data_cb }, + { "Data roaming", SETTING_MOBILE_NETWORKS_DATA_ROAMING, _data_roaming_cb}, + { "Network mode", SETTING_MOBILE_NETWORKS_NETWORK_MODE, _network_mode_cb}, + { "Network operators", SETTING_MOBILE_NETWORKS_NETWORK_OPERATORS, _network_operator_cb }, +// { "Access point name", SETTING_MOBILE_NETWORKS_ACCESS_POINT_NAME, _access_point_name_cb }, +}; + +static struct _mobile_networks_menu_item mobile_networks_mode_menu_its[] = { + { "LTE/3G", LTE_3G, _mobile_networks_mode_gl_cb}, + { "3G only", ONLY_3G, _mobile_networks_mode_gl_cb}, +}; + +static struct _mobile_networks_menu_item mobile_networks_operator_menu_its[] = { + { "Find networks", LTE_3G, _find_networks_gl_cb}, + { "Select automatically", ONLY_3G, _select_automatically_gl_cb}, +}; + +enum { + MOBILE_NETWORKS_TITLE_MOBILE_NETWORKS, + MOBILE_NETWORKS_TITLE_NETWORK_MODE, + MOBILE_NETWORKS_TITLE_NETWORK_OPERATORS, +}; + +static int MOBILE_NETWORKS_TOP_MENU_SIZE = + sizeof(mobile_networks_menu_its) / sizeof(mobile_networks_menu_its[0]); + +static int MOBILE_NETWORKS_NETWORK_MODE_MENU_SIZE = + sizeof(mobile_networks_mode_menu_its) / sizeof(mobile_networks_mode_menu_its[0]); + +static int MOBILE_NETWORKS_NETWORK_OPERATOR_MENU_SIZE = + sizeof(mobile_networks_operator_menu_its) / sizeof(mobile_networks_operator_menu_its[0]); + +static appdata *g_app_context = NULL; +static Ecore_Timer *running_timer = NULL; + +static Evas_Object *g_mobile_data_check = NULL; +static Evas_Object *g_data_roaming_check = NULL; +static TapiHandle *tel_handle = NULL; +static bool searching_network = false; +TelNetworkPlmnList_t g_plmn_info; + +static int _tapi_handles_init() +{ + TelSimCardStatus_t sim_status = TAPI_SIM_STATUS_UNKNOWN; + int card_changed = 0; + int ret = 0; + + char **cp_names = tel_get_cp_name_list(); + if (!cp_names) { + ERR("[%s:%d] cp_names == NULL", __FILE__, __LINE__); + return -1; + } + + tel_handle = tel_init(cp_names[0]); + if (!tel_handle) { + ERR("[%s:%d] tel_handle == NULL", __FILE__, __LINE__); + free(cp_names); + return -1; + } + + ret = tel_get_sim_init_info(tel_handle, &sim_status, &card_changed); + if (ret != TAPI_API_SUCCESS) { + ERR("tel_get_sim_init_info() error: %s", get_error_message(ret)); + free(cp_names); + return -1; + } + + DBG("\033[1;34m SIM NAME: %s %d, %d\033[0m", cp_names[0], sim_status, card_changed); + + free(cp_names); + + return 0; +} +static char * +_gl_menu_title_text_get(void *data, Evas_Object *obj, const char *part) +{ + char buf[__SETTING_BUF_SIZE__] = {0,}; + int title_idx = (uintptr_t)data; + switch (title_idx) { + case MOBILE_NETWORKS_TITLE_MOBILE_NETWORKS: + snprintf(buf, sizeof(buf)-1, "%s", "Mobile Networks"); + break; + case MOBILE_NETWORKS_TITLE_NETWORK_MODE: + snprintf(buf, sizeof(buf)-1, "%s", "Network Mode"); + break; + case MOBILE_NETWORKS_TITLE_NETWORK_OPERATORS: + snprintf(buf, sizeof(buf)-1, "%s", "Network Operator"); + break; + default: + snprintf(buf, sizeof(buf)-1, "%s", "Mobile Networks"); + break; + } + return strdup(buf); +} + +void _clear_mobile_networks_resource() +{ + if (running_timer) { + ecore_timer_del(running_timer); + running_timer = NULL; + } + + g_mobile_networks_genlist = NULL; + g_networks_operator_genlist = NULL; + + g_app_context = NULL; + + if (tel_handle) { + tel_deinit(tel_handle); + tel_handle = NULL; + } + + +} + +static int _set_network_mode(int mode){ + + int result = tel_set_network_mode(tel_handle, + mode? TAPI_NETWORK_MODE_WCDMA : TAPI_NETWORK_MODE_LTE | TAPI_NETWORK_MODE_WCDMA | TAPI_NETWORK_MODE_GSM, + on_set_network_mode, NULL); + if (result == TAPI_API_SUCCESS) { + multi_main_loop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(multi_main_loop); + } + return result; +} + +static int _get_network_mode(){ + + int result = tel_get_network_mode(tel_handle, on_get_network_mode, NULL); + if (result == TAPI_API_SUCCESS) { + multi_main_loop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(multi_main_loop); + } + return result; +} + + +static void _set_data_mobile_data_cancel_cb(void *data, Evas_Object *obj, void *event_info) +{ + appdata *ad = g_app_context; + Evas_Object *check = (Evas_Object *)data; + + int ret = system_settings_set_value_bool( + SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, + false); + + if (ret != SYSTEM_SETTINGS_ERROR_NONE) { + ERR("Setting SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED failed!"); + } + + elm_check_state_set(check, EINA_FALSE); + + if (ad && ad->popup) { + evas_object_del(ad->popup); + ad->popup = NULL; + } +} + +static void _set_data_mobile_data_ok_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + appdata *ad = g_app_context; + Evas_Object *check = (Evas_Object *)data; + + elm_check_state_set(check, EINA_TRUE); + + int ret = system_settings_set_value_bool( + SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, + true); + + if (ret != SYSTEM_SETTINGS_ERROR_NONE) { + ERR("Setting SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED failed!"); + } + + if (ad && ad->popup) { + evas_object_del(ad->popup); + ad->popup = NULL; + } + +} + +static void _mobile_data_check_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + appdata *ad = g_app_context; + Evas_Object *check = (Evas_Object *)data; + bool is_mobile_data = false; + char buf[__SETTING_BUF_SIZE__] = {0,}; + + if (ad == NULL) { + ERR("%s", "_mobile_data_check_cb - appdata or check is null"); + return; + } + + int ret = system_settings_get_value_bool( + SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, + &is_mobile_data ); + + if (ret != SYSTEM_SETTINGS_ERROR_NONE) { + ERR("Getting SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED failed!"); + } + + DBG("is_mobile_data:%d ", is_mobile_data); + DBG("_mobile_data_check_cb is called!!!!!!!"); + + if (is_mobile_data) { + Evas_Object *popup = NULL; + Evas_Object *btn1 = NULL; + Evas_Object *btn2 = NULL; + Evas_Object *icon; + + popup = elm_popup_add(ad->nf); + elm_object_style_set(popup, "circle"); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(ad->nf, popup); + + ad->popup = popup; + + + char *font_setting = "<text_class=tizen><align=center>%s</align></text_class>"; + snprintf(buf, sizeof(buf) - 1, font_setting, "You won't be able to get notifications or use apps that need network access."); + + Evas_Object *layout; + layout = elm_layout_add(popup); + elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons2"); + + elm_object_text_set(layout, buf); + elm_object_content_set(popup, layout); + elm_object_part_text_set(layout, "elm.text.title", "Trun off mobile data?"); + + btn1 = elm_button_add(popup); + elm_object_style_set(btn1, "popup/circle/left"); + evas_object_size_hint_weight_set(btn1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button1", btn1); + evas_object_smart_callback_add(btn1, "clicked", _set_data_mobile_data_ok_clicked_cb, check); + + icon = elm_image_add(btn1); + elm_image_file_set(icon, IMG_DIR"tw_ic_popup_btn_delete.png", NULL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn1, "elm.swallow.content", icon); + evas_object_show(icon); + + btn2 = elm_button_add(popup); + elm_object_style_set(btn2, "popup/circle/right"); + evas_object_size_hint_weight_set(btn2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button2", btn2); + evas_object_smart_callback_add(btn2, "clicked", _set_data_mobile_data_cancel_cb, check); + + icon = elm_image_add(btn2); + elm_image_file_set(icon, IMG_DIR"tw_ic_popup_btn_check.png", NULL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn2, "elm.swallow.content", icon); + evas_object_show(icon); + + evas_object_show(popup); + back_button_cb_push(&back_key_mobile_networks_popup_cb, check, NULL, g_mobile_networks_genlist, "g_mobile_networks_genlist"); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _hw_back_key_cb, NULL); + + } else { + Evas_Object *popup = NULL; + Evas_Object *btn1 = NULL; + Evas_Object *btn2 = NULL; + Evas_Object *icon; + + popup = elm_popup_add(ad->nf); + elm_object_style_set(popup, "circle"); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(ad->nf, popup); + + ad->popup = popup; + + char *font_setting = "<text_class=tizen><align=center>%s</align></text_class>"; + snprintf(buf, sizeof(buf) - 1, font_setting, "Turn on mobile data?"); + + Evas_Object *layout; + layout = elm_layout_add(popup); + elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons2"); + + elm_object_text_set(layout, buf); + elm_object_content_set(popup, layout); + + btn1 = elm_button_add(popup); + elm_object_style_set(btn1, "popup/circle/left"); + evas_object_size_hint_weight_set(btn1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button1", btn1); + evas_object_smart_callback_add(btn1, "clicked", _set_data_mobile_data_cancel_cb, check); + + icon = elm_image_add(btn1); + elm_image_file_set(icon, IMG_DIR"tw_ic_popup_btn_delete.png", NULL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn1, "elm.swallow.content", icon); + evas_object_show(icon); + + btn2 = elm_button_add(popup); + elm_object_style_set(btn2, "popup/circle/right"); + evas_object_size_hint_weight_set(btn2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button2", btn2); + evas_object_smart_callback_add(btn2, "clicked", _set_data_mobile_data_ok_clicked_cb, check); + + icon = elm_image_add(btn2); + elm_image_file_set(icon, IMG_DIR"tw_ic_popup_btn_check.png", NULL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn2, "elm.swallow.content", icon); + evas_object_show(icon); + + evas_object_show(popup); + back_button_cb_push(&back_key_mobile_networks_popup_cb, check, NULL, g_mobile_networks_genlist, "g_mobile_networks_genlist"); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _hw_back_key_cb, NULL); + } + +} + +static void _set_data_roaming_cancel_cb(void *data, Evas_Object *obj, void *event_info) +{ + appdata *ad = g_app_context; + Evas_Object *check = (Evas_Object *)data; + + elm_check_state_set(check, EINA_FALSE); + + int ret = vconf_set_bool(VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL, false); + if (ret != SYSTEM_SETTINGS_ERROR_NONE) { + ERR("Setting VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL failed!"); + } + + if (ad && ad->popup) { + evas_object_del(ad->popup); + ad->popup = NULL; + } +} + +static void _set_data_roaming_ok_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + appdata *ad = g_app_context; + Evas_Object *check = (Evas_Object *)data; + + elm_check_state_set(check, EINA_TRUE); + + int ret = vconf_set_bool(VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL, true); + if (ret != SYSTEM_SETTINGS_ERROR_NONE) { + ERR("Setting VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL failed!"); + } + + if (ad && ad->popup) { + evas_object_del(ad->popup); + ad->popup = NULL; + } + +} + +void back_key_mobile_networks_popup_cb(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *check = (Evas_Object *)data; + + elm_check_state_set(check, EINA_FALSE); + + appdata *ad = (appdata *)g_app_context; + if (ad && ad->popup) { + evas_object_del(ad->popup); + ad->popup = NULL; + } + back_button_cb_pop(); +} + +static void _data_roaming_check_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + appdata *ad = g_app_context; + Evas_Object *check = (Evas_Object *)data; + int is_data_roaming = false; + char buf[__SETTING_BUF_SIZE__] = {0,}; + + if (ad == NULL) { + ERR("%s", "_data_roaming_check_cb - appdata or check is null"); + return; + } + + + DBG("_data_roaming_check_cb is called!!!!!!!"); + + DBG("is_data_roaming:%d ", is_data_roaming); + + if (!is_data_roaming) { + Evas_Object *popup = NULL; + Evas_Object *btn1 = NULL; + Evas_Object *btn2 = NULL; + Evas_Object *icon; + + popup = elm_popup_add(ad->nf); + elm_object_style_set(popup, "circle"); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(ad->nf, popup); + + ad->popup = popup; + + char *font_setting = "<text_class=tizen><align=center>%s</align></text_class>"; + snprintf(buf, sizeof(buf) - 1, font_setting, "Extra charges may apply if you're roaming."); + + Evas_Object *layout; + layout = elm_layout_add(popup); + elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons2"); + + elm_object_text_set(layout, buf); + elm_object_content_set(popup, layout); + elm_object_part_text_set(layout, "elm.text.title", "Trun on data roaming?"); + + btn1 = elm_button_add(popup); + elm_object_style_set(btn1, "popup/circle/left"); + evas_object_size_hint_weight_set(btn1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button1", btn1); + evas_object_smart_callback_add(btn1, "clicked", _set_data_roaming_cancel_cb, check); + + icon = elm_image_add(btn1); + elm_image_file_set(icon, IMG_DIR"tw_ic_popup_btn_delete.png", NULL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn1, "elm.swallow.content", icon); + evas_object_show(icon); + + btn2 = elm_button_add(popup); + elm_object_style_set(btn2, "popup/circle/right"); + evas_object_size_hint_weight_set(btn2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button2", btn2); + evas_object_smart_callback_add(btn2, "clicked", _set_data_roaming_ok_clicked_cb, check); + + icon = elm_image_add(btn2); + elm_image_file_set(icon, IMG_DIR"tw_ic_popup_btn_check.png", NULL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn2, "elm.swallow.content", icon); + evas_object_show(icon); + + evas_object_show(popup); + back_button_cb_push(&back_key_mobile_networks_popup_cb, check, NULL, g_mobile_networks_genlist, "g_mobile_networks_genlist"); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _hw_back_key_cb, NULL); + + } else { + elm_check_state_set(check, EINA_FALSE); + set_disable_mobile_networks(); + elm_genlist_realized_items_update(g_mobile_networks_genlist); + + } + +} +Evas_Object *_gl_mobile_networks_check_get(void *data, Evas_Object *obj, const char *part) +{ + Evas_Object *check = NULL; + + mobile_networks_Item_Data *id = data; + int index = id->index; + bool is_value = 0; + int val = 0; + + if (!strcmp(part, "elm.icon")) { + check = elm_check_add(obj); + + switch (index) { + case 0: + g_mobile_data_check = check; + system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, &is_value); + evas_object_event_callback_add(check, EVAS_CALLBACK_MOUSE_DOWN, _mobile_data_check_cb, (void *)check); + break; + case 1: + g_data_roaming_check = check; + is_value = val ? true : false; + evas_object_event_callback_add(check, EVAS_CALLBACK_MOUSE_DOWN, _data_roaming_check_cb, (void *)check); + break; + default: + ERR("Error!! another value came in this func. index = %d", index); + break; + } + + elm_check_state_set(check, (is_value) ? EINA_TRUE : EINA_FALSE); /*default */ + + elm_object_style_set(check, "on&off"); + evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_propagate_events_set(check, EINA_TRUE); + + id->check = check; + + elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_DESCRIBED_BY, check); + elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_CONTROLLER_FOR, check); + elm_atspi_accessible_relationship_append(check, ELM_ATSPI_RELATION_CONTROLLED_BY, id->item); + + } + + return check; +} + + +void _mobile_data_cb(void *data, Evas_Object *obj, void *event_info) +{ + appdata *ad = g_app_context; + Evas_Object *check = g_mobile_data_check; + bool is_mobile_data = false; + char buf[__SETTING_BUF_SIZE__] = {0,}; + + if (ad == NULL) { + ERR("%s", "_mobile_data_check_cb - appdata or check is null"); + return; + } + + int ret = system_settings_get_value_bool( + SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, + &is_mobile_data); + + if (ret != SYSTEM_SETTINGS_ERROR_NONE) { + ERR("Setting SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED failed!"); + } + + DBG("is_mobile_data:%d ", is_mobile_data); + + if (is_mobile_data) { + Evas_Object *popup = NULL; + Evas_Object *btn1 = NULL; + Evas_Object *btn2 = NULL; + Evas_Object *icon; + + popup = elm_popup_add(ad->nf); + elm_object_style_set(popup, "circle"); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(ad->nf, popup); + + ad->popup = popup; + + char *font_setting = "<text_class=tizen><align=center>%s</align></text_class>"; + snprintf(buf, sizeof(buf) - 1, font_setting, "You won't be able to get notifications or use apps that need network access."); + + Evas_Object *layout; + layout = elm_layout_add(popup); + elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons2"); + + elm_object_text_set(layout, buf); + elm_object_content_set(popup, layout); + elm_object_part_text_set(layout, "elm.text.title", "Trun off mobile data?"); + + btn1 = elm_button_add(popup); + elm_object_style_set(btn1, "popup/circle/left"); + evas_object_size_hint_weight_set(btn1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button1", btn1); + evas_object_smart_callback_add(btn1, "clicked", _set_data_mobile_data_ok_clicked_cb, check); + + icon = elm_image_add(btn1); + elm_image_file_set(icon, IMG_DIR"tw_ic_popup_btn_delete.png", NULL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn1, "elm.swallow.content", icon); + evas_object_show(icon); + + btn2 = elm_button_add(popup); + elm_object_style_set(btn2, "popup/circle/right"); + evas_object_size_hint_weight_set(btn2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button2", btn2); + evas_object_smart_callback_add(btn2, "clicked", _set_data_mobile_data_cancel_cb, check); + + icon = elm_image_add(btn2); + elm_image_file_set(icon, IMG_DIR"tw_ic_popup_btn_check.png", NULL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn2, "elm.swallow.content", icon); + evas_object_show(icon); + + evas_object_show(popup); + back_button_cb_push(&back_key_mobile_networks_popup_cb, check, NULL, g_mobile_networks_genlist, "g_mobile_networks_genlist"); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _hw_back_key_cb, NULL); + + } else { + Evas_Object *popup = NULL; + Evas_Object *btn1 = NULL; + Evas_Object *btn2 = NULL; + Evas_Object *icon; + + popup = elm_popup_add(ad->nf); + elm_object_style_set(popup, "circle"); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(ad->nf, popup); + + ad->popup = popup; + + char *font_setting = "<text_class=tizen><align=center>%s</align></text_class>"; + snprintf(buf, sizeof(buf) - 1, font_setting, "Turn on mobile data?"); + + Evas_Object *layout; + layout = elm_layout_add(popup); + elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons2"); + + elm_object_text_set(layout, buf); + elm_object_content_set(popup, layout); + + btn1 = elm_button_add(popup); + elm_object_style_set(btn1, "popup/circle/left"); + evas_object_size_hint_weight_set(btn1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button1", btn1); + evas_object_smart_callback_add(btn1, "clicked", _set_data_mobile_data_cancel_cb, check); + + icon = elm_image_add(btn1); + elm_image_file_set(icon, IMG_DIR"tw_ic_popup_btn_delete.png", NULL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn1, "elm.swallow.content", icon); + evas_object_show(icon); + + btn2 = elm_button_add(popup); + elm_object_style_set(btn2, "popup/circle/right"); + evas_object_size_hint_weight_set(btn2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button2", btn2); + evas_object_smart_callback_add(btn2, "clicked", _set_data_mobile_data_ok_clicked_cb, check); + + icon = elm_image_add(btn2); + elm_image_file_set(icon, IMG_DIR"tw_ic_popup_btn_check.png", NULL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn2, "elm.swallow.content", icon); + evas_object_show(icon); + + evas_object_show(popup); + back_button_cb_push(&back_key_mobile_networks_popup_cb, check, NULL, g_mobile_networks_genlist, "g_mobile_networks_genlist"); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _hw_back_key_cb, NULL); + } + +} + +void _data_roaming_cb(void *data, Evas_Object *obj, void *event_info) +{ + elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); + + appdata *ad = g_app_context; + int is_data_roaming = false; + + if (ad == NULL) { + ERR("%s", "_data_roaming_cb - appdata or check is null"); + return; + } + + DBG("_data_roaming_check_cb is called!!!!!!!"); + + Evas_Object *check = g_data_roaming_check; + DBG("is_data_roaming:%d ", is_data_roaming); + + if (!is_data_roaming) { + Evas_Object *popup = NULL; + Evas_Object *btn1 = NULL; + Evas_Object *btn2 = NULL; + Evas_Object *icon; + + popup = elm_popup_add(ad->nf); + elm_object_style_set(popup, "circle"); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(ad->nf, popup); + + ad->popup = popup; + + char buf[__SETTING_BUF_SIZE__] = {0,}; + + char *font_setting = "<text_class=tizen><align=center>%s</align></text_class>"; + snprintf(buf, sizeof(buf) - 1, font_setting, "Extra charges may apply if you're roaming."); + + Evas_Object *layout; + layout = elm_layout_add(popup); + elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons2"); + + elm_object_text_set(layout, buf); + elm_object_content_set(popup, layout); + elm_object_part_text_set(layout, "elm.text.title", "Trun on data roaming?"); + + btn1 = elm_button_add(popup); + elm_object_style_set(btn1, "popup/circle/left"); + evas_object_size_hint_weight_set(btn1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button1", btn1); + evas_object_smart_callback_add(btn1, "clicked", _set_data_roaming_cancel_cb, check); + + icon = elm_image_add(btn1); + elm_image_file_set(icon, IMG_DIR"tw_ic_popup_btn_delete.png", NULL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn1, "elm.swallow.content", icon); + evas_object_show(icon); + + btn2 = elm_button_add(popup); + elm_object_style_set(btn2, "popup/circle/right"); + evas_object_size_hint_weight_set(btn2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button2", btn2); + evas_object_smart_callback_add(btn2, "clicked", _set_data_roaming_ok_clicked_cb, check); + + icon = elm_image_add(btn2); + elm_image_file_set(icon, IMG_DIR"tw_ic_popup_btn_check.png", NULL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn2, "elm.swallow.content", icon); + evas_object_show(icon); + + evas_object_show(popup); + back_button_cb_push(&back_key_mobile_networks_popup_cb, check, NULL, g_mobile_networks_genlist, "g_mobile_networks_genlist"); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _hw_back_key_cb, NULL); + + } else { + elm_check_state_set(check, EINA_FALSE); + set_disable_mobile_networks(); + elm_genlist_realized_items_update(g_mobile_networks_genlist); + + } +} + +char *_gl_network_operator_title_get(void *data, Evas_Object *obj, const char *part) +{ + char buf[__SETTING_BUF_SIZE__] = {0,}; + mobile_networks_Item_Data *id = data; + int val = 0; + + if (!strcmp(part, "elm.text")) { + snprintf(buf, sizeof(buf) - 1, "%s", _(mobile_networks_operator_menu_its[id->menu_array_idx].name)); + } + DBG("_gl_mobile_networks_title_get part: %s, %s get status : %d", part, buf, val); + return strdup(buf); +} + +static void _tapi_set_plmn_mode_cb(TapiHandle *handle, int result, void *data, void *user_data) +{ + DBG(" - result = 0x%x", result); + + if (result != TAPI_NETWORK_NO_ERR) { /*roolback..*/ + ERR("ERR result = %d", result); + g_message_id = 4; + g_message_stop = 1; + ERR("closed progress bar!"); + return; + } + + g_message_id = 2; + g_message_stop = 1; + DBG("Out"); +} + +static void _select_plmn_cb(void *data, Evas_Object *obj, void *event_info) +{ + mobile_networks_Item_Data *id = data; + + if (!data) { + ERR("data is NULL"); + return; + } + + int cnt = id->index; + DBG("Sending tel_select_network_manual.."); + + int tapi_ret = tel_select_network_manual(tel_handle, + g_plmn_info.network_list[cnt].plmn, + g_plmn_info.network_list[cnt].access_technology, + _tapi_set_plmn_mode_cb, NULL); + + if (tapi_ret != TAPI_API_SUCCESS) { + ERR("[ERR]tel_select_network_manual. tapi_ret=%d", tapi_ret); + return; + } + + g_message_id = 3; + eext_progressbar_cb((void*)g_app_context, obj, event_info); + searching_network = false; + +} + +char *_gl_found_network_operator_title_get(void *data, Evas_Object *obj, const char *part) +{ + char buf[__SETTING_BUF_SIZE__] = {0,}; + mobile_networks_Item_Data *id = data; + int val = 0; + + if (!strcmp(part, "elm.text")) { + TelNetworkIdentity_t *network_target; + network_target = &g_plmn_info.network_list[id->menu_array_idx]; + snprintf(buf, sizeof(buf) - 1, "%s", network_target->network_name); + } + DBG("_gl_mobile_networks_title_get part: %s, %s get status : %d", part, buf, val); + return strdup(buf); +} + +Evas_Object* _update_network_operator_list(void *data) +{ + appdata *ad = data; + if (ad == NULL) { + ERR("%s", "_create_mobile_networks_list - appdata is null"); + return NULL; + } + + if (!g_networks_operator_genlist) { + ERR("There is no g_networks_operator_genlist"); + return NULL; + } + + elm_genlist_clear(g_networks_operator_genlist); + Evas_Object *genlist = g_networks_operator_genlist; + struct _mobile_networks_menu_item *menu_its = NULL; + int idx = 0; + + Elm_Genlist_Item_Class *itc_tmp; + + Elm_Genlist_Item_Class *text1 = elm_genlist_item_class_new(); + text1->item_style = "1text"; + text1->func.text_get = _gl_network_operator_title_get; + text1->func.del = _mobile_networks_gl_del; + + elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); + + Evas_Object *circle_genlist = eext_circle_object_genlist_add(genlist, ad->circle_surface); + eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE); + + Elm_Genlist_Item_Class *title_item = elm_genlist_item_class_new(); + title_item->func.text_get = _gl_menu_title_text_get; + title_item->item_style = "title"; + title_item->func.del = NULL; + + elm_genlist_item_append(genlist, title_item, (void *)MOBILE_NETWORKS_TITLE_NETWORK_OPERATORS, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + + elm_genlist_item_class_free(title_item); + + menu_its = mobile_networks_operator_menu_its; + + + for (idx = 0; idx < MOBILE_NETWORKS_NETWORK_OPERATOR_MENU_SIZE; idx++) { + + itc_tmp = text1; + + mobile_networks_Item_Data *id = calloc(sizeof(mobile_networks_Item_Data), 1); + if (id) { + id->index = mobile_networks_operator_menu_its[idx].type; + id->menu_array_idx = idx; + id->item = elm_genlist_item_append( + genlist, /* genlist object */ + itc_tmp, /* item class */ + id, /* data */ + NULL, + ELM_GENLIST_ITEM_NONE, + menu_its[idx].func, /* call back */ + ad); + } + } + + Elm_Genlist_Item_Class *text_f = elm_genlist_item_class_new(); + text_f->item_style = "1text"; + text_f->func.text_get = _gl_found_network_operator_title_get; + text_f->func.del = _mobile_networks_gl_del; + + for (idx = 0; idx < g_plmn_info.networks_count; idx++) { + + itc_tmp = text_f; + + mobile_networks_Item_Data *id = calloc(sizeof(mobile_networks_Item_Data), 1); + if (id) { + id->index = mobile_networks_operator_menu_its[idx].type; + id->menu_array_idx = idx; + id->item = elm_genlist_item_append( + genlist, /* genlist object */ + itc_tmp, /* item class */ + id, /* data */ + NULL, + ELM_GENLIST_ITEM_NONE, + _select_plmn_cb, /* call back */ + (void*)id); + } + } + elm_genlist_item_class_free(text1); + elm_genlist_item_class_free(text_f); + + Elm_Genlist_Item_Class *padding = elm_genlist_item_class_new(); + padding->item_style = "padding"; + padding->func.del = _mobile_networks_gl_del; + + Elm_Object_Item *padding_item; + padding_item = elm_genlist_item_append(genlist, padding, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + elm_atspi_accessible_role_set(padding_item, ELM_ATSPI_ROLE_REDUNDANT_OBJECT); + elm_genlist_item_class_free(padding); + return genlist; +} + + +Evas_Object* _create_network_operator_list(void *data) +{ + appdata *ad = data; + if (ad == NULL) { + ERR("%s", "_create_mobile_networks_list - appdata is null"); + return NULL; + } + + + Evas_Object *genlist = NULL; + struct _mobile_networks_menu_item *menu_its = NULL; + int idx = 0; + + Elm_Genlist_Item_Class *itc_tmp; + + Elm_Genlist_Item_Class *text1 = elm_genlist_item_class_new(); + text1->item_style = "1text"; + text1->func.text_get = _gl_network_operator_title_get; + text1->func.del = _mobile_networks_gl_del; + + genlist = elm_genlist_add(ad->nf); + elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); + + Evas_Object *circle_genlist = eext_circle_object_genlist_add(genlist, ad->circle_surface); + eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE); + + Elm_Genlist_Item_Class *title_item = elm_genlist_item_class_new(); + title_item->func.text_get = _gl_menu_title_text_get; + title_item->item_style = "title"; + title_item->func.del = NULL; + + elm_genlist_item_append(genlist, title_item, (void *)MOBILE_NETWORKS_TITLE_NETWORK_OPERATORS, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + + elm_genlist_item_class_free(title_item); + + menu_its = mobile_networks_operator_menu_its; + + + for (idx = 0; idx < MOBILE_NETWORKS_NETWORK_OPERATOR_MENU_SIZE; idx++) { + + itc_tmp = text1; + + mobile_networks_Item_Data *id = calloc(sizeof(mobile_networks_Item_Data), 1); + if (id) { + id->index = mobile_networks_operator_menu_its[idx].type; + id->menu_array_idx = idx; + id->item = elm_genlist_item_append( + genlist, /* genlist object */ + itc_tmp, /* item class */ + id, /* data */ + NULL, + ELM_GENLIST_ITEM_NONE, + menu_its[idx].func, /* call back */ + ad); + } + } + elm_genlist_item_class_free(text1); + + Elm_Genlist_Item_Class *padding = elm_genlist_item_class_new(); + padding->item_style = "padding"; + padding->func.del = _mobile_networks_gl_del; + + Elm_Object_Item *padding_item; + padding_item = elm_genlist_item_append(genlist, padding, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + elm_atspi_accessible_role_set(padding_item, ELM_ATSPI_ROLE_REDUNDANT_OBJECT); + elm_genlist_item_class_free(padding); + g_networks_operator_genlist = genlist; + return genlist; +} + +static void _network_operator_cb(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *layout = NULL; + Elm_Object_Item *nf_it = NULL; + + appdata *ad = data; + setting_ret_if(!data); + + layout = _create_network_operator_list(data); + if (layout == NULL) { + ERR("%s", "connection_cb - genlist is null"); + return; + } + + nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, layout, "empty"); + back_button_cb_push(&back_key_generic_cb, data, NULL, g_mobile_networks_genlist , "g_mobile_networks_genlist "); + elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE); + + elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); +} + +char *_gl_mobile_networks_title_get(void *data, Evas_Object *obj, const char *part) +{ + char buf[__SETTING_BUF_SIZE__] = {0,}; + mobile_networks_Item_Data *id = data; + int index = id->index; + int val = 0; + + if (!strcmp(part, "elm.text")) { + snprintf(buf, sizeof(buf) - 1, "%s", _(mobile_networks_menu_its[id->menu_array_idx].name)); + } else if (!strcmp(part, "elm.text.1")) { + switch (index) { + case 2: + snprintf(buf, sizeof(buf) - 1, "<font color=#4DCFFFC9>%s</font>", + mobile_networks_mode_menu_its[g_network_mode].name); + break; + default: + ERR("Error!! another value came in this func. index = %d", index); + break; + } + } + ERR("_gl_mobile_networks_title_get part: %s, %s get status : %d", part, buf, val); + return strdup(buf); +} + +static void _mobile_networks_gl_del(void *data, Evas_Object *obj) +{ + mobile_networks_Item_Data *id = data; + FREE(id); +} + +Evas_Object *_create_mobile_networks_list(void *data) +{ + appdata *ad = data; + if (ad == NULL) { + ERR("%s", "_create_mobile_networks_list - appdata is null"); + return NULL; + } + + g_app_context = ad; + _tapi_handles_init(); + + _get_network_mode(); + Evas_Object *genlist = NULL; + struct _mobile_networks_menu_item *menu_its = NULL; + int idx = 0; + + Elm_Genlist_Item_Class *itc_tmp; + + Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); + itc->item_style = "2text"; + itc->func.text_get = _gl_mobile_networks_title_get; + itc->func.del = _mobile_networks_gl_del; + + Elm_Genlist_Item_Class *text_icon = elm_genlist_item_class_new(); + text_icon->item_style = "1text.1icon.1"; + text_icon->func.text_get = _gl_mobile_networks_title_get; + text_icon->func.content_get = _gl_mobile_networks_check_get; + text_icon->func.del = _mobile_networks_gl_del; + + Elm_Genlist_Item_Class *text1 = elm_genlist_item_class_new(); + text1->item_style = "1text"; + text1->func.text_get = _gl_mobile_networks_title_get; + text1->func.del = _mobile_networks_gl_del; + + genlist = elm_genlist_add(ad->nf); + elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); + + Evas_Object *circle_genlist = eext_circle_object_genlist_add(genlist, ad->circle_surface); + eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE); + + Elm_Genlist_Item_Class *title_item = elm_genlist_item_class_new(); + title_item->func.text_get = _gl_menu_title_text_get; + title_item->item_style = "title"; + title_item->func.del = NULL; + + elm_genlist_item_append(genlist, title_item, (void *)MOBILE_NETWORKS_TITLE_MOBILE_NETWORKS, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + + elm_genlist_item_class_free(title_item); + + menu_its = mobile_networks_menu_its; + + + for (idx = 0; idx < MOBILE_NETWORKS_TOP_MENU_SIZE; idx++) { + + switch (mobile_networks_menu_its[idx].type) { + case SETTING_MOBILE_NETWORKS_MOBILE_DATA: + case SETTING_MOBILE_NETWORKS_DATA_ROAMING: + itc_tmp = text_icon; + break; + case SETTING_MOBILE_NETWORKS_NETWORK_MODE: + itc_tmp = itc; + break; + case SETTING_MOBILE_NETWORKS_NETWORK_OPERATORS: +// case SETTING_MOBILE_NETWORKS_ACCESS_POINT_NAME: +// itc_tmp = text1; +// break; + default: + itc_tmp = itc; + break; + } + + mobile_networks_Item_Data *id = calloc(sizeof(mobile_networks_Item_Data), 1); + if (id) { + id->index = mobile_networks_menu_its[idx].type; + id->menu_array_idx = idx; + id->item = elm_genlist_item_append( + genlist, /* genlist object */ + itc_tmp, /* item class */ + id, /* data */ + NULL, + ELM_GENLIST_ITEM_NONE, + menu_its[idx].func, /* call back */ + ad); + } + } + elm_genlist_item_class_free(text_icon); + elm_genlist_item_class_free(text1); + elm_genlist_item_class_free(itc); + + Elm_Genlist_Item_Class *padding = elm_genlist_item_class_new(); + padding->item_style = "padding"; + padding->func.del = _mobile_networks_gl_del; + + Elm_Object_Item *padding_item; + padding_item = elm_genlist_item_append(genlist, padding, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + elm_atspi_accessible_role_set(padding_item, ELM_ATSPI_ROLE_REDUNDANT_OBJECT); + elm_genlist_item_class_free(padding); + + g_mobile_networks_genlist = genlist; + + + + return genlist; +} + +static void _mobile_networks_mode_gl_cb(void *data, Evas_Object *obj, void *event_info) +{ + elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); + + + if (!data) { + ERR("Error! data is NULL"); + return; + } + + mobile_networks_Item_Data *id = (mobile_networks_Item_Data *)data; + + int network_mode = id->menu_array_idx; + + DBG("Setting - old network mode is %d.", g_network_mode); + DBG("Setting - Curr network mode is %d.", network_mode); + + if (g_network_mode != network_mode) { + + int result = _set_network_mode(network_mode); + if (result != TAPI_API_SUCCESS) { + ERR("Setting - Error set tapi mode."); + elm_naviframe_item_pop(g_app_context->nf); + back_button_cb_pop(); + if (!g_app_context->network_mode_rdg) { + evas_object_del(g_app_context->network_mode_rdg); + g_app_context->network_mode_rdg = NULL; + } + return; + } + g_network_mode = network_mode; + } + + elm_genlist_realized_items_update(g_mobile_networks_genlist); + elm_naviframe_item_pop(g_app_context->nf); + back_button_cb_pop(); + + if (!g_app_context->network_mode_rdg) { + evas_object_del(g_app_context->network_mode_rdg); + g_app_context->network_mode_rdg = NULL; + } + +} + +static Evas_Object *_gl_network_mode_radio_get(void *data, Evas_Object *obj, const char *part) +{ + Evas_Object *radio = NULL; + Evas_Object *radio_main = evas_object_data_get(obj, "radio_main"); + mobile_networks_Item_Data *id = data; + + if (!strcmp(part, "elm.icon")) { + radio = elm_radio_add(obj); + elm_radio_state_value_set(radio, id->index); + evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_radio_group_add(radio, radio_main); + _get_network_mode(); + evas_object_smart_callback_add(radio, "changed", _mobile_networks_mode_gl_cb, (void*)id); + evas_object_propagate_events_set(radio, EINA_FALSE); + + if (g_network_mode == id->index) { + DBG("g_network_mode %d == id->index", g_network_mode); + elm_radio_value_set(radio_main, g_network_mode); + } + + elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_DESCRIBED_BY, radio); + elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_CONTROLLER_FOR, radio); + elm_atspi_accessible_relationship_append(radio, ELM_ATSPI_RELATION_CONTROLLED_BY, id->item); + } + return radio; +} + +static void on_set_network_mode(TapiHandle *handle, int result, void *data, void *user_data){ + DBG("set network mode result : %d", result); + g_main_loop_quit(multi_main_loop); +} + +static void on_get_network_mode(TapiHandle *handle, int result, void *data, void *user_data){ + + int *mode = data; + switch(*mode) { + case TAPI_NETWORK_MODE_AUTO: + case TAPI_NETWORK_MODE_LTE | TAPI_NETWORK_MODE_WCDMA | TAPI_NETWORK_MODE_GSM: + g_network_mode = LTE_3G; + break; + case TAPI_NETWORK_MODE_WCDMA: + g_network_mode = ONLY_3G; + break; + default: + g_network_mode = LTE_3G; + break; + } + DBG("callback mode : %d, g_network_mode = %d", *mode, g_network_mode); + + g_main_loop_quit(multi_main_loop); +} + +char *_gl_network_mode_title_get(void *data, Evas_Object *obj, const char *part) +{ + char buf[__SETTING_BUF_SIZE__] = {0,}; + mobile_networks_Item_Data *id = data; + int val = 0; + + if (!strcmp(part, "elm.text")) { + snprintf(buf, sizeof(buf) - 1, "%s", _(mobile_networks_mode_menu_its[id->menu_array_idx].name)); + } else if (!strcmp(part, "elm.text.1")) { + snprintf(buf, sizeof(buf) - 1, "<font color=#4DCFFFC9>%s</font>", + "Auto connect"); + } + ERR("_gl_mobile_networks_title_get part: %s, %s get status : %d", part, buf, val); + return strdup(buf); +} + +static Evas_Object* _create_network_mode_list(void *data) +{ + appdata *ad = data; + if (ad == NULL) { + ERR("%s", "_create_mobile_networks_list - appdata is null"); + return NULL; + } + + g_app_context = ad; + + _get_network_mode(); + + Evas_Object *genlist = NULL; + struct _mobile_networks_menu_item *menu_its = NULL; + int idx = 0; + + Elm_Genlist_Item_Class *itc_tmp; + + Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); + itc->item_style = "2text.1icon.1"; + itc->func.text_get = _gl_network_mode_title_get; + itc->func.content_get = _gl_network_mode_radio_get; + itc->func.del = _mobile_networks_gl_del; + + + Elm_Genlist_Item_Class *text1 = elm_genlist_item_class_new(); + text1->item_style = "1text.1icon.1"; + text1->func.text_get = _gl_network_mode_title_get; + text1->func.content_get = _gl_network_mode_radio_get; + text1->func.del = _mobile_networks_gl_del; + + genlist = elm_genlist_add(ad->nf); + elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); + + Evas_Object *circle_genlist = eext_circle_object_genlist_add(genlist, ad->circle_surface); + eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE); + + Elm_Genlist_Item_Class *title_item = elm_genlist_item_class_new(); + title_item->func.text_get = _gl_menu_title_text_get; + title_item->item_style = "title"; + title_item->func.del = NULL; + + elm_genlist_item_append(genlist, title_item, (void *)MOBILE_NETWORKS_TITLE_NETWORK_MODE, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + + elm_genlist_item_class_free(title_item); + + menu_its = mobile_networks_mode_menu_its; + + + for (idx = 0; idx < MOBILE_NETWORKS_NETWORK_MODE_MENU_SIZE; idx++) { + + switch (mobile_networks_mode_menu_its[idx].type) { + case LTE_3G: + itc_tmp = itc; + break; + case ONLY_3G: + itc_tmp = text1; + break; + default: + itc_tmp = itc; + break; + } + + mobile_networks_Item_Data *id = calloc(sizeof(mobile_networks_Item_Data), 1); + if (id) { + id->index = mobile_networks_mode_menu_its[idx].type; + id->menu_array_idx = idx; + id->item = elm_genlist_item_append( + genlist, /* genlist object */ + itc_tmp, /* item class */ + id, /* data */ + NULL, + ELM_GENLIST_ITEM_NONE, + menu_its[idx].func, /* call back */ + (void*)id); + } + } + + ad->network_mode_rdg = elm_radio_add(genlist); + elm_radio_state_value_set(ad->network_mode_rdg, 2); + + elm_radio_value_set(ad->network_mode_rdg, g_network_mode); + evas_object_data_set(genlist, "radio_main", ad->network_mode_rdg); + + elm_genlist_item_class_free(text1); + elm_genlist_item_class_free(itc); + + Elm_Genlist_Item_Class *padding = elm_genlist_item_class_new(); + padding->item_style = "padding"; + padding->func.del = _mobile_networks_gl_del; + + Elm_Object_Item *padding_item; + padding_item = elm_genlist_item_append(genlist, padding, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + elm_atspi_accessible_role_set(padding_item, ELM_ATSPI_ROLE_REDUNDANT_OBJECT); + elm_genlist_item_class_free(padding); + + return genlist; +} + +static void _network_mode_cb(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *layout = NULL; + Elm_Object_Item *nf_it = NULL; + + appdata *ad = data; + setting_ret_if(!data); + + layout = _create_network_mode_list(data); + if (layout == NULL) { + DBG("%s", "connection_cb - genlist is null"); + return; + } + + nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, layout, "empty"); + back_button_cb_push(&back_key_generic_cb, data, NULL, g_mobile_networks_genlist , "g_mobile_networks_genlist "); + elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE); + + elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); +} + +static Eina_Bool +_progressbar_timer_cb_full(void *data) +{ + double progress_full = 0.0; + char buf[PATH_MAX]; + static int cnt = 0; + Progressbar_Data *pd = (Progressbar_Data *)data; + + /* Get current progress value to increase */ + progress_full = eext_circle_object_value_get(pd->progressbar_full); + progress_full += 5.0; + + snprintf(buf, sizeof(buf) - 1, "%s", progress_message[g_message_id]); + + if (progress_full > 100.0) + progress_full = 0.0; + + /* Set increased value as new progress */ + eext_circle_object_value_set(pd->progressbar_full, progress_full); + + elm_object_part_text_set(pd->layout, "elm.text.progressbar.full", buf); + + if (g_message_stop) { + if (cnt < MESSAGE_TIMER_LOOP) + cnt++; + else if (cnt >= MESSAGE_TIMER_LOOP) { + cnt = 0; + pd->p_timer_full = NULL; + back_key_generic_cb(g_app_context, NULL, NULL); + searching_network = false; + return ECORE_CALLBACK_CANCEL; + } + } + + return ECORE_CALLBACK_RENEW; +} + +static void back_key_network_searching_cb(void *data, Evas_Object *obj, void *event_info) +{ + appdata *ad = (appdata *)g_app_context; + + DBG("Enter"); + Progressbar_Data *pd = (Progressbar_Data *)data; + + if (pd->p_timer_full) { + ecore_timer_del(pd->p_timer_full); + pd->p_timer_full = NULL; + } + + back_key_generic_cb(ad, obj, event_info); + if (searching_network == true) { + int tapi_ret = tel_cancel_network_manual_search(tel_handle, NULL, NULL); + if (tapi_ret != TAPI_API_SUCCESS) + ERR("*** [ERR] tel_cancel_network_manual_search. " "tapi_ret=%d ***", tapi_ret); + } + + searching_network = false; + DBG("Out"); +} + +static void eext_progressbar_cb(void *data, Evas_Object *obj, void *event_info) +{ + appdata *ad = data; + Evas_Object *nf = ad->nf; + Evas_Object *layout = NULL; + Evas_Object *progressbar_full = NULL; + Elm_Object_Item *nf_it = NULL; + + g_pd.layout = layout = elm_layout_add(nf); + elm_layout_file_set(layout, EDJE_PATH, "eext_progressbar_layout"); + evas_object_show(layout); + + + /* Add new eext_circle_object_progressbar. + Since the circle_object is connected to Eext_Circle_Surface object, + it will be rendered by Eext_Circle_Surface object */ + g_pd.progressbar_full = progressbar_full = eext_circle_object_progressbar_add(layout, ad->circle_surface); + + /* Set the circle object's properties. + - circle object's value has a range from 0.0 to 100.0 */ + eext_circle_object_value_min_max_set(progressbar_full, 0.0, 100.0); + evas_object_show(progressbar_full); + g_message_stop = 0; + g_pd.p_timer_full = ecore_timer_add(0.1, _progressbar_timer_cb_full, &g_pd); + + nf_it = elm_naviframe_item_push(nf, _("Progress Fullscreen"), NULL, NULL, layout, "empty"); + elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE); + back_button_cb_push(&back_key_network_searching_cb, &g_pd, NULL, g_networks_operator_genlist, "g_networks_operator_genlist"); +} + +static void _copy_network_data(TelNetworkPlmnList_t *network_list) +{ + int i; + TelNetworkIdentity_t *network_target; + TelNetworkIdentity_t *network_source; + int net_count = (int)network_list->networks_count; + g_plmn_info.networks_count = + network_list->networks_count; + + for (i = 0; i < net_count; ++i) { + network_target = &g_plmn_info.network_list[i]; + network_source = &network_list->network_list[i]; + + strncpy(network_target->network_name, network_source->network_name, + TAPI_NETWORK_NAME_LEN_MAX); + strncpy(network_target->service_provider_name, + network_source->service_provider_name, + TAPI_NETWORK_NAME_LEN_MAX); + strncpy(network_target->plmn, network_source->plmn, + TAPI_NETWORK_PLMN_LEN_MAX); + + network_target->plmn_id = network_source->plmn_id; + network_target->type_of_plmn = network_source->type_of_plmn; + network_target->access_technology = network_source->access_technology; + } +} + + +static void _tapi_search_network_cb(TapiHandle *handle, int result, void *data, void *user_data) +{ + DBG(" - result = %d", result); + appdata *ad = (appdata *)g_app_context; + + _copy_network_data((TelNetworkPlmnList_t *)data); + + if (result != TAPI_NETWORK_NO_ERR) { + /* [ UI UPDATE ]*/ + ERR("Failed search network!!"); + g_message_id = 6; + g_message_stop = 1; + ERR("closed progress bar!"); + return; + } + + char *cur_plmn = NULL; + tel_get_property_string(tel_handle, TAPI_PROP_NETWORK_PLMN, &cur_plmn); + DBG("cur_plmn:%s", cur_plmn); + + _update_network_operator_list(ad); + + + back_key_network_searching_cb((void*)&g_pd, NULL, NULL); + + searching_network = false; +} + +static void _find_networks_gl_cb(void *data, Evas_Object *obj, void *event_info) +{ + int value_use_packet; + vconf_get_int(VCONFKEY_DNET_STATE, &value_use_packet); + + if (value_use_packet != VCONFKEY_DNET_OFF) { + ERR("ERR DNET state %d", value_use_packet); + return; + } + + int tapi_ret; + /*searching list */ + /*ASYNC API - TAPI_EVENT_NETWORK_SEARCH_CNF */ + tapi_ret = tel_search_network(tel_handle, _tapi_search_network_cb, NULL); + if (tapi_ret != TAPI_API_SUCCESS) { /* error handling.. */ + ERR("*** [ERR] tel_search_network. tapi_ret=%d ***", tapi_ret); + return; + } + + g_message_id = 0; + eext_progressbar_cb(data, obj, event_info); + + searching_network = true; + +} + +static void _select_automatically_gl_cb(void *data, Evas_Object *obj, void *event_info) +{ + int tapi_ret = tel_select_network_automatic(tel_handle, _tapi_set_plmn_mode_cb, NULL); + if (tapi_ret != TAPI_API_SUCCESS) { + ERR("*** [ERR] tel_select_network_automatic." " tapi_ret=%s ***", get_error_message(tapi_ret)); + return; + } + DBG("tapi_ret %d", tapi_ret); + g_message_id = 1; + eext_progressbar_cb(data, obj, event_info); + searching_network = false; +} + + +//void _access_point_name_cb(void *data, Evas_Object *obj, void *event_info) +//{ +//} + +static int set_disable_mobile_networks() +{ + telephony_handle_list_s tel_h_list; + telephony_sim_state_e sim_state = TELEPHONY_SIM_STATE_UNKNOWN; + stc_h stc; + int ret = 0; + if (telephony_init(&tel_h_list) != TELEPHONY_ERROR_NONE) { + ERR("telephony_init failed"); + return -1; + } + + if (tel_h_list.count == 0) { + ERR("\tThere is no SIM card"); + if (telephony_deinit(&tel_h_list) != TELEPHONY_ERROR_NONE) { + ERR("telephony_deinit failed"); + return -1; + } + return -1; + } + + ret = stc_initialize(&stc); + if (ret != STC_ERROR_NONE) { + ERR("stc_initialize() error: %s", get_error_message(ret)); + return -1; + } + char *subscriber_id; /* Subscriber ID numbers of sim cards*/ + + + ret = telephony_sim_get_state(tel_h_list.handle[0], &sim_state); + if (TELEPHONY_ERROR_NONE == ret && + TELEPHONY_SIM_STATE_AVAILABLE == sim_state) { + + multi_main_loop = g_main_loop_new(NULL, FALSE); + + g_main_loop_run(multi_main_loop); + + if (subscriber_id) { + free(subscriber_id); + subscriber_id = 0; + } + } + + stc_deinitialize(stc); + if (telephony_deinit(&tel_h_list) != TELEPHONY_ERROR_NONE) { + ERR("telephony_deinit failed"); + return -1; + } + + return 0; +} + diff --git a/src/setting.c b/src/setting.c index b072f8d..27cc3e9 100644 --- a/src/setting.c +++ b/src/setting.c @@ -1,4 +1,5 @@ -/* * Copyright (c) 2010 Samsung Electronics, Inc. +/* + * Copyright (c) 2010 Samsung Electronics, Inc. * All rights reserved. * * This software is a confidential and proprietary information |