/*
- * Copyright 2012 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://www.tizenopensource.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
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
+ *
+ * Contact: MyoungJune Park <mj2004.park@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 <setting-network.h>
#include <setting-network-preferred-network-delete.h>
#include <setting-network-preferred-network.h>
+#include <setting-debug.h>
#ifndef UG_MODULE_API
#define UG_MODULE_API __attribute__ ((visibility("default")))
if (NULL == value) {
value = "IDS_ST_BODY_NOSERVICE";
}
- SETTING_TRACE("value:%s", value);
+ ad->sel_network = strdup(value);
- if (ad->data_auto_network_item) {
- if (TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == ad->sel_net)
- {
- elm_genlist_item_item_class_update(
- ad->data_auto_network_item->item,
- &ad->itc_2text_2icon_3);
-
- ad->data_auto_network_item->sub_desc =
- (char *)g_strdup(_(value));
- elm_object_item_data_set( ad->data_auto_network_item->item, ad->data_auto_network_item);
- elm_genlist_item_update( ad->data_auto_network_item->item);
- }
+ if (0 != vconf_set_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, ad->sel_net)) {
+ SETTING_TRACE_ERROR("vconf[%s] set failed");
}
- char sub_desc[MAX_COMMON_BUFFER_LEN] = { 0, };
- if (TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == ad->sel_net) {
- snprintf(sub_desc, MAX_COMMON_BUFFER_LEN,
- "%s. %s", _("IDS_COM_BODY_AUTOMATIC"),
- _(value));
-
- } else {
- snprintf(sub_desc, MAX_COMMON_BUFFER_LEN,
- "%s. %s", _("IDS_COM_BODY_MANUAL"),
- _(value));
- }
- if (ad->data_sel_net && !isEmptyStr(sub_desc)) {
- ad->data_sel_net->sub_desc =
- (char *)g_strdup(sub_desc);
- elm_object_item_data_set(ad->data_sel_net->item, ad->data_sel_net);
- elm_genlist_item_update(ad->data_sel_net->item);
+
+ if (0 != vconf_set_int(VCONFKEY_SETAPPL_SELECT_OLD_NT_ACT, ad->sel_act)) {
+ SETTING_TRACE_ERROR("vconf[%s] set failed");
}
+ setting_network_update_sel_network(ad);
}
}
void __network_evt_cb(net_event_info_t *event_cb, void *data)
{
+}
+
+#ifdef SUPPORT_MDM
+static void __mdm_policy_roaming_sync_receiver_cb(int result, void *p_user_data)
+{
SETTING_TRACE_BEGIN;
- ret_if(!event_cb || !data);
+ ret_if(p_user_data == NULL);
+ mdm_status_t policy_status = (mdm_status_t)result;
+ SettingNetworkUG *ad = (SettingNetworkUG*)p_user_data;
- SETTING_TRACE("event_cb->Event:%d", event_cb->Event);
- SETTING_TRACE("event_cb->ProfileName:%s", event_cb->ProfileName);
- SETTING_TRACE("event_cb->Error:%d", event_cb->Error);
+ if(policy_status == MDM_ALLOWED)
+ {
+ setting_enable_genlist_item(ad->data_roaming->item);
+ }
+ else if(policy_status == MDM_RESTRICTED)
+ {
+ setting_disable_genlist_item(ad->data_roaming->item);
+ setting_create_popup_without_btn(ad, ad->ly_main, NULL, MDM_POLICY_DATA_ROAMING_RESTRICTED_STR,
+ NULL,
+ POPUP_INTERVAL, FALSE, FALSE);
+ }
}
-static void *setting_network_ug_on_create(struct ui_gadget *ug,
- enum ug_mode mode, bundle *data,
+#endif
+static void *setting_network_ug_on_create(ui_gadget_h ug,
+ enum ug_mode mode, service_h service,
void *priv)
{
- setting_retvm_if((!ug || !priv), NULL, "!ug || !priv");
+ setting_retvm_if((!priv), NULL, "!priv");
SettingNetworkUG *networkUG = priv;
networkUG->ug = ug;
/* init */
ecore_imf_init();
- /* subscribe tapi events */
- if (setting_network_subscribe_tapi_events(networkUG) != SETTING_RETURN_SUCCESS) {
- SETTING_TRACE_DEBUG
- ("%s*** [ERR] setting_network_subscribe_tapi_events. ***%s",
- SETTING_FONT_RED, SETTING_FONT_BLACK);
+#ifdef SUPPORT_MDM
+ networkUG->mdm_server_state = mdm_get_service();
+ SETTING_TRACE("mdm server status: %d", networkUG->mdm_server_state);
+
+ if(networkUG->mdm_server_state == MDM_RESULT_SUCCESS)
+ {
+ networkUG->mdm_handle = mdm_register_policy_receiver(MDM_POLICY_ON_ROAMING_SYNC, networkUG, __mdm_policy_roaming_sync_receiver_cb);
+ if(networkUG->mdm_handle == -1)
+ SETTING_TRACE_DEBUG("[ERR] failed to register mdm policy receiver");
+ }
+#endif
+
+ //pass NULL to let TAPI access default module
+ networkUG->handle = tel_init(NULL);
+ if (!networkUG->handle) {
+ SETTING_TRACE_DEBUG("%s*** [ERR] tel_init. ***%s",
+ SETTING_FONT_RED, SETTING_FONT_BLACK);
+ //return NULL;
}
int err_code = -1;
&setting_view_network_main);
setting_view_node_table_register(&setting_view_network_main_help,
&setting_view_network_main);
- setting_view_node_table_register
- (&setting_view_network_connection_create,
- &setting_view_network_main);
+
+ setting_view_node_table_register(&setting_view_network_con, &setting_view_network_main);
+ setting_view_node_table_register(&setting_view_network_connection_create, &setting_view_network_con);
setting_view_node_table_register(&setting_view_network_3gcon,
&setting_view_network_main);
(&setting_view_network_preferred_network_delete,
&setting_view_network_preferred_network);
- setting_create_Gendial_itc("dialogue/1text.1icon.2",
- &(networkUG->itc_1text_1icon_2));
- setting_create_Gendial_itc("dialogue/1text", &(networkUG->itc_1text));
- setting_create_Gendial_itc("dialogue/2text.3",
- &(networkUG->itc_2text_2));
- setting_create_Gendial_itc("dialogue/title",
- &(networkUG->itc_group_item));
- setting_create_Gendial_itc("dialogue/1text.1icon",
- &(networkUG->itc_1text_1icon));
- setting_create_Gendial_itc("select_all", &(networkUG->itc_sel_all));
- setting_create_Gendial_itc("1text.1icon.2",
- &(networkUG->itc_1icon_1text));
-
- setting_create_Gendial_itc("dialogue/1icon",
- &(networkUG->itc_variable_height));
- setting_create_Gendial_itc("multiline/1text",
- &(networkUG->itc_bg_1icon));
- networkUG->itc_seperator.item_style = "dialogue/separator/21/with_line";
- networkUG->itc_seperator.func.text_get = NULL;
- networkUG->itc_seperator.func.content_get = NULL;
- networkUG->itc_seperator.func.state_get = NULL;
- networkUG->itc_seperator.func.del = NULL;
-
- setting_create_Gendial_itc("dialogue/2text.3/expandable",
- &(networkUG->itc_2text_3_parent));
- setting_create_Gendial_itc("dialogue/1text.1icon/expandable2",
- &(networkUG->itc_1icon_1text_sub));
- setting_create_Gendial_itc("dialogue/1text.2icon.2",
- &(networkUG->itc_1text_2icon));
- setting_create_Gendial_itc("dialogue/2text.2icon.3",
- &(networkUG->itc_2text_2icon_3));
+ if (tel_get_network_band(networkUG->handle, setting_tapi_get_band_cb, networkUG) != TAPI_API_SUCCESS) {
+ SETTING_TRACE_ERROR("*** [ERR] tel_get_network_band. ***");
+ }
+
+ if (tel_get_network_selection_mode(networkUG->handle, setting_tapi_get_plmn_mode_cb, networkUG) != TAPI_API_SUCCESS) {
+ SETTING_TRACE_ERROR("*** [ERR] tel_get_network_selection_mode. ***");
+ }
+
+ if (tel_get_network_serving(networkUG->handle, setting_tapi_get_serving_network_cb, networkUG) != TAPI_API_SUCCESS) {
+ SETTING_TRACE_ERROR("*** [ERR] tel_get_network_serving. ***");
+ }
/* creating a view. */
setting_view_node_set_cur_view(&setting_view_network_main);
evas_object_event_callback_add(networkUG->win_main_layout,
EVAS_CALLBACK_RESIZE,
setting_network_ug_cb_resize, networkUG);
-
+
(void)vconf_notify_key_changed(VCONFKEY_TELEPHONY_NWNAME,
__selected_network_change_cb, networkUG);
+
+ networkUG->view_type_string = NULL;
+ service_get_extra_data(service, "viewtype", &(networkUG->view_type_string));
+ if(networkUG->view_type_string) {
+ SETTING_TRACE("viewtype:%s", networkUG->view_type_string);
+ }
return networkUG->ly_main;
}
-static void setting_network_ug_on_start(struct ui_gadget *ug, bundle *data,
+static void setting_network_ug_on_start(ui_gadget_h ug, service_h service,
void *priv)
{
}
-static void setting_network_ug_on_pause(struct ui_gadget *ug, bundle *data,
+static void setting_network_ug_on_pause(ui_gadget_h ug, service_h service,
void *priv)
{
}
-static void setting_network_ug_on_resume(struct ui_gadget *ug, bundle *data,
+static void setting_network_ug_on_resume(ui_gadget_h ug, service_h service,
void *priv)
{
}
-static void setting_network_ug_on_destroy(struct ui_gadget *ug, bundle *data,
+static void setting_network_ug_on_destroy(ui_gadget_h ug, service_h service,
void *priv)
{
SETTING_TRACE_BEGIN;
- setting_retm_if((!ug || !priv), "!ug || !priv");
+ setting_retm_if((!priv), "!priv");
SettingNetworkUG *networkUG = priv;
-
+
(void)vconf_ignore_key_changed(VCONFKEY_TELEPHONY_NWNAME,
__selected_network_change_cb);
evas_object_event_callback_del(networkUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_network_ug_cb_resize); /* fix flash issue for gallery */
networkUG->ug = ug;
+
+ G_FREE(networkUG->ed_pxy_addr_desc);
+ G_FREE(networkUG->ed_pxy_port_desc);
FREE(networkUG->prof_list);
+ FREE(networkUG->sel_network);
/* release */
ecore_imf_shutdown();
+#ifdef SUPPORT_MDM
+ if(networkUG->mdm_server_state == MDM_RESULT_SUCCESS)
+ {
+ mdm_deregister_policy_receiver(networkUG->mdm_handle);
+ mdm_release_service();
+ }
+#endif
+
/* unregister dnet client */
int err_code = net_deregister_client();
if (err_code != NET_ERR_NONE) {
("%s*** [ERR] net_deregister_client. err=%d ***%s",
SETTING_FONT_RED, err_code, SETTING_FONT_BLACK);
}
- /* unsubscribe sim events */
- if (setting_network_unsubscribe_tapi_events(networkUG) != SETTING_RETURN_SUCCESS) {
+
+ if (networkUG->handle && tel_deinit(networkUG->handle) != TAPI_API_SUCCESS) {
SETTING_TRACE_DEBUG
("%s*** [ERR] setting_network_unsubscribe_tapi_events. ***%s",
SETTING_FONT_RED, SETTING_FONT_BLACK);
}
- SETTING_TRACE("Unsubscribing TAPI event is succeeded");
setting_network_popup_delete(networkUG);
/* delete the allocated objects. */
setting_view_destroy(&setting_view_network_select_network, networkUG);
setting_view_destroy(&setting_view_network_main_help, networkUG);
+
+ setting_view_destroy(&setting_view_network_con, networkUG);
setting_view_destroy(&setting_view_network_connection_create,
networkUG);
setting_view_destroy(&setting_view_network_3gcon, networkUG);
SETTING_TRACE_END;
}
-static void setting_network_ug_on_message(struct ui_gadget *ug, bundle *msg,
- bundle *data, void *priv)
+static void setting_network_ug_on_message(ui_gadget_h ug, service_h msg,
+ service_h service, void *priv)
{
- SETTING_TRACE_BEGIN;
}
-static void setting_network_ug_on_event(struct ui_gadget *ug,
- enum ug_event event, bundle *data,
+static void setting_network_ug_on_event(ui_gadget_h ug,
+ enum ug_event event, service_h service,
void *priv)
{
SETTING_TRACE_BEGIN;
}
}
-static void setting_network_ug_on_key_event(struct ui_gadget *ug,
+static void setting_network_ug_on_key_event(ui_gadget_h ug,
enum ug_key_event event,
- bundle *data, void *priv)
+ service_h service, void *priv)
{
SETTING_TRACE_BEGIN;
SettingNetworkUG *ad = (SettingNetworkUG *) priv;
- if (!ug)
- return;
switch (event) {
case UG_KEY_EVENT_END:
elm_naviframe_bottom_item_get(ad->navi_bar)) {
ug_destroy_me(ug);
} else {
+ /* elm_naviframe_item_pop(ad->navi_bar); */
setting_view_cb_at_endKey(ad);
}
}
*general func
*
***************************************************/
-
-
-int setting_network_subscribe_tapi_events(void *data)
+void setting_network_popup_delete(void *data)
{
SETTING_TRACE_BEGIN;
- retv_if(data == NULL, SETTING_TAPI_REG_EVENT_ECORE_ERR);
+ /* error check */
+ retm_if(data == NULL,
+ "setting_network_tapi_popup_create Data parameter is NULL");
SettingNetworkUG *ad = (SettingNetworkUG *) data;
-
- int i = 0;
- int ret = SETTING_RETURN_SUCCESS;
- int iNumOfSSEvt = 0;
- int tapi_ret = TAPI_API_SUCCESS;
-
- int EvtList[] = {
- TAPI_EVENT_NETWORK_SEARCH_CNF,
- TAPI_EVENT_NETWORK_SELECT_CNF,
- TAPI_EVENT_NETWORK_SETNWBAND_CNF,
- TAPI_EVENT_NETWORK_GETNWBAND_CNF,
- TAPI_EVENT_NETWORK_GETSELECTIONMODE_CNF,
- TAPI_EVENT_NETWORK_GETPREFFEREDPLMN_CNF,
- TAPI_EVENT_NETWORK_SETPREFFEREDPLMN_CNF
- };
-
- if (tel_init() != TAPI_API_SUCCESS) {
- SETTING_TRACE_DEBUG("%s*** [ERR] tel_init. ***%s",
- SETTING_FONT_RED, SETTING_FONT_BLACK);
- return SETTING_TAPI_INIT_ECORE_ERR;
- }
- /* iNumOfSSEvt = sizeof(EvtList)/sizeof(TelTapiEventType_t); */
- iNumOfSSEvt = sizeof(EvtList) / sizeof(int);
-
- for (i = 0; i < iNumOfSSEvt; i++) {
- tapi_ret =
- tel_register_event(EvtList[i], &(ad->subs_id_net[i]),
- (TelAppCallback) &
- setting_network_tapi_event_callback,
- data);
- if (tapi_ret != TAPI_API_SUCCESS)
- SETTING_TRACE_ERROR
- ("passing event[%d] to invoke tel_register_event failed[%d]",
- ad->subs_id_net[i], tapi_ret);
- }
-
- if (tel_register_app_name("org.tizen.setting") != TAPI_API_SUCCESS) {
- SETTING_TRACE_ERROR("tel_register_app_name failed[tapi_ret=%d]",
- tapi_ret);
- return SETTING_TAPI_REG_EVENT_ECORE_ERR;
+ if (ad->network_ug_pop != NULL) {
+ evas_object_del(ad->network_ug_pop);
+ ad->network_ug_pop = NULL;
}
-
- return ret;
}
-int setting_network_unsubscribe_tapi_events(void *data)
+/* ***************************************************
+ *
+ *call back func
+ *
+ ***************************************************/
+
+void setting_tapi_set_band_cb(TapiHandle *handle, int result, void *data, void *user_data)
{
SETTING_TRACE_BEGIN;
- retv_if(data == NULL, SETTING_TAPI_DEREG_EVENT_ECORE_ERR);
- SettingNetworkUG *ad = (SettingNetworkUG *) data;
-
- int i = 0;
- int ret = SETTING_RETURN_SUCCESS;
- int iNumOfSSEvt = 0;
- int tapi_ret = TAPI_API_SUCCESS;
-
- int EvtList[] = {
- TAPI_EVENT_NETWORK_SEARCH_CNF,
- TAPI_EVENT_NETWORK_SELECT_CNF,
- TAPI_EVENT_NETWORK_SETNWBAND_CNF,
- TAPI_EVENT_NETWORK_GETNWBAND_CNF,
- TAPI_EVENT_NETWORK_GETSELECTIONMODE_CNF,
- TAPI_EVENT_NETWORK_GETPREFFEREDPLMN_CNF,
- TAPI_EVENT_NETWORK_SETPREFFEREDPLMN_CNF
- };
+ SETTING_TRACE(" - result = 0x%x", result);
+ ret_if(!user_data);
+ SettingNetworkUG *ad = user_data;
+ ret_if(NULL == ad->data_net_mode);
+
+ int err;
+ if (result == TAPI_NETWORK_NO_ERR) {
+ ad->net_mode = elm_radio_value_get(ad->data_net_mode->rgd);//get value from radio
+ setting_set_int_slp_key(ad->data_net_mode->int_slp_setting_binded,
+ ad->net_mode, &err);
+ char *sub_des = NULL;
+
+ switch (ad->net_mode) {
+ case TAPI_NETWORK_BAND_TYPE_ANY:
+ sub_des = _("IDS_COM_BODY_AUTOMATIC");
+ break;
- iNumOfSSEvt = sizeof(EvtList) / sizeof(int);
+ case TAPI_NETWORK_BAND_TYPE_GSM_900_1800:
+ sub_des = _(STR_SETTING_GSM_900_1800);
+ break;
- for (i = 0; i < iNumOfSSEvt; i++) {
- tapi_ret = tel_deregister_event(ad->subs_id_net[i]);
+ case TAPI_NETWORK_BAND_TYPE_GSM_850_1900:
+ sub_des = _(STR_SETTING_GSM_850_1900);
+ break;
- if (tapi_ret != TAPI_API_SUCCESS) {
- SETTING_TRACE_ERROR
- ("*** [ERR] tel_deregister_event. subs_id_net=%d, tapi_ret=%d ***",
- ad->subs_id_net[i], tapi_ret);
- continue;
+ case TAPI_NETWORK_BAND_TYPE_WCDMA:
+ sub_des = _(STR_SETTING_UMTS);
+ break;
+ default:
+ break;
+ }
+ if (ad->data_net_mode) {
+ ad->data_net_mode->sub_desc = (char *)g_strdup(sub_des);
+ elm_object_item_data_set(ad->data_net_mode->item, ad->data_net_mode);
+ elm_genlist_item_update(ad->data_net_mode->item);
}
- }
- tapi_ret = tel_deinit();
- if (tapi_ret != TAPI_API_SUCCESS) {
- SETTING_TRACE_ERROR("tel_deinit failed[tapi_ret = %d]",
- tapi_ret);
- return SETTING_TAPI_DEREG_EVENT_ECORE_ERR;
+
+ } else {
+ //rollback
+ //get value from vconf
+ setting_get_int_slp_key(ad->data_net_mode->int_slp_setting_binded,
+ &(ad->net_mode), &err);
+ elm_radio_value_set(ad->data_net_mode->rgd, ad->net_mode);
}
- return ret;
}
-
-static void
-setting_network_popup_response_cb(void *data, Evas_Object *obj,
- void *event_info)
+void setting_tapi_get_band_cb(TapiHandle *handle, int result, void *data, void *user_data)
{
SETTING_TRACE_BEGIN;
- if (obj) {
- evas_object_del(obj);
- obj = NULL;
+ SETTING_TRACE(" - result = 0x%x", result);
+ ret_if(!user_data);
+ SettingNetworkUG *ad = user_data;
+
+ if (result == TAPI_NETWORK_NO_ERR) {
+ TelNetworkBand_t band;
+ int temp_net_mode = 0;
+ memcpy(&band, data, sizeof(TelNetworkBand_t));
+ temp_net_mode = (int)band;
+ /* ***BEGIN*** Fixed the problem of word twinkle SAMSUNG 2010/7/21 modify */
+ if (temp_net_mode != ad->net_mode) {
+ ad->net_mode = temp_net_mode;
+ const char *sub_desc = NULL;
+ switch (ad->net_mode) {
+ case TAPI_NETWORK_BAND_TYPE_ANY:
+ sub_desc = _("IDS_COM_BODY_AUTOMATIC");
+ break;
+ case TAPI_NETWORK_BAND_TYPE_GSM_900_1800:
+ sub_desc = _(STR_SETTING_GSM_900_1800);
+ break;
+ case TAPI_NETWORK_BAND_TYPE_GSM_850_1900:
+ sub_desc = _(STR_SETTING_GSM_850_1900);
+ break;
+ case TAPI_NETWORK_BAND_TYPE_WCDMA:
+ sub_desc = _(STR_SETTING_UMTS);
+ break;
+ default:
+ break;
+ }
+ if (ad->data_net_mode) {
+ ad->data_net_mode->sub_desc = (char *)g_strdup(sub_desc);
+ elm_object_item_data_set (ad->data_net_mode->item, ad->data_net_mode);
+ elm_genlist_item_update(ad->data_net_mode->item);
+
+ }
+ vconf_set_int(VCONFKEY_SETAPPL_NETWORK_MODE_INT, ad->net_mode);
+ }
+ /* ****END**** Fixed the problem of word twinkle SAMSUNG 2010/7/21 modify */
+ } else {
}
- SettingNetworkUG *ad = (SettingNetworkUG *) data;
- ad->pop_del = NULL;
- ad->pop_reg = NULL;
- ad->pop_save = NULL;
- ad->network_ug_pop = NULL;
- SETTING_TRACE_END;
}
-void setting_network_popup_delete(void *data)
+
+void setting_tapi_set_plmn_mode_cb(TapiHandle *handle, int result, void *data, void *user_data)
{
SETTING_TRACE_BEGIN;
- /* error check */
- retm_if(data == NULL,
- "setting_network_tapi_popup_create Data parameter is NULL");
- SettingNetworkUG *ad = (SettingNetworkUG *) data;
- if (ad->network_ug_pop != NULL) {
- evas_object_del(ad->network_ug_pop);
- ad->network_ug_pop = NULL;
+ SETTING_TRACE(" - result = 0x%x", result);
+ ret_if(!user_data);
+ SettingNetworkUG *ad = user_data;
+
+ setting_network_popup_delete(ad);
+
+ if ((TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == ad->sel_net
+ && !ad->b_set_auto_network) ||
+ (TAPI_NETWORK_SELECTIONMODE_MANUAL == ad->sel_net
+ && !ad->b_set_manul_network))
+ {
+ /*The requeset has already been canceled, return directly*/
+ return;
}
-}
-void setting_network_popup_create(void *data, char *str_content, bool keep)
+ if(result != TAPI_NETWORK_NO_ERR) {/*roolback..*/
+ setting_create_popup_without_btn(ad, ad->win_get, NULL, _(keyStr_Failed_Select_Network), NULL, POPUP_INTERVAL, FALSE, FALSE);
+
+ //rollback sel_act and sel_net in setting_view_network_select_network.destroy()
+ setting_view_change(
+ &setting_view_network_select_network,
+ &setting_view_network_main, ad);
+
+ return;
+
+ }
+
+ setting_create_popup_without_btn(ad, ad->win_get, NULL, _(KeyStr_Saved), NULL, POPUP_INTERVAL, FALSE, FALSE);
+ if (0 != vconf_set_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, ad->sel_net)) {
+ SETTING_TRACE_ERROR("vconf[%s] set failed");
+ }
+ if (0 != vconf_set_int(VCONFKEY_SETAPPL_SELECT_OLD_NT_ACT, ad->sel_act)) {
+ SETTING_TRACE_ERROR("vconf[%s] set failed");
+ }
+
+ ad->b_set_auto_network = FALSE;
+ ad->b_set_manul_network = FALSE;
+ setting_network_update_sel_network(ad);
+}
+void setting_tapi_get_plmn_mode_cb(TapiHandle *handle, int result, void *data, void *user_data)
{
SETTING_TRACE_BEGIN;
- /* error check */
- retm_if(data == NULL,
- "setting_network_tapi_popup_create Data parameter is NULL");
- SettingNetworkUG *ad = (SettingNetworkUG *) data;
- if (ad->network_ug_pop != NULL) {
- elm_popup_timeout_set(ad->network_ug_pop, 0);
- setting_network_popup_update(data, str_content, keep);
- } else {
- ad->network_ug_pop =
- setting_create_popup_without_btn(ad, ad->win_get, str_content, NULL,
- setting_network_popup_response_cb,
- 0.0);
- if (!keep) {
- elm_popup_timeout_set(ad->network_ug_pop, 2.0);
+ SETTING_TRACE(" - result = 0x%x", result);
+ ret_if(!user_data);
+ SettingNetworkUG *ad = user_data;
+
+ if (result == TAPI_NETWORK_NO_ERR) {
+ TelNetworkSelectionMode_t sel;
+ memcpy(&sel, data, sizeof(TelNetworkSelectionMode_t));
+ SETTING_TRACE_DEBUG("ad->sel_net[%d] %s sel[%d]", ad->sel_net, ad->sel_net == sel ? "==" : "!=", sel);
+ if (ad->sel_net != sel) {
+ ad->sel_net = sel;
+ vconf_set_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, ad->sel_net);
+ setting_network_update_sel_network(ad);
}
+ } else {
}
}
-void setting_network_popup_update(void *data, char *str_content, bool keep)
+void setting_tapi_search_network_cb(TapiHandle *handle, int result, void *data, void *user_data)
{
+ ret_if(!data || !user_data);
+ SettingNetworkUG *ad = user_data;
SETTING_TRACE_BEGIN;
- /* error check */
- retm_if(data == NULL,
- "setting_network_tapi_popup_create Data parameter is NULL");
- SettingNetworkUG *ad = (SettingNetworkUG *) data;
- if (ad->network_ug_pop == NULL) {
- setting_network_popup_create(ad, str_content, keep);
+ SETTING_TRACE(" - result = %d", result);
+ setting_network_popup_delete(ad);
+
+ if (!ad->b_searching_network) {
+ /*The requeset has already been canceled, don't do detail process*/
return;
}
- if (str_content) {
- char r_str_text[HELP_MSG_BUFF_SIZE] = { 0, };
- snprintf(r_str_text, HELP_MSG_BUFF_SIZE-1-strlen("</align>"), "<align=center>%s", str_content);
- g_strlcat(r_str_text, "</align>", HELP_MSG_BUFF_SIZE);
- elm_object_text_set(ad->network_ug_pop, r_str_text);
- }
- if (!keep) {
- elm_popup_timeout_set(ad->network_ug_pop, 2.0);
+ //setting_finish_progress_genlist_item(ad->data_selected_network_item);
+ if (ad->data_search_network_item)
+ {
+ elm_object_item_del(ad->data_search_network_item->item);
+ ad->data_search_network_item = NULL;
}
-}
-Evas_Object *setting_network_create_register_popup(void *data)
-{
- SETTING_TRACE_BEGIN;
- /* error check */
- retvm_if(data == NULL, NULL,
- "[Setting > Network] Data parameter is NULL");
+ ad->b_searching_network = FALSE;
+ int valid_cnt = 0;
+ if (result == TAPI_NETWORK_NO_ERR) {
+ int cnt = 0;
+ memcpy(&(ad->plmn_info), data, sizeof(TelNetworkPlmnList_t));
- SettingNetworkUG *ad = (SettingNetworkUG *) data;
- Evas_Object *popup = NULL;
- popup =
- setting_create_popup_without_btn(ad, ad->win_get, _("Registering"), NULL,
- setting_network_popup_response_cb, POPUP_INTERVAL);
- ad->pop_reg = popup;
- return popup;
-}
+ Setting_GenGroupItem_Data *item_data = NULL;
-Evas_Object *setting_network_preferred_network_create_save_popup(void *data)
-{
- SETTING_TRACE_BEGIN;
- /* error check */
- retvm_if(data == NULL, NULL,
- "[Setting > Network] Data parameter is NULL");
+ const char *pa_net_name = vconf_get_str(VCONFKEY_TELEPHONY_NWNAME);
+ SETTING_TRACE("VCONFKEY_TELEPHONY_NWNAME:pa_net_name:%s", pa_net_name);
- SettingNetworkUG *ad = (SettingNetworkUG *) data;
- Evas_Object *popup = NULL;
- popup =
- setting_create_popup_without_btn(ad, ad->win_get, _("IDS_ST_POP_SAVING"), NULL,
- setting_network_popup_response_cb, POPUP_INTERVAL);
- ad->pop_save = popup;
- return popup;
-}
+ char name[MAX_COMMON_BUFFER_LEN] = {0, };
+ while(cnt < ad->plmn_info.networks_count) {
+ SETTING_TRACE("network name from TAPI[%d]:%s(%s)", cnt,
+ ad->plmn_info.network_list[cnt].network_name,
+ setting_network_get_act_str(ad->plmn_info.network_list[cnt].access_technology));
-Evas_Object *setting_network_preferred_network_create_delete_popup(void *data)
-{
- SETTING_TRACE_BEGIN;
- /* error check */
- retvm_if(data == NULL, NULL,
- "[Setting > Network] Data parameter is NULL");
+ if (TAPI_FORBIDDEN_PLMN == ad->plmn_info.network_list[cnt].type_of_plmn) {
+ cnt++;
+ continue;
+ }
- SettingNetworkUG *ad = (SettingNetworkUG *) data;
- Evas_Object *popup = NULL;
- popup =
- setting_create_popup_without_btn(ad, ad->win_get, _("IDS_COM_SK_DELETE"), NULL,
- setting_network_popup_response_cb, 0);
- ad->pop_del = popup;
- return popup;
+ if (TAPI_NETWORK_SELECTIONMODE_MANUAL == ad->sel_net
+ && 0 == safeStrCmp(pa_net_name, ad->plmn_info.network_list[cnt].network_name)
+ && ad->plmn_info.network_list[cnt].access_technology == ad->sel_act)
+ {
+ //already displayed.
+ cnt++;
+ continue;
+ }
+
+ memset(name, 0, MAX_COMMON_BUFFER_LEN);
+ snprintf(name, MAX_COMMON_BUFFER_LEN, "%s (%s)",
+ ad->plmn_info.network_list[cnt].network_name,
+ setting_network_get_act_str(ad->plmn_info.network_list[cnt].access_technology));
+
+ item_data = setting_create_Gendial_field_1radio(
+ ad->genlist_sel_network,
+ &itc_1text_2icon_2,
+ setting_network_Gendial_select_plmn_cb,
+ ad,
+ SWALLOW_Type_1RADIO,
+ ad->chk_sel,
+ TAPI_NETWORK_SELECTIONMODE_MANUAL+valid_cnt+1,
+ name,
+ setting_network_select_network_chk_changed);
+ if (NULL == item_data)
+ {
+ SETTING_TRACE_ERROR("Failed to calloc memory");
+ cnt++;
+ continue;
+ }
+ item_data->userdata = ad;
+ if (TAPI_NETWORK_SELECTIONMODE_AUTOMATIC != ad->sel_net
+ && 0 == safeStrCmp(pa_net_name, ad->plmn_info.network_list[cnt].network_name)
+ && ad->plmn_info.network_list[cnt].access_technology == ad->sel_act)
+ {
+ elm_radio_value_set(ad->chk_sel, item_data->chk_status);//let select nothing
+ }
+ cnt++;
+ valid_cnt++;
+ }
+ FREE(pa_net_name);
+
+ SETTING_TRACE("Found %d valid networks in total[%d]", valid_cnt, cnt);
+ valid_cnt = 0;
+ if (valid_cnt > 0){
+ setting_create_popup_without_btn(ad, ad->win_get, NULL, _(keyStr_Searched), NULL, POPUP_INTERVAL, FALSE, FALSE);
+ } else { //there is no invalid plmn nearby
+ setting_create_popup_without_btn(ad, ad->win_get, NULL, _("There is no network nearby"), NULL, POPUP_INTERVAL, FALSE, FALSE);
+ }
+ } else {
+ setting_create_popup_without_btn(ad, ad->win_get, NULL, _(keyStr_Failed_Searched), NULL, POPUP_INTERVAL, FALSE, FALSE);
+ }
+ if (0 == valid_cnt && TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == ad->sel_net && ad->data_auto_network_item)
+ {
+ ad->data_auto_network_item->chk_status = TRUE;
+ elm_object_item_data_set(ad->data_auto_network_item->item, ad->data_auto_network_item);
+ elm_genlist_item_item_class_update(ad->data_auto_network_item->item, &(itc_2text_1icon_6));
+ }
}
-Evas_Object *setting_network_select_network_create_search_popup(void *data)
+
+void setting_tapi_get_serving_network_cb(TapiHandle *handle, int result, void *data, void *user_data)
{
SETTING_TRACE_BEGIN;
- /* error check */
- retv_if(data == NULL, NULL);
-
- SettingNetworkUG *ad = (SettingNetworkUG *) data;
- Evas_Object *popup = NULL;
- popup =
- setting_create_popup_without_btn(ad, ad->win_get, _("IDS_COM_POP_SEARCHING"),
- NULL, NULL, 0);
- ad->pop_sch = popup;
- return popup;
+ SETTING_TRACE(" - result = 0x%x", result);
+ ret_if(!user_data || !data);
+ SettingNetworkUG *ad = user_data;
+ TelNetworkServing_t *srv_nt = data;
+
+ if (result == TAPI_NETWORK_NO_ERR)
+ {
+ ad->sel_act = srv_nt->act;
+ vconf_set_int(VCONFKEY_SETAPPL_SELECT_OLD_NT_ACT, ad->sel_act);
+
+ FREE(ad->sel_network);
+ ad->sel_network = vconf_get_str(VCONFKEY_TELEPHONY_NWNAME);
+ if (NULL == ad->sel_network) {
+ ad->sel_network = strndup("IDS_ST_BODY_NOSERVICE", strlen("IDS_ST_BODY_NOSERVICE")+1);
+ }
+ setting_network_update_sel_network(ad);
+ }
+ else
+ {
+ //if failed, do nothing..
+ }
+ SETTING_TRACE_END;
+
}
-void setting_network_preferred_network_create_isf(Evas_Object *entry)
+
+void setting_tapi_cancel_manual_search_cb(TapiHandle *handle, int result, void *data, void *user_data)
{
SETTING_TRACE_BEGIN;
- ecore_imf_init();
- SETTING_TRACE_DEBUG
- ("Given focus to the entry and then soft keyboard will be shown automatically !");
- elm_object_focus_set(entry, EINA_TRUE);
+ SETTING_TRACE(" - result = 0x%x", result);
+ ret_if(!user_data);
+ //SettingNetworkUG *ad = user_data;
}
-/* ***************************************************
- *
- *call back func
- *
- ***************************************************/
-
-#ifdef Status
-#undef Status
-#endif
-
-void setting_network_tapi_event_callback(TelTapiEvent_t *event, void *data)
+void setting_tapi_set_preferred_plmn_cb(TapiHandle *handle, int result, void *data, void *user_data)
{
SETTING_TRACE_BEGIN;
- ret_if(data == NULL || event == NULL);
- SETTING_TRACE("event->EventClass=\t%d", (int)(event->EventClass));
- SETTING_TRACE("event->EventType=\t%d", event->EventType);
- SETTING_TRACE("event->Status=\t%d", event->Status);
- SETTING_TRACE("event->RequestId=\t%d", event->RequestId);
- SettingNetworkUG *ad = (SettingNetworkUG *) data;
-
- switch (event->EventClass) {
- case TAPI_EVENT_CLASS_NETWORK:
- {
- switch (event->EventType) {
- /* search network list */
- case TAPI_EVENT_NETWORK_SEARCH_CNF:
+ SETTING_TRACE(" - result = 0x%x", result);
+ ret_if(!user_data);
+ SettingNetworkUG *ad = user_data;
+ setting_network_popup_delete(ad);
+
+ if (result != TAPI_NETWORK_NO_ERR) {
+ switch (ad->op_type) {
+ case SETTING_NETWORK_PREFERRED_NETWORK_DELETE:
{
- SETTING_TRACE_DEBUG("Case: TAPI_EVENT_NETWORK_SEARCH_CNF");
-
- setting_network_popup_delete(ad);
- ad->pop_sch = NULL;
-
- if (!ad->b_searching_network) {
- /*The requeset has already been canceled, don't do detail process*/
- return;
- }
- bool need_reset_flag = FALSE;
- if (ad->data_search_network_item)
- {
- if (ad->data_search_network_item->chk_status ==
- elm_radio_value_get(ad->chk_sel)) {
- elm_radio_value_set(ad->chk_sel, -1);//let select nothing
- need_reset_flag = TRUE;
- }
- elm_object_item_del(ad->data_search_network_item->item);
- ad->data_search_network_item = NULL;
- }
-
- ad->b_searching_network = FALSE;
-
- if (event->Status == TAPI_NETWORK_NO_ERR) {
- int cnt = 0;
- int valid_cnt = 0;
- ret_if(NULL == event->pData);
- memcpy(&(ad->plmn_info), event->pData,
- sizeof(TelNetworkPlmnList_t));
-
- Setting_GenGroupItem_Data *item_data = NULL;
-
- const char *pa_net_name = vconf_get_str(VCONFKEY_TELEPHONY_NWNAME);
- SETTING_TRACE("VCONFKEY_TELEPHONY_NWNAME:pa_net_name:%s", pa_net_name);
- //SETTING_TRACE("Selected network name:%s",ad->data_selected_network_item->keyStr);
- while(cnt < ad->plmn_info.networks_count) {
- SETTING_TRACE("network name from TAPI[%d]:%s", cnt, ad->plmn_info.network_list[cnt].network_name);
- if (TAPI_FORBIDDEN_PLMN ==
- ad->plmn_info.network_list[cnt].type_of_plmn) {
- cnt++;
- continue;
- }
-
- if (ad->data_selected_network_item &&
- 0 == safeStrCmp(ad->data_selected_network_item->keyStr,
- ad->plmn_info.network_list[cnt].network_name)) {
- cnt++;
- continue;
- }
- item_data = setting_create_Gendial_field_1radio(
- ad->genlist_sel_network,
- &(ad->itc_1text_2icon),
- setting_network_Gendial_select_plmn_cb,
- ad,
- SWALLOW_Type_1RADIO,
- ad->chk_sel,
- TAPI_NETWORK_SELECTIONMODE_MANUAL+valid_cnt+1,
- ad->plmn_info.network_list[cnt].network_name,
- setting_network_select_network_chk_changed);
- if (NULL == item_data)
- {
- SETTING_TRACE_ERROR("Failed to calloc memory");
- cnt++;
- continue;
- }
- item_data->userdata = ad;
- if (need_reset_flag &&
- 0 == safeStrCmp(pa_net_name, ad->plmn_info.network_list[cnt].network_name))
- {
- elm_radio_value_set(ad->chk_sel, item_data->chk_status);//let select nothing
- }
- cnt++;
- valid_cnt++;
- }
- FREE(pa_net_name);
-
- SETTING_TRACE("Found %d valid networks in total[%d]", valid_cnt, cnt);
- setting_network_popup_update(ad, _("Searched"), FALSE);
- } else {
- setting_network_popup_update(ad, _("Searching network failed"), FALSE);
- }
- break;
+ setting_network_preferred_network_delete_failed(ad);
+ break;
}
- /*set plmn*/
- case TAPI_EVENT_NETWORK_SELECT_CNF:
+ default:
{
- SETTING_TRACE_DEBUG("Case: set plmn(ad->sel_net:%d)",
- ad->sel_net);
-
- if ((TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == ad->sel_net
- && !ad->b_set_auto_network) ||
- (TAPI_NETWORK_SELECTIONMODE_MANUAL == ad->sel_net
- && !ad->b_set_manul_network))
- {
- /*The requeset has already been canceled, return directly*/
- return;
- }
-
- if(event->Status != TAPI_NETWORK_NO_ERR) {/*roolback..*/
- setting_network_popup_update(ad,
- _("Select network failed"), FALSE);
- if (0 != vconf_get_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, &ad->sel_net)) {
- SETTING_TRACE_ERROR("vconf get failed");
- }
-
- setting_view_change(
- &setting_view_network_select_network,
- &setting_view_network_main, ad);
-
- return;
-
- }
- setting_finish_progress_genlist_item(ad->data_selected_network_item);
-
- setting_network_popup_update(ad, _("Saved!"), FALSE);
- if (0 != vconf_set_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, ad->sel_net)) {
- SETTING_TRACE_ERROR("vconf[%s] set failed");
- }
- const char *pa_net_name = vconf_get_str(VCONFKEY_TELEPHONY_NWNAME);
- SETTING_TRACE("sel_net_name:%s", pa_net_name);
- if (NULL == pa_net_name) {
- pa_net_name = "IDS_ST_BODY_NOSERVICE";
- }
-
- if (ad->data_auto_network_item) {
- if (TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == ad->sel_net)
- {
- elm_genlist_item_item_class_update(
- ad->data_auto_network_item->item,
- &ad->itc_2text_2icon_3);
-
- SETTING_TRACE_DEBUG("After set as Automatic, update "\
- "ad->data_auto_network_item to be [%s]",
- pa_net_name);
- ad->data_auto_network_item->sub_desc =
- (char *)g_strdup(_(pa_net_name));
- elm_object_item_data_set( ad->data_auto_network_item->item, ad->data_auto_network_item);
- elm_genlist_item_update( ad->data_auto_network_item->item);
- } else {
- elm_genlist_item_item_class_update(
- ad->data_auto_network_item->item,
- &ad->itc_1text_2icon);
- }
- }
- char sub_desc[MAX_COMMON_BUFFER_LEN] = { 0, };
- if (TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == ad->sel_net) {
- snprintf(sub_desc, MAX_COMMON_BUFFER_LEN,
- "%s. %s", _("IDS_COM_BODY_AUTOMATIC"),
- _(pa_net_name));
-
- } else {
- snprintf(sub_desc, MAX_COMMON_BUFFER_LEN,
- "%s. %s", _("IDS_COM_BODY_MANUAL"),
- _(pa_net_name));
- }
- SETTING_TRACE_DEBUG("After set as Automatic, update "\
- "ad->data_sel_net to be [%s]", sub_desc);
- if (ad->data_sel_net && !isEmptyStr(sub_desc)) {
- ad->data_sel_net->sub_desc =
- (char *)g_strdup(sub_desc);
- elm_object_item_data_set(ad->data_sel_net->item, ad->data_sel_net);
- elm_genlist_item_update(ad->data_sel_net->item);
- }
- ad->b_set_auto_network = FALSE;
- ad->b_set_manul_network = FALSE;
-
- FREE(pa_net_name);
+ setting_create_popup_without_btn(ad, ad->win_get, NULL, _("IDS_COM_POP_ERROR"), NULL, POPUP_INTERVAL, FALSE, FALSE);
break;
}
- /*get select network*/
- case TAPI_EVENT_NETWORK_GETSELECTIONMODE_CNF:
+ }
+ } else {
+ int tapi_ret = TAPI_API_SUCCESS;
+ switch (ad->op_type) {
+ case SETTING_NETWORK_PREFERRED_NETWORK_NEW:
{
- SETTING_TRACE_DEBUG("Case: get select network");
-
-
- if (event->Status == TAPI_NETWORK_NO_ERR) {
- TelNetworkSelectionMode_t sel;
- memcpy(&sel, event->pData,
- sizeof(TelNetworkSelectionMode_t));
- SETTING_TRACE_DEBUG("ad->sel_net[%d] %s sel[%d]",
- ad->sel_net,
- ad->sel_net == sel ? "==" : "!=",
- sel);
- if (ad->sel_net != sel) {
- char sub_desc[MAX_COMMON_BUFFER_LEN] = { 0, };
- const char *pa_net_name = vconf_get_str(VCONFKEY_TELEPHONY_NWNAME);
- SETTING_TRACE("pa_net_name:%s", pa_net_name);
- if (NULL == pa_net_name) {
- pa_net_name = "IDS_ST_BODY_NOSERVICE";
- }
-
- if (TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == sel) {
- snprintf(sub_desc, MAX_COMMON_BUFFER_LEN,
- "%s. %s", _("IDS_COM_BODY_AUTOMATIC"),
- _(pa_net_name));
-
- } else if(TAPI_NETWORK_SELECTIONMODE_MANUAL == sel) {
- snprintf(sub_desc, MAX_COMMON_BUFFER_LEN,
- "%s. %s", _("IDS_COM_BODY_MANUAL"),
- _(pa_net_name));
- }
- SETTING_TRACE_DEBUG("Update "\
- "ad->data_sel_net to be [%s]",
- sub_desc);
- if (ad->data_sel_net && !isEmptyStr(sub_desc))
- {
- ad->data_sel_net->sub_desc =
- (char *)g_strdup(sub_desc);
- elm_object_item_data_set(ad->data_sel_net->item, ad->data_sel_net);
- elm_genlist_item_update(ad->data_sel_net->item);
- }
-
- ad->sel_net = sel;
- }
-
- } else {
- SETTING_TRACE
- ("*** [ERR] TAPI_EVENT_NETWORK_GETSELECTIONMODE_CNF, STATUS=0x%x ***",
- event->Status);
- }
+ setting_view_change
+ (&setting_view_network_preferred_network_new,
+ &setting_view_network_preferred_network,ad);
+ tapi_ret =
+ tel_get_network_preferred_plmn
+ (ad->handle, setting_tapi_get_preferred_plmn_cb, ad);
break;
}
- /* get network mode */
- case TAPI_EVENT_NETWORK_GETNWBAND_CNF:
+
+ case SETTING_NETWORK_PREFERRED_NETWORK_LIST:
{
- SETTING_TRACE_DEBUG("Case: TAPI_EVENT_NETWORK_GETNWBAND_CNF");
-
- if (event->Status ==
- TAPI_NETWORK_NO_ERR) {
- TelNetworkBand_t band;
- int temp_net_mode = 0;
- memcpy(&band, event->pData,
- sizeof
- (TelNetworkBand_t));
- temp_net_mode = (int)band;
- /* ***BEGIN*** Fixed the problem of word twinkle SAMSUNG 2010/7/21 modify */
- if (temp_net_mode !=
- ad->net_mode) {
- ad->net_mode =
- temp_net_mode;
- const char *sub_desc =
- NULL;
- switch (ad->net_mode) {
- case TAPI_NETWORK_BAND_TYPE_ANY:
- sub_desc =
- _("IDS_COM_BODY_AUTOMATIC");
- break;
- case TAPI_NETWORK_BAND_TYPE_GSM_900_1800:
- sub_desc =
- _(STR_SETTING_GSM_900_1800);
- break;
- case TAPI_NETWORK_BAND_TYPE_GSM_850_1900:
- sub_desc =
- _(STR_SETTING_GSM_850_1900);
- break;
- case TAPI_NETWORK_BAND_TYPE_WCDMA:
- sub_desc =
- _(STR_SETTING_UMTS);
- break;
- default:
- break;
- }
- if (ad->data_net_mode) {
- ad->data_net_mode->sub_desc = (char *)g_strdup(sub_desc);
- elm_object_item_data_set (ad->data_net_mode->item, ad->data_net_mode);
- elm_genlist_item_update(ad->data_net_mode->item);
-
- }
- vconf_set_int
- (VCONFKEY_SETAPPL_NETWORK_MODE_INT,
- ad->net_mode);
- }
- /* ****END**** Fixed the problem of word twinkle SAMSUNG 2010/7/21 modify */
- } else {
- SETTING_TRACE_ERROR
- ("*** [ERR] TAPI_EVENT_NETWORK_GETNWBAND_CNF, STATUS=0x%x ***",
- event->Status);
- }
+ setting_view_change
+ (&setting_view_network_preferred_network_list,
+ &setting_view_network_preferred_network,
+ ad);
+ tapi_ret =
+ tel_get_network_preferred_plmn
+ (ad->handle, setting_tapi_get_preferred_plmn_cb, ad);
break;
}
- /* set network mode */
- case TAPI_EVENT_NETWORK_SETNWBAND_CNF:
- {
- SETTING_TRACE_DEBUG("Case: TAPI_EVENT_NETWORK_SETNWBAND_CNF");
-
- int err;
- if (event->Status ==
- TAPI_NETWORK_NO_ERR) {
- ret_if(NULL == ad->data_net_mode);
- ad->net_mode = //get value from radio
- elm_radio_value_get(ad->data_net_mode->rgd);
- setting_set_int_slp_key(ad->data_net_mode->int_slp_setting_binded,
- ad->net_mode, &err);
- char *sub_des = NULL;
-
- switch (ad->net_mode) {
- case TAPI_NETWORK_BAND_TYPE_ANY:
- sub_des = _("IDS_COM_BODY_AUTOMATIC");
- break;
-
- case TAPI_NETWORK_BAND_TYPE_GSM_900_1800:
- sub_des = _(STR_SETTING_GSM_900_1800);
- break;
-
- case TAPI_NETWORK_BAND_TYPE_GSM_850_1900:
- sub_des = _(STR_SETTING_GSM_850_1900);
- break;
-
- case TAPI_NETWORK_BAND_TYPE_WCDMA:
- sub_des = _(STR_SETTING_UMTS);
- break;
- default:
- break;
- }
- if (ad->data_net_mode) {
- ad->data_net_mode->sub_desc = (char *)g_strdup(sub_des);
- elm_object_item_data_set(ad->data_net_mode->item, ad->data_net_mode);
- elm_genlist_item_update(ad->data_net_mode->item);
- }
-
-
- } else {
- SETTING_TRACE_ERROR
- ("*** [ERR] TAPI_EVENT_NETWORK_SETNWBAND_CNF, STATUS=0x%x ***",
- event->Status);
-
- //rollback
- //get value from vconf
- setting_get_int_slp_key(ad->data_net_mode->int_slp_setting_binded,
- &(ad->net_mode), &err);
- elm_radio_value_set(ad->data_net_mode->rgd, ad->net_mode);
- }
+ case SETTING_NETWORK_PREFERRED_NETWORK_EDIT:
+ {
+ setting_view_change
+ (&setting_view_network_preferred_network_edit,
+ &setting_view_network_preferred_network,
+ ad);
+ tapi_ret =
+ tel_get_network_preferred_plmn
+ (ad->handle, setting_tapi_get_preferred_plmn_cb, ad);
break;
}
- /* get preferred network */
- case TAPI_EVENT_NETWORK_GETPREFFEREDPLMN_CNF:
+ case SETTING_NETWORK_PREFERRED_NETWORK_DELETE:
{
- SETTING_TRACE_DEBUG("Case: TAPI_EVENT_NETWORK_GETPREFFEREDPLMN_CNF");
-
- if (event->Status ==
- TAPI_NETWORK_NO_ERR) {
- memset(&(ad->pref_list), 0x00,
- sizeof
- (TelNetworkPrefferedPlmnList_t));
- memcpy(&(ad->pref_list),
- event->pData,
- sizeof
- (TelNetworkPrefferedPlmnList_t));
-
- SETTING_TRACE
- ("*********** ad->op_type = %d",
- ad->op_type);
- SETTING_TRACE
- ("ad->pref_list.NumOfPreffPlmns:%d",
- ad->
- pref_list.NumOfPreffPlmns);
- switch (ad->op_type) {
- case SETTING_NETWORK_PREFERRED_NETWORK_DELETE:
- {
- setting_network_preferred_network_delete_draw_network_list
- (ad);
- break;
- }
- default:
- {
- setting_network_preferred_network_refresh_view
- (ad);
- char info
- [MAX_DISPLAY_NAME_LEN_ON_UI]
- = { 0 };
- if (ad->pref_list.NumOfPreffPlmns > 1) {
- snprintf(info, sizeof(info),
- "Get %d preferred networks",
- ad->pref_list.NumOfPreffPlmns);
- } else {
- snprintf(info, sizeof(info),
- "Get %d preferred network",
- ad->pref_list.NumOfPreffPlmns);
- }
- setting_network_popup_update(ad, info,
- FALSE);
- break;
- }
- }
- } else {
- switch (ad->op_type) {
- case SETTING_NETWORK_PREFERRED_NETWORK_DELETE:
- {
- setting_network_preferred_network_delete_failed
- (ad);
- break;
- }
- default:
- {
- setting_network_popup_update(ad,
- _("Get preferred network failed"),
- FALSE);
- break;
- }
- }
- }
+ setting_network_preferred_network_delete_ok
+ (ad);
+ return;
+ }
+ default:
+ {
+ SETTING_TRACE_DEBUG
+ (" Unknown prederred network type");
+ break;
+ }
+ }
+
+ if (tapi_ret !=
+ TAPI_API_SUCCESS) {
+ SETTING_TRACE_ERROR
+ ("*** [ERR] tel_get_network_preferred_plmn. err=%d ***",
+ tapi_ret);
+ }
+ }
+
+}
+
+void setting_tapi_get_preferred_plmn_cb(TapiHandle *handle, int result, void *data, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ SETTING_TRACE(" - result = 0x%x", result);
+ ret_if(!user_data);
+ SettingNetworkUG *ad = user_data;
+
+ SETTING_TRACE_DEBUG("Case: TAPI_EVENT_NETWORK_GETPREFFEREDPLMN_CNF");
+ setting_network_popup_delete(ad);
+
+ if (result == TAPI_NETWORK_NO_ERR) {
+ memcpy(&(ad->pref_list), data,sizeof(TelNetworkPreferredPlmnList_t));
+
+ SETTING_TRACE("*********** ad->op_type = %d",ad->op_type);
+ SETTING_TRACE("ad->pref_list.NumOfPrefPlmns:%d",ad->pref_list.NumOfPrefPlmns);
+ switch (ad->op_type) {
+ case SETTING_NETWORK_PREFERRED_NETWORK_DELETE:
+ {
+ setting_network_preferred_network_delete_draw_network_list(ad);
break;
}
- /* set preferred network */
- case TAPI_EVENT_NETWORK_SETPREFFEREDPLMN_CNF:
+ default:
{
- SETTING_TRACE_DEBUG("Case: TAPI_EVENT_NETWORK_SETPREFFEREDPLMN_CNF");
-
- if (event->Status !=
- TAPI_NETWORK_NO_ERR) {
- switch (ad->op_type) {
- case SETTING_NETWORK_PREFERRED_NETWORK_DELETE:
- {
- setting_network_preferred_network_delete_failed
- (ad);
- break;
- }
- default:
- {
- setting_network_popup_update
- (ad, _("IDS_COM_POP_ERROR"),
- FALSE);
- break;
- }
- }
+ setting_network_preferred_network_refresh_view
+ (ad);
+ char info[MAX_DISPLAY_NAME_LEN_ON_UI] = { 0 };
+ if (ad->pref_list.NumOfPrefPlmns > 1) {
+ snprintf(info, sizeof(info), "Get %d preferred networks",
+ ad->pref_list.NumOfPrefPlmns);
} else {
- int request_id = -1;
- int tapi_ret = TAPI_API_SUCCESS;
- switch (ad->op_type) {
- case SETTING_NETWORK_PREFERRED_NETWORK_NEW:
- {
- setting_view_change
- (&setting_view_network_preferred_network_new,
- &setting_view_network_preferred_network,
- ad);
- tapi_ret =
- tel_get_network_preferred_plmn
- (&request_id);
- break;
- }
-
- case SETTING_NETWORK_PREFERRED_NETWORK_LIST:
- {
-
- setting_view_change
- (&setting_view_network_preferred_network_list,
- &setting_view_network_preferred_network,
- ad);
- tapi_ret =
- tel_get_network_preferred_plmn
- (&request_id);
- break;
- }
-
- case SETTING_NETWORK_PREFERRED_NETWORK_EDIT:
- {
- setting_view_change
- (&setting_view_network_preferred_network_edit,
- &setting_view_network_preferred_network,
- ad);
- tapi_ret =
- tel_get_network_preferred_plmn
- (&request_id);
- break;
- }
- case SETTING_NETWORK_PREFERRED_NETWORK_DELETE:
- {
- setting_network_preferred_network_delete_ok
- (ad);
- return;
- }
- default:
- {
- SETTING_TRACE_DEBUG
- (" Unknown prederred network type");
- break;
- }
- }
-
- if (tapi_ret !=
- TAPI_API_SUCCESS) {
- SETTING_TRACE_ERROR
- ("*** [ERR] tel_get_network_preferred_plmn. err=%d ***",
- tapi_ret);
- }
+ snprintf(info, sizeof(info), "Get %d preferred network",
+ ad->pref_list.NumOfPrefPlmns);
}
+ setting_create_popup_without_btn(ad, ad->win_get, NULL, _(info), NULL, POPUP_INTERVAL, FALSE, FALSE);
break;
}
- default:
+ }
+ } else {
+ switch (ad->op_type) {
+ case SETTING_NETWORK_PREFERRED_NETWORK_DELETE:
{
- SETTING_TRACE_DEBUG
- ("Unkonwn TAPI event");
+ setting_network_preferred_network_delete_failed
+ (ad);
break;
}
- }
- break;
- }
- default:
+ default:
{
- SETTING_TRACE_DEBUG("Unkonwn TAPI event class");
+ setting_create_popup_without_btn(ad, ad->win_get, NULL, _(keyStr_Failed_Get_PreferNetwork), NULL, POPUP_INTERVAL, FALSE, FALSE);
break;
}
+ }
}
- SETTING_TRACE_END;
}
-void setting_network_register_network(Setting_GenGroupItem_Data* list_item)
+void __register_network(Setting_GenGroupItem_Data* list_item)
{
SETTING_TRACE_BEGIN;
ret_if(list_item == NULL);
SETTING_TRACE("process item [%s]", list_item->keyStr);
SettingNetworkUG *ad = list_item->userdata;
ret_if(ad == NULL);
-
+
int tapi_ret = TAPI_API_INVALID_INPUT;
- int request_id = 0;
//cancel the searching operation
-
+
if (ad->data_search_network_item)
{
elm_object_item_del(ad->data_search_network_item->item);
ad->data_search_network_item = NULL;
}
- setting_finish_progress_genlist_item(ad->data_selected_network_item);
if (ad->b_searching_network) {
- tapi_ret = tel_cancel_network_manual_search(&request_id);
+ SETTING_TRACE("Sending tel_cancel_network_manual_search..");
+ tapi_ret = tel_cancel_network_manual_search(ad->handle, setting_tapi_cancel_manual_search_cb, ad);
if (tapi_ret != TAPI_API_SUCCESS) {
- SETTING_TRACE_ERROR("*** [ERR] tel_search_network. "\
+ SETTING_TRACE_ERROR("*** [ERR] tel_cancel_network_manual_search. "\
"tapi_ret=%d ***", tapi_ret);
}
else
if (0 == safeStrCmp(list_item->keyStr, "IDS_COM_BODY_AUTOMATIC")) {
ad->sel_net = TAPI_NETWORK_SELECTIONMODE_AUTOMATIC;
- tapi_ret = tel_select_network_automatic(&request_id);
+ SETTING_TRACE("Sending tel_select_network_automatic..");
+ tapi_ret = tel_select_network_automatic(ad->handle, setting_tapi_set_plmn_mode_cb, ad);
if (tapi_ret != TAPI_API_SUCCESS) {
SETTING_TRACE_DEBUG("*** [ERR] tel_select_network_automatic."\
" tapi_ret=%d ***",tapi_ret);
} else {
- setting_begin_progress_genlist_item(list_item);
- ad->data_selected_network_item = list_item;
+ ad->network_ug_pop = setting_create_popup_without_btn(ad, ad->win_get, NULL,
+ _("IDS_COM_POP_PROCESSING"), NULL,
+ 0.0, TRUE, TRUE);
+
+ if (ad->data_auto_network_item)
+ {
+ ad->data_auto_network_item->sub_desc = (char *)g_strdup("....");
+ elm_genlist_item_item_class_update(ad->data_auto_network_item->item, &(itc_2text_1icon_6));
+ }
+
ad->b_set_manul_network = FALSE;
ad->b_set_auto_network = TRUE;
+ ad->sel_act = -1;//means "Automatic"
}
} else {
ad->sel_net = TAPI_NETWORK_SELECTIONMODE_MANUAL;
ad->b_set_auto_network = FALSE;
int cnt = 0;
- SETTING_TRACE("ad->plmn_info.networks_count:%d",
+ SETTING_TRACE("ad->plmn_info.networks_count:%d",
ad->plmn_info.networks_count);
+ char name[MAX_COMMON_BUFFER_LEN] = {0, };
for(; cnt < ad->plmn_info.networks_count; cnt++)
{
- SETTING_TRACE("ad->plmn_info.network_list[cnt].network_name:%s",
+ SETTING_TRACE("ad->plmn_info.network_list[cnt].network_name:%s",
ad->plmn_info.network_list[cnt].network_name);
- if(!safeStrCmp(list_item->keyStr,
- ad->plmn_info.network_list[cnt].network_name))
+ memset(name, 0, MAX_COMMON_BUFFER_LEN);
+ snprintf(name, MAX_COMMON_BUFFER_LEN, "%s (%s)",
+ ad->plmn_info.network_list[cnt].network_name,
+ setting_network_get_act_str(ad->plmn_info.network_list[cnt].access_technology));
+
+ if(!safeStrCmp(list_item->keyStr, name))
{
break;
}
- }
+ }
- SETTING_TRACE_DEBUG("%s*** [Selected PLMN] name=%s, "\
+ SETTING_TRACE_DEBUG("*** [Selected PLMN] name=%s, "\
"srv provider=%s, PLMN ID=%u, type=%d, "\
- "access tech=%d ***%s", SETTING_FONT_BGREEN,
- ad->plmn_info.network_list[cnt].network_name,
- ad->plmn_info.network_list[cnt].service_provider_name,
+ "access tech=%d ***",
+ ad->plmn_info.network_list[cnt].network_name,
+ ad->plmn_info.network_list[cnt].service_provider_name,
ad->plmn_info.network_list[cnt].plmn_id,
- (int)(ad->plmn_info.network_list[cnt].type_of_plmn),
- (int)(ad->plmn_info.network_list[cnt].access_technology),
- SETTING_FONT_BLACK);
+ (int)(ad->plmn_info.network_list[cnt].type_of_plmn),
+ (int)(ad->plmn_info.network_list[cnt].access_technology));
//ASYNC API - TAPI_EVENT_NETWORK_SELECT_CNF
- tapi_ret = tel_select_network_manual(
- ad->plmn_info.network_list[cnt].plmn_id,
- &request_id);
+ SETTING_TRACE("Sending tel_select_network_manual..");
+ char plmn_id[MAX_COMMON_BUFFER_LEN] = {0, };
+ snprintf(plmn_id, MAX_COMMON_BUFFER_LEN, "%d", ad->plmn_info.network_list[cnt].plmn_id);
+
+ tapi_ret = tel_select_network_manual(ad->handle,
+ plmn_id, ad->plmn_info.network_list[cnt].access_technology,
+ setting_tapi_set_plmn_mode_cb, ad);
if(tapi_ret != TAPI_API_SUCCESS)
{
SETTING_TRACE_DEBUG("%s*** [ERR] "\
"tel_select_network_manual. "\
- "tapi_ret=%d ***%s", SETTING_FONT_RED,
+ "tapi_ret=%d ***%s", SETTING_FONT_RED,
tapi_ret, SETTING_FONT_BLACK);
- setting_network_popup_create(ad,
- _("IDS_ST_BODY_FAILED_TO_SELECT_NETWORK"),
- FALSE);
+ setting_create_popup_without_btn(ad, ad->win_get, NULL, _("IDS_ST_BODY_FAILED_TO_SELECT_NETWORK"), NULL, POPUP_INTERVAL, FALSE, FALSE);
+
return;
}
else
{
- ad->sel_net_plmn_id =
- ad->plmn_info.network_list[cnt].plmn_id;
- setting_begin_progress_genlist_item(list_item);
- ad->data_selected_network_item = list_item;
+ ad->network_ug_pop = setting_create_popup_without_btn(ad, ad->win_get, NULL,
+ _("IDS_COM_POP_PROCESSING"), NULL,
+ 0.0, TRUE, TRUE);
+ ad->sel_act = ad->plmn_info.network_list[cnt].access_technology;
+ FREE(ad->sel_network);
+ ad->sel_network = strdup(ad->plmn_info.network_list[cnt].network_name);
}
}
}
-void setting_network_select_network_chk_changed(void *data, Evas_Object *obj,
- void *event_info)
+void __switch_automatic_network(Setting_GenGroupItem_Data *list_item)
+{
+ SETTING_TRACE_BEGIN;
+ ret_if(!list_item || !list_item->userdata || !list_item->keyStr);
+ ret_if(0 != safeStrCmp(list_item->keyStr, "IDS_COM_BODY_AUTOMATIC"));
+ SettingNetworkUG *ad = list_item->userdata;
+ SETTING_TRACE("The value of toogle changes to be %d", list_item->chk_status);
+ if (list_item->chk_status) //set automatic
+ {
+ Elm_Object_Item *last_item = elm_genlist_last_item_get(ad->genlist_sel_network);
+ SETTING_TRACE("ad->data_auto_network_item->item:%p", ad->data_auto_network_item->item);
+ for (;;) {
+ last_item = elm_genlist_last_item_get(ad->genlist_sel_network);
+ SETTING_TRACE("last_item:%p", last_item);
+ if (last_item == ad->data_auto_network_item->item) {
+ break;
+ }
+ elm_object_item_del(last_item);
+ }
+
+ __register_network(list_item);
+ }
+ else //select a plmn
+ {
+ //__register_network(list_item);
+ int tapi_ret;
+ //searching list
+ tapi_ret = tel_search_network(ad->handle, setting_tapi_search_network_cb, ad); //ASYNC API - TAPI_EVENT_NETWORK_SEARCH_CNF
+ if(tapi_ret != TAPI_API_SUCCESS) { // error handling..
+ SETTING_TRACE_ERROR("%s*** [ERR] tel_search_network. tapi_ret=%d ***%s", SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
+ setting_create_popup_without_btn(ad, ad->win_get, NULL, _(STR_SETTING_OPERATION_FAILED), NULL, POPUP_INTERVAL, FALSE, FALSE);
+
+ // put error handler on the end of this function.
+ //rollback..
+ list_item->chk_status = TRUE;
+ elm_check_state_set(list_item->eo_check, list_item->chk_status);
+ return;
+ }
+ ad->b_searching_network = TRUE;
+ ad->data_search_network_item = setting_create_Gendial_field_1radio(
+ ad->genlist_sel_network,
+ &itc_1text_2icon_2,
+ NULL, NULL,
+ SWALLOW_Type_1RADIO_1SEARCH,
+ ad->chk_sel, -1, NULL, NULL);
+ if (ad->data_auto_network_item)
+ {
+ elm_genlist_item_item_class_update(ad->data_auto_network_item->item, &(itc_2text_1icon_7));
+ }
+ }
+}
+
+void setting_network_select_network_chk_changed(void *data, Evas_Object *obj, void *event_info)
{
SETTING_TRACE_BEGIN;
retm_if(data == NULL || obj == NULL, "Parameter is NULL");
- Setting_GenGroupItem_Data* list_item = (Setting_GenGroupItem_Data *)data;
-
- list_item->chk_status = elm_radio_value_get(obj);
- SETTING_TRACE("The value of radio changes to be %d",
- list_item->chk_status);
- setting_network_register_network(list_item);
+ Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data;
+ if (0 == safeStrCmp(list_item->keyStr, "IDS_COM_BODY_AUTOMATIC"))
+ {
+ list_item->chk_status = elm_check_state_get(obj);
+ __switch_automatic_network(list_item);
+ }
+ else //"IDS_COM_BODY_AUTOMATIC"
+ {
+ list_item->chk_status = elm_radio_value_get(obj);
+ SETTING_TRACE("The value of radio changes to be %d", list_item->chk_status);
+ __register_network(list_item);
+ }
+
}
-void setting_network_Gendial_select_plmn_cb(void *data, Evas_Object *obj,
- void *event_info)
+void setting_network_Gendial_select_plmn_cb(void *data, Evas_Object *obj, void *event_info)
{
SETTING_TRACE_BEGIN;
retm_if(data == NULL || event_info == NULL, "Parameter is NULL");
-
+
SettingNetworkUG *ad = (SettingNetworkUG*)data;
Elm_Object_Item *item = (Elm_Object_Item*)event_info;
elm_genlist_item_selected_set(item, 0);
- Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data*)elm_object_item_data_get(item);
+ Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data*)elm_object_item_data_get(item);
+
+ SETTING_TRACE("list_item->keyStr:%s", list_item->keyStr);
+ if (0 == safeStrCmp(list_item->keyStr, "IDS_COM_BODY_AUTOMATIC"))
+ {
+ list_item->chk_status = !elm_check_state_get(list_item->eo_check);
+ elm_check_state_set(list_item->eo_check, list_item->chk_status);
+ __switch_automatic_network(list_item);
+ return;
+ }
+ else
+ {
+ int old_chk_status = elm_radio_value_get(ad->chk_sel);
+ if (old_chk_status != list_item->chk_status)
+ {
+ SETTING_TRACE("The value of radio changes to be %d",
+ list_item->chk_status);
+ elm_radio_value_set(ad->chk_sel, list_item->chk_status);
+ __register_network(list_item);
+ }
+ }
+}
+void setting_network_update_sel_network(void *data)
+{
+ SETTING_TRACE_BEGIN;
+ SettingNetworkUG *ad = data;
+ SETTING_TRACE("ad->sel_net:%d", ad->sel_net);
+ SETTING_TRACE("ad->sel_network:%s", ad->sel_network);
+ SETTING_TRACE("sel_act = [%s(%d)]", setting_network_get_act_str(ad->sel_act),ad->sel_act);
- int old_chk_status = elm_radio_value_get(ad->chk_sel);
- if (old_chk_status != list_item->chk_status)
+ if (ad->data_auto_network_item) {
+ if (TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == ad->sel_net)
+ {
+ SETTING_TRACE_DEBUG("After set as Automatic, update "\
+ "ad->data_auto_network_item to be [%s]",
+ ad->sel_network);
+ ad->data_auto_network_item->sub_desc = (char *)g_strdup(_(ad->sel_network));
+ elm_object_item_data_set( ad->data_auto_network_item->item, ad->data_auto_network_item);
+ elm_genlist_item_update( ad->data_auto_network_item->item);
+ } else {
+ }
+ }
+
+ if (ad->data_sel_net)//it indicates TAPI is not responsed in time
{
- SETTING_TRACE("The value of radio changes to be %d",
- list_item->chk_status);
- elm_radio_value_set(ad->chk_sel, list_item->chk_status);
- setting_network_register_network(list_item);
+ char sel_network_desc[MAX_COMMON_BUFFER_LEN] = { 0, };
+ if (TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == ad->sel_net) {
+ snprintf(sel_network_desc, MAX_COMMON_BUFFER_LEN,
+ "%s. %s", _("IDS_COM_BODY_AUTOMATIC"), _(ad->sel_network));
+
+ } else {
+ snprintf(sel_network_desc, MAX_COMMON_BUFFER_LEN,
+ "%s. %s (%s)", _("IDS_COM_BODY_MANUAL"), _(ad->sel_network),
+ setting_network_get_act_str(ad->sel_act));
+ }
+
+ SETTING_TRACE("sel_network_desc:%s", sel_network_desc);
+
+ G_FREE(ad->data_sel_net->sub_desc);
+ ad->data_sel_net->sub_desc = (char *)g_strdup(_(sel_network_desc));
+
+ elm_object_item_data_set(ad->data_sel_net->item, ad->data_sel_net);
+ elm_genlist_item_update(ad->data_sel_net->item);
}
}
-/*****/
-UG_MODULE_API int setting_plugin_reset(bundle *data, void *priv)
+
+const char *setting_network_get_act_str(TelNetworkSystemType_t type)
+{
+ switch (type)
+ {
+ case TAPI_NETWORK_SYSTEM_NO_SRV: //0
+ return "NO SERVICE";
+ case TAPI_NETWORK_SYSTEM_GSM: //1
+ return "GSM";
+ case TAPI_NETWORK_SYSTEM_GPRS: //2
+ return "GPRS";
+ case TAPI_NETWORK_SYSTEM_EGPRS: //3
+ return "EGPRS";
+ case TAPI_NETWORK_SYSTEM_PCS1900: //4
+ return "PCS1900";
+ case TAPI_NETWORK_SYSTEM_UMTS: //5
+ return "UMTS";
+ case TAPI_NETWORK_SYSTEM_GSM_AND_UMTS:
+ return "GSM and UMTS";
+ case TAPI_NETWORK_SYSTEM_HSDPA:
+ return "HSDPA";
+ case TAPI_NETWORK_SYSTEM_IS95A:
+ return "IS95A";
+ case TAPI_NETWORK_SYSTEM_IS95B:
+ return "IS95B";
+ case TAPI_NETWORK_SYSTEM_CDMA_1X:
+ return "CDMA 1X";
+ case TAPI_NETWORK_SYSTEM_EVDO_REV_0:
+ return "EV-DO rev0";
+ case TAPI_NETWORK_SYSTEM_1X_EVDO_REV_0_HYBRID:
+ return "1X and EV-DO rev0";
+ case TAPI_NETWORK_SYSTEM_EVDO_REV_A:
+ return "EV-DO revA";
+ case TAPI_NETWORK_SYSTEM_1X_EVDO_REV_A_HYBRID:
+ return "1X and EV-DO revA";
+ case TAPI_NETWORK_SYSTEM_EVDV:
+ return "EV-DV";
+ default:
+ return "NO SERVICE";
+ }
+}
+
+
+void __default_tapi_response_cb(TapiHandle *handle, int result, void *data, void *user_data)
+{
+}
+
+
+UG_MODULE_API int setting_plugin_reset(service_h service, void *priv)
{
SETTING_TRACE_BEGIN;
int ret = 0;
ret += excuteCmd(SETTING_POSTINST_FILE, 1, "network");
#else
ret += vconf_set_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, TAPI_NETWORK_SELECTIONMODE_AUTOMATIC);
+ ret += vconf_set_int(VCONFKEY_SETAPPL_SELECT_OLD_NT_ACT, 0);
ret += vconf_set_int(VCONFKEY_SETAPPL_NETWORK_MODE_INT, TAPI_NETWORK_BAND_TYPE_ANY);
ret += vconf_set_bool(VCONFKEY_3G_ENABLE, TRUE);
+ ret += vconf_set_bool(VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL, TRUE);
#endif
if (net_register_client((net_event_cb_t)__network_evt_cb, NULL) != NET_ERR_NONE) {
SETTING_TRACE_ERROR("net_register_client. failed");
}
- int request_id = 0;
- int tapi_ret = tel_select_network_automatic(&request_id);
- if (tapi_ret != TAPI_API_SUCCESS) {
- ret++;
- SETTING_TRACE_ERROR("tel_select_network_automatic. tapi_ret=%d", tapi_ret);
- }
-
- request_id = 0;
- tapi_ret = tel_set_network_band(TAPI_NETWORK_BAND_MODE_ONLY,
- TAPI_NETWORK_BAND_TYPE_ANY,
- &request_id);
- if (tapi_ret != TAPI_API_SUCCESS) {
- ret++;
- SETTING_TRACE_ERROR("tel_set_network_band. tapi_ret=%d", tapi_ret);
+
+ TapiHandle *tapi_handle = tel_init(NULL);
+ if (tapi_handle) {
+ SETTING_TRACE_DEBUG("tel_init sucessfull");
+ //1.tel_select_network_automatic
+ int tapi_ret = tel_select_network_automatic(tapi_handle, __default_tapi_response_cb, NULL);
+ if (tapi_ret != TAPI_API_SUCCESS) {
+ ret++;
+ SETTING_TRACE_ERROR("tel_select_network_automatic. tapi_ret=%d", tapi_ret);
+ }
+
+ //2.tel_set_network_band
+ tapi_ret = tel_set_network_band(tapi_handle, TAPI_NETWORK_BAND_MODE_ONLY,
+ TAPI_NETWORK_BAND_TYPE_ANY,
+ __default_tapi_response_cb, NULL);
+ if (tapi_ret != TAPI_API_SUCCESS) {
+ ret++;
+ SETTING_TRACE_ERROR("tel_set_network_band. tapi_ret=%d", tapi_ret);
+ }
+
+ //3.don't need to receive
+ if (tel_deinit(tapi_handle) == TAPI_API_SUCCESS) {
+ SETTING_TRACE_DEBUG("tel_deinit sucessfull");
+ }
+
}
+
+
if (net_deregister_client() != NET_ERR_NONE) {
ret++;
SETTING_TRACE_ERROR("net_deregister_client failed");
}
-
+
+ //Reset connections info..
+ ret += excuteCmd("/usr/bin/dbus-send", 1, NET_CON_RESET_DBUS_PARA);
+
SETTING_TRACE_END;
return ret;
}