summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadoslaw Czerski <r.czerski@samsung.com>2016-03-30 15:03:40 +0200
committerRadoslaw Czerski <r.czerski@samsung.com>2016-03-30 15:03:40 +0200
commitb8a3557e7669ca5f53d558a1e42134f7601d5cdc (patch)
tree0d8274f351c21b8546b7580e05a1203530a4cff4
parent6d1941cb2064be13d3e29451210ebf5c8c1ed653 (diff)
downloadindicator-win-b8a3557e7669ca5f53d558a1e42134f7601d5cdc.tar.gz
indicator-win-b8a3557e7669ca5f53d558a1e42134f7601d5cdc.tar.bz2
indicator-win-b8a3557e7669ca5f53d558a1e42134f7601d5cdc.zip
Connection and WiFi fixes.
Util wrappers used to de/initialize and registering callbacks. Change-Id: Id70805efce6d2163863aca8bc3e642282462bef7 Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
-rw-r--r--src/modules/connection/connection.c43
-rw-r--r--src/modules/connection/wifi.c15
2 files changed, 40 insertions, 18 deletions
diff --git a/src/modules/connection/connection.c b/src/modules/connection/connection.c
index 2f6bb11..fa1b6ae 100644
--- a/src/modules/connection/connection.c
+++ b/src/modules/connection/connection.c
@@ -48,7 +48,6 @@ static int isBTIconShowing = 0;
static telephony_handle_list_s tel_list;
static int updated_while_lcd_off = 0;
static int prevIndex = -1;
-static bool mobile_data_status = false;
static event_handler_h event;
@@ -299,7 +298,10 @@ static void on_noti(telephony_h handle, void *user_data)
hide_image_icon();
}
}
- if (mobile_data_status)
+
+ bool is_3G = false;
+ system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, &is_3G);
+ if (is_3G)
_view_icon_update(handle, user_data);
}
@@ -319,7 +321,7 @@ static void _update_status_ri(runtime_info_key_e key, void *user_data)
on_noti(tel_list.handle[0], user_data);
}
-static void _wifi_status_changed_cb(wifi_connection_state_e state, wifi_ap_h ap, void *user_data)
+static void _wifi_status_changed_cb(wifi_device_state_e state, void *user_data)
{
int status = 0;
int ret = 0;
@@ -335,6 +337,12 @@ static void _wifi_status_changed_cb(wifi_connection_state_e state, wifi_ap_h ap,
}
}
+static void _wifi_connection_status_changed_cb(wifi_connection_state_e state, wifi_ap_h ap, void *user_data)
+{
+ /*First parameter of below function is not used*/
+ _wifi_status_changed_cb(0, user_data);
+}
+
static void _flight_mode(system_settings_key_e key, void *user_data)
{
on_noti(tel_list.handle[0], user_data);
@@ -371,9 +379,23 @@ static int __init_tel(void *data)
}
}
- ret = util_wifi_set_connection_state_changed_cb(_wifi_status_changed_cb, data);
+ ret = util_wifi_initialize();
+ if (ret != 0) {
+ _E("util_wifi_initialize failed[%d]:%s", ret, get_error_message(ret));
+ __deinit_tel();
+ return FAIL;
+ }
+
+ ret = util_wifi_set_device_state_changed_cb(_wifi_status_changed_cb, data);
if (ret != 0) {
- _E("util_wifi_set_connection_state_changed_cb");
+ _E("util_wifi_set_device_state_changed_cb failed");
+ __deinit_tel();
+ return FAIL;
+ }
+
+ ret = util_wifi_set_connection_state_changed_cb(_wifi_connection_status_changed_cb, data);
+ if (ret != 0) {
+ _E("util_wifi_set_connection_state_changed_cb failed");
__deinit_tel();
return FAIL;
}
@@ -407,13 +429,15 @@ static void __deinit_tel()
_D("__deinit_tel");
util_system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, _flight_mode);
- util_wifi_unset_connection_state_changed_cb(_wifi_status_changed_cb);
+ util_wifi_unset_device_state_changed_cb(_wifi_status_changed_cb);
util_runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_BLUETOOTH_TETHERING_ENABLED, _update_status_ri);
if (tel_list.count)
telephony_deinit(&tel_list);
tel_list.count = 0;
+ util_wifi_deinitialize();
+
hide_image_icon();
}
@@ -437,13 +461,10 @@ static void data_event_cb(const char *event_name, bundle *event_data, void *user
}
_D("bundle value:%s", value);
- if (!strcmp(value, "off")) {
- mobile_data_status = false;
+ if (!strcmp(value, "off"))
hide_image_icon();
- } else {
- mobile_data_status = true;
+ else
on_noti(tel_list.handle[0], user_data);
- }
}
static int register_conn_module(void *data)
diff --git a/src/modules/connection/wifi.c b/src/modules/connection/wifi.c
index f6602b2..9a22963 100644
--- a/src/modules/connection/wifi.c
+++ b/src/modules/connection/wifi.c
@@ -247,12 +247,12 @@ static int register_wifi_module(void *data)
set_app_state(data);
- int ret = wifi_initialize();
- retvm_if(ret != WIFI_ERROR_NONE, FAIL, "wifi_initialize failed : %s", get_error_message(ret));
+ int ret = util_wifi_initialize();
+ retvm_if(ret != WIFI_ERROR_NONE, FAIL, "util_wifi_initialize failed : %s", get_error_message(ret));
- ret = wifi_set_device_state_changed_cb(_wifi_device_state_changed, data);
+ ret = util_wifi_set_device_state_changed_cb(_wifi_device_state_changed, data);
if (ret != WIFI_ERROR_NONE) {
- _E("wifi_set_device_state_changed_cb failed: %s", get_error_message(ret));
+ _E("util_wifi_set_device_state_changed_cb failed: %s", get_error_message(ret));
unregister_wifi_module();
return FAIL;
}
@@ -285,14 +285,15 @@ static int register_wifi_module(void *data)
static int unregister_wifi_module(void)
{
+ util_wifi_unset_device_state_changed_cb(_wifi_device_state_changed);
util_wifi_unset_connection_state_changed_cb(_wifi_connection_state_changed);
- wifi_unset_device_state_changed_cb();
wifi_unset_rssi_level_changed_cb();
vconf_ignore_key_changed(VCONFKEY_WIFI_TRANSFER_STATE, _wifi_changed_cb);
- int ret = wifi_deinitialize();
+
+ int ret = util_wifi_deinitialize();
if (ret != WIFI_ERROR_NONE) {
- _E("wifi_deinitialize failed : %s", get_error_message(ret));
+ _E("util_wifi_deinitialize failed : %s", get_error_message(ret));
}
return OK;