From: hyunuktak Date: Fri, 1 Apr 2016 07:53:39 +0000 (+0900) Subject: Apply coding rule X-Git-Tag: accepted/tizen/common/20160407.133037~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a8a53f40cd43f1e5b0e73d784f55e9ad2238be4;p=platform%2Fcore%2Fconnectivity%2Fnet-config.git Apply coding rule Change-Id: Ia87aafc5f39f467006d4cd2de1eb084efc27a2b9 Signed-off-by: hyunuktak --- diff --git a/packaging/net-config.spec b/packaging/net-config.spec index a829b49..a9298fc 100755 --- a/packaging/net-config.spec +++ b/packaging/net-config.spec @@ -1,6 +1,6 @@ Name: net-config Summary: TIZEN Network Configuration service -Version: 1.1.63 +Version: 1.1.64 Release: 2 Group: System/Network License: Apache-2.0 diff --git a/src/dbus/netdbus.c b/src/dbus/netdbus.c index 33fa8cf..e9f6dfe 100755 --- a/src/dbus/netdbus.c +++ b/src/dbus/netdbus.c @@ -280,9 +280,8 @@ static void _got_name_cb(GDBusConnection *conn, const gchar *name, { INFO("Got gdbus name: [%s] and gdbus connection: [%p]", name, conn); - if (g_callback != NULL) { + if (g_callback != NULL) g_callback(); - } } static void _lost_name_cb(GDBusConnection *conn, const gchar *name, diff --git a/src/main.c b/src/main.c index 77288a0..a4d21d6 100755 --- a/src/main.c +++ b/src/main.c @@ -96,7 +96,7 @@ int main(int argc, char *argv[]) ERR("Failed to create cert directory"); } -#if !GLIB_CHECK_VERSION(2,36,0) +#if !GLIB_CHECK_VERSION(2, 36, 0) g_type_init(); #endif @@ -130,7 +130,7 @@ int main(int argc, char *argv[]) if (!system_info_get_platform_bool(ETHERNET_FEATURE, ðernet_feature_supported)) { if (ethernet_feature_supported == TRUE) { - //Register the callback to check the ethernet Plug-in /Plug-out Status + /* Register the callback to check the ethernet Plug-in /Plug-out Status */ check_ethernet_monitor_timer = g_timeout_add(ETH_POLLING_TIME, __net_ethernet_cable_status_polling_callback, &check_ethernet_monitor_timer); @@ -153,7 +153,7 @@ int main(int argc, char *argv[]) /*remove the Timer*/ - if(check_ethernet_monitor_timer >0) + if (check_ethernet_monitor_timer > 0) g_source_remove(check_ethernet_monitor_timer); wifi_state_notifier_cleanup(); diff --git a/src/neterror.c b/src/neterror.c index 7afb7e6..0e3113d 100755 --- a/src/neterror.c +++ b/src/neterror.c @@ -165,7 +165,7 @@ void netconfig_error_dbus_method_return(GDBusMethodInvocation *context, netconfi ERR("dbus method return error"); msg = g_strdup_printf("%s.%s", NETCONFIG_ERROR_INTERFACE, message); - g_dbus_method_invocation_return_error(context, netconfig_error_quark(), error,"%s", msg); + g_dbus_method_invocation_return_error(context, netconfig_error_quark(), error, "%s", msg); g_free(msg); } diff --git a/src/network-clock.c b/src/network-clock.c index 2ec6992..0feddfa 100755 --- a/src/network-clock.c +++ b/src/network-clock.c @@ -59,10 +59,10 @@ static void __netconfig_clock_set_timeserver(const char *server) GVariant *params = NULL; GVariantBuilder *builder; - builder = g_variant_builder_new(G_VARIANT_TYPE ("as")); + builder = g_variant_builder_new(G_VARIANT_TYPE("as")); g_variant_builder_add(builder, "s", server); - params = g_variant_new("(sv)",param0, g_variant_builder_end(builder)); + params = g_variant_new("(sv)", param0, g_variant_builder_end(builder)); g_variant_builder_unref(builder); reply = netconfig_invoke_dbus_method(CONNMAN_SERVICE, @@ -117,11 +117,10 @@ static void __automatic_time_update_changed_cb(keynode_t *node, void *user_data) gboolean automatic_time_update = FALSE; wifi_service_state_e wifi_state = NETCONFIG_WIFI_UNKNOWN; - if (node != NULL) { + if (node != NULL) automatic_time_update = vconf_keynode_get_bool(node); - } else { + else vconf_get_bool(VCONFKEY_SETAPPL_STATE_AUTOMATIC_TIME_UPDATE_BOOL, &automatic_time_update); - } if (automatic_time_update == FALSE) { INFO("Automatic time update is changed to 'FALSE'"); diff --git a/src/network-monitor.c b/src/network-monitor.c index 84a5afe..0e291c4 100755 --- a/src/network-monitor.c +++ b/src/network-monitor.c @@ -67,7 +67,7 @@ int netconfig_ethernet_cable_plugin_status_check() memset(&ifr, 0, sizeof(ifr)); g_strlcpy(ifr.ifr_name, "eth0", IFNAMSIZ); - if (ioctl(soketfd, SIOCGMIIPHY, &ifr) < 0){ + if (ioctl(soketfd, SIOCGMIIPHY, &ifr) < 0) { error = -errno; strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); ERR("SIOCGMIIPHY on eth0 failed : [%d] [%s]", errno, error_buf); @@ -77,21 +77,21 @@ int netconfig_ethernet_cable_plugin_status_check() mdata = (struct _stMData *)&ifr.ifr_data; mdata->reg_num = ETH_REG_BMSR; - if (ioctl(soketfd, SIOCGMIIREG, &ifr) < 0){ + if (ioctl(soketfd, SIOCGMIIREG, &ifr) < 0) { error = -errno; strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); - ERR("SIOCGMIIREG on %s failed , [%d] [%s] ", ifr.ifr_name,errno,error_buf); + ERR("SIOCGMIIREG on %s failed , [%d] [%s] ", ifr.ifr_name, errno, error_buf); goto done; } ret = mdata->val_out; ret = ret & BMSR_LINK_VALID; - if(ret == 4) { - if(!g_chk_eth_send_notification) + if (ret == 4) { + if (!g_chk_eth_send_notification) netconfig_network_notify_ethernet_cable_state("ATTACHED"); g_chk_eth_send_notification = TRUE; } else if (ret == 0) { - if(g_chk_eth_send_notification) + if (g_chk_eth_send_notification) netconfig_network_notify_ethernet_cable_state("DETACHED"); g_chk_eth_send_notification = FALSE; } @@ -104,17 +104,17 @@ done: int netconfig_get_ethernet_cable_state(int *status) { int error = 0; - if(status == NULL) { + if (status == NULL) { DBG("Error !!! Invalid Parameter\n"); return -1; } - if((error = netconfig_ethernet_cable_plugin_status_check()) != 0) { + if ((error = netconfig_ethernet_cable_plugin_status_check()) != 0) { DBG("Error !!! Failed to check ethernet cable status [%d]\n", error); return -1; } - if(g_chk_eth_send_notification == TRUE) + if (g_chk_eth_send_notification == TRUE) *status = 1; /* Ethernet cable Attached */ else *status = 0; /* Ethernet cable Deattached */ diff --git a/src/network-state.c b/src/network-state.c index f36607f..5180cd2 100755 --- a/src/network-state.c +++ b/src/network-state.c @@ -107,9 +107,8 @@ static gboolean __netconfig_is_connected(GVariantIter *array) const gchar *value = NULL; while (g_variant_iter_loop(array, "{sv}", &key, &variant)) { - if (g_strcmp0(key, "State") != 0) { + if (g_strcmp0(key, "State") != 0) continue; - } if (g_variant_is_of_type(variant, G_VARIANT_TYPE_STRING)) { value = g_variant_get_string(variant, NULL); @@ -143,13 +142,11 @@ static char *__netconfig_get_default_profile(void) g_variant_get(message, "(a(oa{sv}))", &iter); while (g_variant_iter_loop(iter, "(oa{sv})", &object_path, &next)) { - if (object_path == NULL) { + if (object_path == NULL) continue; - } - if(netconfig_is_cellular_profile(object_path) && !netconfig_is_cellular_internet_profile(object_path)){ + if (netconfig_is_cellular_profile(object_path) && !netconfig_is_cellular_internet_profile(object_path)) continue; - } if (__netconfig_is_connected(next) == TRUE) { default_profile = g_strdup(object_path); @@ -263,10 +260,10 @@ done: g_variant_unref(message); if (iter) - g_variant_iter_free (iter); + g_variant_iter_free(iter); if (iter1) - g_variant_iter_free (iter1); + g_variant_iter_free(iter1); return; } @@ -441,8 +438,7 @@ static void __netconfig_update_default_connection_info(void) /* Disable clatd if it is in running state */ netconfig_clatd_disable(); - } - else if (profile != NULL) { + } else if (profile != NULL) { char *old_ip = vconf_get_str(VCONFKEY_NETWORK_IP); char *old_proxy = vconf_get_str(VCONFKEY_NETWORK_PROXY); @@ -452,10 +448,9 @@ static void __netconfig_update_default_connection_info(void) netconfig_set_system_event(SYS_EVENT_NETWORK_STATUS, EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_WIFI); - } - else if (netconfig_is_cellular_profile(profile) ){ + } else if (netconfig_is_cellular_profile(profile)) { - if( !netconfig_is_cellular_internet_profile(profile)){ + if (!netconfig_is_cellular_internet_profile(profile)) { DBG("connection is not a internet profile - stop to update the cellular state"); return; } @@ -466,20 +461,17 @@ static void __netconfig_update_default_connection_info(void) EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_CELLULAR); /* Enable clatd if IPv6 is set and no IPv4 address */ - if (!ip_addr && ip_addr6 ) + if (!ip_addr && ip_addr6) netconfig_clatd_enable(); - } - else if (netconfig_is_ethernet_profile(profile) == TRUE){ + } else if (netconfig_is_ethernet_profile(profile) == TRUE) { netconfig_set_vconf_int(VCONFKEY_NETWORK_STATUS, VCONFKEY_NETWORK_ETHERNET); netconfig_set_system_event(SYS_EVENT_NETWORK_STATUS, EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_ETHERNET); - } - else if (netconfig_is_bluetooth_profile(profile) == TRUE){ + } else if (netconfig_is_bluetooth_profile(profile) == TRUE) { netconfig_set_vconf_int(VCONFKEY_NETWORK_STATUS, VCONFKEY_NETWORK_BLUETOOTH); netconfig_set_system_event(SYS_EVENT_NETWORK_STATUS, EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_BT); - } - else{ + } else{ netconfig_set_vconf_int(VCONFKEY_NETWORK_STATUS, VCONFKEY_NETWORK_OFF); netconfig_set_system_event(SYS_EVENT_NETWORK_STATUS, EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_DISCONNECTED); @@ -534,9 +526,8 @@ static gboolean __netconfig_is_tech_state_connected(void) g_variant_get(message, "(a(oa{sv}))", &iter); while (g_variant_iter_loop(iter, "(oa{sv})", &path, &next)) { - if (path == NULL) { + if (path == NULL) continue; - } while (g_variant_iter_loop(next, "{sv}", &key, &variant)) { gboolean data; @@ -580,9 +571,8 @@ static void __netconfig_update_if_service_connected(void) g_variant_get(message, "(a(oa{sv}))", &iter); while (g_variant_iter_loop(iter, "(oa{sv})", &path, &next)) { - if (path == NULL) { + if (path == NULL) continue; - } if (g_str_has_prefix(path, CONNMAN_WIFI_SERVICE_PROFILE_PREFIX) == TRUE) { @@ -644,7 +634,7 @@ static void __netconfig_network_notify_result(const char *sig_name, const char * return; } - builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}")); + builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); g_variant_builder_add(builder, "{sv}", prop_key, g_variant_new_string(key)); params = g_variant_new("(@a{sv})", g_variant_builder_end(builder)); @@ -799,17 +789,17 @@ void netconfig_update_default_profile(const char *profile) } } - //default profile is NULL and new connected profile is NULL - if( !profile ){ + /* default profile is NULL and new connected profile is NULL */ + if (!profile) { profile = __netconfig_get_default_profile(); if (profile && netconfig_is_cellular_profile(profile) && - !netconfig_is_cellular_internet_profile(profile)){ + !netconfig_is_cellular_internet_profile(profile)) { DBG("not a default cellular profile"); profile = NULL; } - if(!profile){ + if (!profile) { __netconfig_update_default_connection_info(); return; } @@ -870,7 +860,7 @@ char *netconfig_get_ifname(const char *profile) /* Check Ethernet Cable Plug-in /Plug-out Status */ void netconfig_network_notify_ethernet_cable_state(const char *key) { - __netconfig_network_notify_result("EthernetCableState", key); + __netconfig_network_notify_result("EthernetCableState", key); } static gboolean handle_add_route( @@ -891,48 +881,48 @@ static gboolean handle_add_route( DBG("ip_addr(%s), netmask(%s), interface(%s), gateway(%s)", ip_addr, netmask, interface, gateway); - switch(address_family) { - case AF_INET: - if (ip_addr == NULL || netmask == NULL || interface == NULL) { - ERR("Invalid parameter"); - netconfig_error_invalid_parameter(context); - return FALSE; - } + switch (address_family) { + case AF_INET: + if (ip_addr == NULL || netmask == NULL || interface == NULL) { + ERR("Invalid parameter"); + netconfig_error_invalid_parameter(context); + return FALSE; + } - if (netconfig_execute_file(path, args, envs) < 0) { - DBG("Failed to add a new route"); - netconfig_error_permission_denied(context); - return FALSE; - } + if (netconfig_execute_file(path, args, envs) < 0) { + DBG("Failed to add a new route"); + netconfig_error_permission_denied(context); + return FALSE; + } - break; - case AF_INET6: - if (ip_addr == NULL || interface == NULL || gateway == NULL) { - ERR("Invalid parameter"); - netconfig_error_invalid_parameter(context); - return FALSE; - } + break; + case AF_INET6: + if (ip_addr == NULL || interface == NULL || gateway == NULL) { + ERR("Invalid parameter"); + netconfig_error_invalid_parameter(context); + return FALSE; + } - buf = ip_addr; - ch = strchr(buf, '/'); - pos = ch - buf + 1; - if (ch) { - prefix_len = atoi(ch + 1); - ip_addr[pos-1] = '\0'; - } else { - prefix_len = 128; - } + buf = ip_addr; + ch = strchr(buf, '/'); + pos = ch - buf + 1; + if (ch) { + prefix_len = atoi(ch + 1); + ip_addr[pos-1] = '\0'; + } else { + prefix_len = 128; + } - if (netconfig_add_route_ipv6(ip_addr, interface, gateway, prefix_len) < 0) { - DBG("Failed to add a new route"); - netconfig_error_permission_denied(context); - return FALSE; - } - break; - default: - DBG("Unknown Address Family"); - netconfig_error_invalid_parameter(context); + if (netconfig_add_route_ipv6(ip_addr, interface, gateway, prefix_len) < 0) { + DBG("Failed to add a new route"); + netconfig_error_permission_denied(context); return FALSE; + } + break; + default: + DBG("Unknown Address Family"); + netconfig_error_invalid_parameter(context); + return FALSE; } DBG("Successfully added a new route"); @@ -958,46 +948,46 @@ static gboolean handle_remove_route( DBG("ip_addr(%s), netmask(%s), interface(%s), gateway(%s)", ip_addr, netmask, interface, gateway); - switch(address_family) { - case AF_INET: - if (ip_addr == NULL || netmask == NULL || interface == NULL) { - DBG("Invalid parameter!"); - netconfig_error_invalid_parameter(context); - return FALSE; - } - if (netconfig_execute_file(path, args, envs) < 0) { - DBG("Failed to remove the route"); - netconfig_error_permission_denied(context); - return FALSE; - } - break; - case AF_INET6: - if (ip_addr == NULL || interface == NULL || gateway == NULL) { - DBG("Invalid parameter!"); - netconfig_error_invalid_parameter(context); - return FALSE; - } + switch (address_family) { + case AF_INET: + if (ip_addr == NULL || netmask == NULL || interface == NULL) { + DBG("Invalid parameter!"); + netconfig_error_invalid_parameter(context); + return FALSE; + } + if (netconfig_execute_file(path, args, envs) < 0) { + DBG("Failed to remove the route"); + netconfig_error_permission_denied(context); + return FALSE; + } + break; + case AF_INET6: + if (ip_addr == NULL || interface == NULL || gateway == NULL) { + DBG("Invalid parameter!"); + netconfig_error_invalid_parameter(context); + return FALSE; + } - buf = ip_addr; - ch = strchr(buf, '/'); - pos = ch - buf + 1; - if (ch) { - prefix_len = atoi(ch + 1); - ip_addr[pos-1] = '\0'; - } else { - prefix_len = 128; - } + buf = ip_addr; + ch = strchr(buf, '/'); + pos = ch - buf + 1; + if (ch) { + prefix_len = atoi(ch + 1); + ip_addr[pos-1] = '\0'; + } else { + prefix_len = 128; + } - if (netconfig_del_route_ipv6(ip_addr, interface, gateway, prefix_len) < 0) { - DBG("Failed to remove the route"); - netconfig_error_permission_denied(context); - return FALSE; - } - break; - default: - DBG("Unknown Address Family"); - netconfig_error_invalid_parameter(context); + if (netconfig_del_route_ipv6(ip_addr, interface, gateway, prefix_len) < 0) { + DBG("Failed to remove the route"); + netconfig_error_permission_denied(context); return FALSE; + } + break; + default: + DBG("Unknown Address Family"); + netconfig_error_invalid_parameter(context); + return FALSE; } DBG("Successfully removed the route"); @@ -1027,7 +1017,7 @@ gboolean handle_ethernet_cable_state(Network *object, int state = 0; ret = netconfig_get_ethernet_cable_state(&state); - if(ret != 0) { + if (ret != 0) { DBG("Failed to get ethernet cable state"); netconfig_error_fail_ethernet_cable_state(context); return FALSE; diff --git a/src/signal-handler.c b/src/signal-handler.c index 4c7ec98..cf4ceda 100755 --- a/src/signal-handler.c +++ b/src/signal-handler.c @@ -112,19 +112,17 @@ static void _technology_signal_cb(GDBusConnection *conn, if (g_strcmp0(key, "Powered") == 0) { /* Power state */ value = g_variant_get_boolean(var); - if (value == TRUE) { + if (value == TRUE) wifi_state_update_power_state(TRUE); - } else { + else wifi_state_update_power_state(FALSE); - } } else if (g_strcmp0(key, "Connected") == 0) { /* Connection state */ value = g_variant_get_boolean(var); - if (value == TRUE) { + if (value == TRUE) wifi_state_set_tech_state(NETCONFIG_WIFI_TECH_CONNECTED); - } else { + else wifi_state_set_tech_state(NETCONFIG_WIFI_TECH_POWERED); - } } else if (g_strcmp0(key, "Tethering") == 0) { /* Tethering state */ wifi_state_set_tech_state(NETCONFIG_WIFI_TECH_TETHERED); @@ -153,9 +151,8 @@ static void _service_signal_cb(GDBusConnection *conn, if (sigvalue == NULL) goto done; - if (g_strcmp0(sig, CONNMAN_SIGNAL_PROPERTY_CHANGED) != 0) { + if (g_strcmp0(sig, CONNMAN_SIGNAL_PROPERTY_CHANGED) != 0) goto done; - } if (g_strcmp0(sigvalue, "State") == 0) { g_variant_get(variant, "s", &property); @@ -221,12 +218,11 @@ static void _service_signal_cb(GDBusConnection *conn, } else { if (g_strcmp0(property, "ready") == 0 || g_strcmp0(property, "online") == 0) { if (netconfig_get_default_profile() == NULL) { - if(!netconfig_is_cellular_profile(path)) { + if (!netconfig_is_cellular_profile(path)) netconfig_update_default_profile(path); - } else { - if (netconfig_is_cellular_internet_profile(path)) { + else { + if (netconfig_is_cellular_internet_profile(path)) netconfig_update_default_profile(path); - } } } @@ -244,7 +240,7 @@ static void _service_signal_cb(GDBusConnection *conn, goto done; netconfig_update_default_profile(NULL); - } else if (g_strcmp0(property, "association") == 0 || g_strcmp0(property, "configuration") == 0) { + } else if (g_strcmp0(property, "association") == 0 || g_strcmp0(property, "configuration") == 0) { if (netconfig_get_default_profile() == NULL) goto done; @@ -376,7 +372,7 @@ static void _services_changed_cb(GDBusConnection *conn, const gchar *name, break; } - if(!is_cell_prof) + if (!is_cell_prof) netconfig_update_default_profile( service_path); else if (is_cell_internet_prof) { diff --git a/src/utils/emulator.c b/src/utils/emulator.c index 844cda0..f8629d3 100755 --- a/src/utils/emulator.c +++ b/src/utils/emulator.c @@ -95,7 +95,7 @@ static void __netconfig_emulator_set_proxy(void) proxy = netconfig_get_env(HTTP_PROXY); DBG("Get system proxy: %s", proxy); - if (proxy != NULL){ + if (proxy != NULL) { vconf_set_str(VCONFKEY_NETWORK_PROXY, proxy); free(proxy); } diff --git a/src/utils/network-accessibility.c b/src/utils/network-accessibility.c index be165c7..7690ecc 100755 --- a/src/utils/network-accessibility.c +++ b/src/utils/network-accessibility.c @@ -63,14 +63,14 @@ struct internet_params { gboolean request_started; }; -const static char* url_list[] = { +static const char* url_list[] = { "www.google.com", "www.msn.com", "www.yahoo.com", "m.google.com", "www.amazon.com", "www.youtube.com" - }; +}; #define URL_LIST_NUM 6 @@ -145,7 +145,7 @@ static gboolean __netconfig_data_activity_timeout(gpointer data) { DBG("Timer timed-out"); enum netconfig_internet_check_state prev_state = (enum netconfig_internet_check_state)GPOINTER_TO_INT(data); - INFO("Prev_state: state=%d (1:dns check / 2:packet check)",prev_state); + INFO("Prev_state: state=%d (1:dns check / 2:packet check)", prev_state); if (net_params == NULL) return FALSE; @@ -369,7 +369,7 @@ static void __netconfig_connect_sockets(void) __internet_check_state(INTERNET_CHECK_STATE_PACKET_CHECK); return; - cleanup: +cleanup: __internet_check_state(INTERNET_CHECK_STATE_NONE); } @@ -390,9 +390,8 @@ static void __netconfig_obtain_host_ip_addr_cb(GObject *src, list = g_resolver_lookup_by_name_finish((GResolver *)src, res, &error); if (error != NULL) { - if (error->code == G_IO_ERROR_CANCELLED) { + if (error->code == G_IO_ERROR_CANCELLED) ERR("G_IO_ERROR_CANCELLED is called[%s]", error->message); - } g_error_free(error); } @@ -522,9 +521,8 @@ void netconfig_check_internet_accessibility(void) is_internet_available = FALSE; /* If the host IP is resolved, directly go for connecting to sockets*/ - if (__netconfig_obtain_host_ip_addr() == TRUE) { + if (__netconfig_obtain_host_ip_addr() == TRUE) __netconfig_connect_sockets(); - } } void netconfig_stop_internet_check(void) diff --git a/src/utils/util.c b/src/utils/util.c index 1e3e9a2..612e7d1 100755 --- a/src/utils/util.c +++ b/src/utils/util.c @@ -860,47 +860,46 @@ void netconfig_set_system_event(const char * sys_evt, const char * evt_key, cons #if defined TIZEN_WEARABLE int wc_launch_syspopup(netconfig_wcpopup_type_e type) { - int ret; - bundle* b; - char *ssid = NULL; - - b = bundle_create(); - if (!b) { - ERR("Failed to create bundle"); - return -1; - } - - switch (type) { - case WC_POPUP_TYPE_SESSION_OVERLAPPED: - bundle_add(b, "event-type", "wps-session-overlapped"); - break; - case WC_POPUP_TYPE_WIFI_CONNECTED: - ssid = vconf_get_str(VCONFKEY_WIFI_CONNECTED_AP_NAME); - if (ssid == NULL) { - ERR("Failed to get connected ap ssid"); - ssid = g_strdup(" "); - } - bundle_add(b, "event-type", "wifi-connected"); - bundle_add(b, "ssid", ssid); - if (ssid) - g_free(ssid); - break; - case WC_POPUP_TYPE_WIFI_RESTRICT: - bundle_add(b, "event-type", "wifi-restrict"); - break; - default: - ERR("Popup is not supported[%d]", type); - bundle_free(b); - return -1; - } + int ret; + bundle* b; + char *ssid = NULL; - ret = syspopup_launch("wc-syspopup", b); - if (ret < 0) - ERR("Failed to launch syspopup"); + b = bundle_create(); + if (!b) { + ERR("Failed to create bundle"); + return -1; + } + + switch (type) { + case WC_POPUP_TYPE_SESSION_OVERLAPPED: + bundle_add(b, "event-type", "wps-session-overlapped"); + break; + case WC_POPUP_TYPE_WIFI_CONNECTED: + ssid = vconf_get_str(VCONFKEY_WIFI_CONNECTED_AP_NAME); + if (ssid == NULL) { + ERR("Failed to get connected ap ssid"); + ssid = g_strdup(" "); + } + bundle_add(b, "event-type", "wifi-connected"); + bundle_add(b, "ssid", ssid); + if (ssid) + g_free(ssid); + break; + case WC_POPUP_TYPE_WIFI_RESTRICT: + bundle_add(b, "event-type", "wifi-restrict"); + break; + default: + ERR("Popup is not supported[%d]", type); + bundle_free(b); + return -1; + } - bundle_free(b); + ret = syspopup_launch("wc-syspopup", b); + if (ret < 0) + ERR("Failed to launch syspopup"); - return ret; + bundle_free(b); + return ret; } int wc_launch_popup(netconfig_wcpopup_type_e type) @@ -964,7 +963,7 @@ char* netconfig_get_env(const char *key) { FILE *fp; char buf[256], *entry = NULL, *value = NULL, *last; - int len=0; + int len = 0; if (!key) return NULL; @@ -979,12 +978,11 @@ char* netconfig_get_env(const char *key) if (entry) { if (strstr(entry, key)) { entry = strtok_r(NULL, "\n", &last); - if(entry){ + if (entry) { len = strlen(entry); value = (char*)malloc(len+1); g_strlcpy(value, entry, len+1); - } - else{ + } else { value = (char*)malloc(sizeof(char)); g_strlcpy(value, "\n", sizeof(char)); } @@ -1009,7 +1007,7 @@ void netconfig_set_mac_address_from_file(void) ERR("Fail to open %s", MAC_INFO_FILEPATH); return; } - if (fgets(mac_str, sizeof(mac_str), file) == NULL ) { + if (fgets(mac_str, sizeof(mac_str), file) == NULL) { ERR("Fail to read mac address"); fclose(file); return; diff --git a/src/wifi-agent.c b/src/wifi-agent.c index bb6facc..3c7c87b 100755 --- a/src/wifi-agent.c +++ b/src/wifi-agent.c @@ -102,18 +102,18 @@ int connman_register_agent(void) &error); if (reply == NULL) { - if (error != NULL) { - if (g_strcmp0(error->message, - "GDBus.Error:net.connman.Error.AlreadyExists: Already exists") == 0) { + if (error != NULL) { + if (g_strcmp0(error->message, + "GDBus.Error:net.connman.Error.AlreadyExists: Already exists") == 0) { break; - } else { - ERR("Fail to register agent [%d: %s]", - error->code, error->message); - } - - g_error_free(error); - } else - ERR("Fail to register agent"); + } else { + ERR("Fail to register agent [%d: %s]", + error->code, error->message); + } + + g_error_free(error); + } else + ERR("Fail to register agent"); } else g_variant_unref(reply); @@ -243,9 +243,8 @@ gboolean handle_set_field(NetConnmanAgent *connman_agent, GByteArray *array = g_byte_array_new(); g_variant_get(value, "ay", &iter1); - while(g_variant_iter_loop(iter1, "y", &char_value)) { + while (g_variant_iter_loop(iter1, "y", &char_value)) g_byte_array_append(array, &char_value, 1); - } g_variant_iter_free(iter1); if (array != NULL && (array->len > 0)) { agent.ssid = g_byte_array_sized_new(array->len); @@ -271,7 +270,7 @@ gboolean handle_set_field(NetConnmanAgent *connman_agent, service, CONNMAN_SERVICE_INTERFACE, "Connect", NULL, __netconfig_wifi_connect_reply); if (reply == TRUE) { - g_dbus_method_invocation_return_value (context, NULL); + g_dbus_method_invocation_return_value(context, NULL); } else { error = g_error_new(G_DBUS_ERROR, G_DBUS_ERROR_AUTH_FAILED, @@ -317,7 +316,7 @@ gboolean handle_request_input(NetConnmanAgent *connman_agent, DBG("Agent fields requested for service: %s", service); - builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}")); + builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); g_variant_get(fields, "a{sv}", &iter); while (g_variant_iter_loop(iter, "{sv}", &field, &r_value)) { @@ -332,7 +331,7 @@ gboolean handle_request_input(NetConnmanAgent *connman_agent, } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_WPS) == 0 && (agent.wps_pbc == TRUE || agent.wps_pin != NULL)) { if (agent.wps_pbc == TRUE) { - // Sending empty string for WPS push button method + /* Sending empty string for WPS push button method */ g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_WPS, g_variant_new_string("")); updated = TRUE; @@ -353,11 +352,10 @@ gboolean handle_request_input(NetConnmanAgent *connman_agent, agent.ssid != NULL) { int i = 0; GVariantBuilder *builder1 = NULL; - builder1 = g_variant_builder_new (G_VARIANT_TYPE ("ay")); + builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay")); - for (i = 0; i < (agent.ssid->len); i++) { - g_variant_builder_add (builder1, "y", agent.ssid->data[i]); - } + for (i = 0; i < (agent.ssid->len); i++) + g_variant_builder_add(builder1, "y", agent.ssid->data[i]); g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_SSID, g_variant_builder_end(builder1)); if (builder1 != NULL) @@ -382,14 +380,14 @@ gboolean handle_request_input(NetConnmanAgent *connman_agent, g_variant_iter_free(iter); - if (NULL == out_table){ + if (NULL == out_table) { net_connman_agent_complete_request_input(connman_agent, context, out_table); return FALSE; } if (updated == TRUE) - g_dbus_method_invocation_return_value (context, out_table); + g_dbus_method_invocation_return_value(context, out_table); else { GError *error = NULL; error = g_error_new(G_DBUS_ERROR, @@ -417,7 +415,7 @@ gboolean handle_report_error(NetConnmanAgent *connman_agent, net_connman_agent_complete_report_error(connman_agent, context); DBG("Agent error for service[%s] - [%s]", service, error); - // Do something when it failed to make a connection + /* Do something when it failed to make a connection */ return ret; } @@ -444,8 +442,8 @@ struct poll_timer_data { void* data; }; -static struct poll_timer_data timer_data = - {QUERY_FOR_INTERNET_INTERVAL, 0, NULL}; +static struct poll_timer_data timer_data = { + QUERY_FOR_INTERNET_INTERVAL, 0, NULL}; static gboolean __check_ignore_portal_list(const char * ssid) { @@ -461,7 +459,7 @@ static gboolean __check_ignore_portal_list(const char * ssid) DBG("csc string [%s]", def_str); gchar ** ignore_ap_list = g_strsplit(def_str, ",", 0); ignore_ap_count = g_strv_length(ignore_ap_list); - for(i = 0; i < ignore_ap_count; i++) { + for (i = 0; i < ignore_ap_count; i++) { DBG("[%d] - [%s]", i, ignore_ap_list[i]); if (strncmp(ignore_ap_list[i], ssid, strlen(ssid)) == 0) { g_strfreev(ignore_ap_list); @@ -618,7 +616,7 @@ gboolean handle_request_browser(NetConnmanAgent *connman_agent, ignore_portal = __check_ignore_portal_list(ssid); - if (ignore_portal == TRUE){ + if (ignore_portal == TRUE) { net_connman_agent_complete_request_browser(connman_agent, context); return TRUE; } @@ -629,7 +627,7 @@ gboolean handle_request_browser(NetConnmanAgent *connman_agent, } #if defined TIZEN_WEARABLE - if (is_portal_msg_shown){ + if (is_portal_msg_shown) { net_connman_agent_complete_request_browser(connman_agent, context); return TRUE; } diff --git a/src/wifi-background-scan.c b/src/wifi-background-scan.c index 28f4f7d..b0e810f 100755 --- a/src/wifi-background-scan.c +++ b/src/wifi-background-scan.c @@ -54,8 +54,8 @@ static gboolean netconfig_bgscan_paused = FALSE; static struct bgscan_timer_data *__netconfig_wifi_bgscan_get_bgscan_data(void) { - static struct bgscan_timer_data timer_data = - {SCAN_EXPONENTIAL_MIN, WIFI_BGSCAN_MODE_EXPONENTIAL, 0}; + static struct bgscan_timer_data timer_data = { + SCAN_EXPONENTIAL_MIN, WIFI_BGSCAN_MODE_EXPONENTIAL, 0}; return &timer_data; } @@ -94,7 +94,7 @@ static gboolean __netconfig_wifi_bgscan_request_connman_scan(int retries) if (__netconfig_wifi_bgscan_get_mode() == WIFI_BGSCAN_MODE_EXPONENTIAL) return TRUE; - if (state == NETCONFIG_WIFI_ASSOCIATION ||state == NETCONFIG_WIFI_CONFIGURATION) { + if (state == NETCONFIG_WIFI_ASSOCIATION || state == NETCONFIG_WIFI_CONFIGURATION) { /* During Wi-Fi connecting, Wi-Fi can be disappeared. * After 1 sec, try scan even if connecting state */ if (retries < 2) @@ -277,7 +277,7 @@ gboolean handle_set_bgscan(Wifi *wifi, GDBusMethodInvocation *context, guint sca int pm_state = VCONFKEY_PM_STATE_NORMAL; old_mode = __netconfig_wifi_bgscan_get_mode(); - if (old_mode == scan_mode){ + if (old_mode == scan_mode) { wifi_complete_set_bgscan(wifi, context); return TRUE; } @@ -301,7 +301,7 @@ gboolean handle_resume_bgscan(Wifi *wifi, GDBusMethodInvocation *context) { netconfig_wifi_set_bgscan_pause(FALSE); - wifi_complete_resume_bgscan (wifi, context); + wifi_complete_resume_bgscan(wifi, context); return TRUE; } diff --git a/src/wifi-config.c b/src/wifi-config.c index 751c3b5..8da3fbf 100755 --- a/src/wifi-config.c +++ b/src/wifi-config.c @@ -41,8 +41,8 @@ #define WIFI_CONFIG_PREFIX "wifi_" #define MAC_ADDRESS_LENGTH 12 -#define WIFI_PREFIX_LENGTH MAC_ADDRESS_LENGTH + 6 // wifi_485a3f2f506a_ -#define PROFILE_PREFIX_LENGTH WIFI_PREFIX_LENGTH + 21 // /net/connman/service/wifi_485a3f2f506a_ +#define WIFI_PREFIX_LENGTH MAC_ADDRESS_LENGTH + 6 /* wifi_485a3f2f506a_ */ +#define PROFILE_PREFIX_LENGTH WIFI_PREFIX_LENGTH + 21 /* /net/connman/service/wifi_485a3f2f506a_ */ #define WIFI_MAC_ADD_LENGTH 17 #define WIFI_MAC_ADD_PATH "/sys/class/net/wlan0/address" @@ -140,9 +140,8 @@ static gboolean __get_mac_address(gchar **mac_address) tmp = g_ascii_strdown(tmp_mac, (gssize)strlen(tmp_mac)); g_free(tmp_mac); while (tmp[i]) { - if (tmp[i] != ':') { + if (tmp[i] != ':') mac[j++] = tmp[i]; - } i++; } mac[12] = '\0'; @@ -292,11 +291,10 @@ static gboolean _load_configuration(const gchar *config_id, struct wifi_config * } config->proxy_address = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_PROXY_SERVER, NULL); hidden = g_key_file_get_boolean(keyfile, group_name, WIFI_CONFIG_HIDDEN, NULL); - if (hidden) { + if (hidden) config->is_hidden = g_strdup("TRUE"); - } else { + else config->is_hidden = g_strdup("FALSE"); - } if (g_strcmp0(config->security_type, WIFI_SECURITY_EAP) == 0) { config->eap_config->anonymous_identity = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY, NULL); @@ -409,13 +407,12 @@ static gboolean _set_field(const gchar *config_id, const gchar *key, const gchar if (g_strcmp0(key, WIFI_CONFIG_PROXY_METHOD) == 0) { g_key_file_set_string(keyfile, group_name, key, value); - }else if (g_strcmp0(key, WIFI_CONFIG_PROXY_SERVER) == 0) { + } else if (g_strcmp0(key, WIFI_CONFIG_PROXY_SERVER) == 0) { g_key_file_set_string(keyfile, group_name, key, value); } else if (g_strcmp0(key, WIFI_CONFIG_HIDDEN) == 0) { gboolean hidden = FALSE; - if (g_strcmp0(value, "TRUE") == 0) { + if (g_strcmp0(value, "TRUE") == 0) hidden = TRUE; - } g_key_file_set_boolean(keyfile, group_name, key, hidden); } else if (g_strcmp0(key, WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY) == 0) { g_key_file_set_string(keyfile, group_name, key, value); @@ -475,11 +472,10 @@ static gboolean _get_field(const gchar *config_id, const gchar *key, gchar **val val = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_PROXY_SERVER, NULL); } else if (g_strcmp0(key, WIFI_CONFIG_HIDDEN) == 0) { hidden = g_key_file_get_boolean(keyfile, group_name, WIFI_CONFIG_HIDDEN, NULL); - if (hidden) { + if (hidden) val = g_strdup("TRUE"); - } else { + else val = g_strdup("FALSE"); - } } else if (g_strcmp0(key, WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY) == 0) { val = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY, NULL); } else if (g_strcmp0(key, WIFI_CONFIG_EAP_CACERT) == 0) { @@ -565,7 +561,7 @@ gboolean wifi_config_remove_configuration(const gchar *config_id) return ret; } -// dbus method +/* dbus method */ gboolean handle_get_config_ids(Wifi *wifi, GDBusMethodInvocation *context) { guint i = 0; @@ -592,7 +588,7 @@ gboolean handle_get_config_ids(Wifi *wifi, GDBusMethodInvocation *context) config_ids = g_slist_nth(config_ids, 0); g_slist_free_full(config_ids, g_free); - wifi_complete_get_config_ids(wifi, context, (const gchar * const*)result); + wifi_complete_get_config_ids(wifi, context, (const gchar * const *)result); if (result) g_free(result); @@ -726,7 +722,7 @@ gboolean handle_save_configuration(Wifi *wifi, GDBusMethodInvocation *context, g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_FAVORITE, conf->favorite); g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_AUTOCONNECT, conf->autoconnect); - // Optional field + /* Optional field */ if (conf->proxy_address != NULL) { g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_PROXY_METHOD, "manual"); g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_PROXY_SERVER, conf->proxy_address); @@ -734,9 +730,8 @@ gboolean handle_save_configuration(Wifi *wifi, GDBusMethodInvocation *context, if (conf->is_hidden != NULL) { gboolean hidden = FALSE; - if (g_strcmp0(conf->is_hidden, "TRUE") == 0) { + if (g_strcmp0(conf->is_hidden, "TRUE") == 0) hidden = TRUE; - } g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_HIDDEN, hidden); } @@ -790,56 +785,55 @@ gboolean handle_load_eap_configuration(Wifi *wifi, GDBusMethodInvocation *contex if (conf->proxy_address != NULL) { g_variant_builder_add(b, "{sv}", WIFI_CONFIG_PROXYADDRESS, g_variant_new_string(conf->proxy_address)); g_free(conf->proxy_address); - } else { + } else g_variant_builder_add(b, "{sv}", WIFI_CONFIG_PROXYADDRESS, g_variant_new_string("NONE")); - } + if (conf->last_error != NULL) { g_variant_builder_add(b, "{sv}", WIFI_CONFIG_FAILURE, g_variant_new_string(conf->last_error)); g_free(conf->last_error); - } else { + } else g_variant_builder_add(b, "{sv}", WIFI_CONFIG_FAILURE, g_variant_new_string("ERROR_NONE")); - } + if (conf->eap_config != NULL) { - if (conf->eap_config->anonymous_identity != NULL) { + if (conf->eap_config->anonymous_identity != NULL) g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY, g_variant_new_string(conf->eap_config->anonymous_identity)); - } else { + else g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY, g_variant_new_string("NONE")); - } - if (conf->eap_config->ca_cert != NULL) { + + if (conf->eap_config->ca_cert != NULL) g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_CACERT, g_variant_new_string(conf->eap_config->ca_cert)); - } else { + else g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_CACERT, g_variant_new_string("NONE")); - } - if (conf->eap_config->client_cert != NULL) { + + if (conf->eap_config->client_cert != NULL) g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_CLIENTCERT, g_variant_new_string(conf->eap_config->client_cert)); - } else { + else g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_CLIENTCERT, g_variant_new_string("NONE")); - } - if (conf->eap_config->private_key != NULL) { + + if (conf->eap_config->private_key != NULL) g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_PRIVATEKEY, g_variant_new_string(conf->eap_config->private_key)); - } else { + else g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_PRIVATEKEY, g_variant_new_string("NONE")); - } - if (conf->eap_config->identity != NULL) { + + if (conf->eap_config->identity != NULL) g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_IDENTITY, g_variant_new_string(conf->eap_config->identity)); - } else { + else g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_IDENTITY, g_variant_new_string("NONE")); - } - if (conf->eap_config->eap_type != NULL) { + + if (conf->eap_config->eap_type != NULL) g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_TYPE, g_variant_new_string(conf->eap_config->eap_type)); - } else { + else g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_TYPE, g_variant_new_string("NONE")); - } - if (conf->eap_config->eap_auth_type != NULL) { + + if (conf->eap_config->eap_auth_type != NULL) g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_AUTH_TYPE, g_variant_new_string(conf->eap_config->eap_auth_type)); - } else { + else g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_AUTH_TYPE, g_variant_new_string("NONE")); - } - if (conf->eap_config->subject_match != NULL) { + + if (conf->eap_config->subject_match != NULL) g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_SUBJECT_MATCH, g_variant_new_string(conf->eap_config->subject_match)); - } else { + else g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_SUBJECT_MATCH, g_variant_new_string("NONE")); - } } __free_wifi_configuration(conf); @@ -987,7 +981,7 @@ gboolean handle_save_eap_configuration(Wifi *wifi, GDBusMethodInvocation *contex g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_FAVORITE, conf->favorite); g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_AUTOCONNECT, conf->autoconnect); - // Optional field + /* Optional field */ if (conf->proxy_address != NULL) { g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_PROXY_METHOD, "manual"); g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_PROXY_SERVER, conf->proxy_address); @@ -995,9 +989,8 @@ gboolean handle_save_eap_configuration(Wifi *wifi, GDBusMethodInvocation *contex if (conf->is_hidden != NULL) { gboolean hidden = FALSE; - if (g_strcmp0(conf->is_hidden, "TRUE") == 0) { + if (g_strcmp0(conf->is_hidden, "TRUE") == 0) hidden = TRUE; - } g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_HIDDEN, hidden); } @@ -1030,7 +1023,7 @@ gboolean handle_remove_configuration(Wifi *wifi, GDBusMethodInvocation *context, ret = _remove_configuration(config_id); if (ret != TRUE) { - // no configuration or error + /* no configuration or error */ ERR("No [%s] configuration", config_id); netconfig_error_no_profile(context); return FALSE; @@ -1040,7 +1033,7 @@ gboolean handle_remove_configuration(Wifi *wifi, GDBusMethodInvocation *context, return ret; } -// config field key / value +/* config field key / value */ /* * [wifi_macaddress_config_id] * Name=name (mandatory) @@ -1113,7 +1106,7 @@ gboolean handle_set_config_field(Wifi *wifi, GDBusMethodInvocation *context, if (keyfile_key != NULL) g_free(keyfile_key); - wifi_complete_set_config_field(wifi,context); + wifi_complete_set_config_field(wifi, context); return ret; } diff --git a/src/wifi-eap-config.c b/src/wifi-eap-config.c index 25a2699..42a6329 100755 --- a/src/wifi-eap-config.c +++ b/src/wifi-eap-config.c @@ -366,13 +366,11 @@ static gboolean _delete_configuration(const gchar *profile) ERR("get config_id [%s] from [%s]", config_id, profile); ret = wifi_config_remove_configuration(config_id); - if (ret != TRUE) { + if (ret != TRUE) ERR("Fail to wifi_config_remove_configuration [%s]", config_id); - } - if (config_id != NULL) { + if (config_id != NULL) g_free(config_id); - } return ret; } @@ -391,9 +389,8 @@ static gboolean __netconfig_delete_config(const char *profile) return FALSE; } - if (_delete_configuration(profile) != TRUE) { + if (_delete_configuration(profile) != TRUE) ERR("Fail to delete configuration [%s]", profile); - } wifi_ident = strstr(profile, "wifi_"); if (wifi_ident == NULL) { diff --git a/src/wifi-eap.c b/src/wifi-eap.c index 0dbf179..24dc0de 100755 --- a/src/wifi-eap.c +++ b/src/wifi-eap.c @@ -234,7 +234,7 @@ static gboolean __netconfig_wifi_req_sim_auth(GArray *rand_data, auth_data.auth_type = TAPI_SIM_AUTH_TYPE_GSM; auth_data.rand_length = SIM_RAND_DATA_LEN; - for (i=0; ilen; i++) + for (i = 0; i < rand_data->len; i++) auth_data.rand_data[i] = g_array_index(rand_data, guint8, i); handle = (TapiHandle *)netconfig_tel_init(); @@ -296,16 +296,15 @@ static netconfig_error_e __netconfig_wifi_req_aka_auth( auth_data.rand_length = AKA_RAND_DATA_LEN; auth_data.autn_length = AKA_AUTN_DATA_LEN; - for (i=0; ilen; i++) + for (i = 0; i < rand_data->len; i++) auth_data.rand_data[i] = g_array_index(rand_data, guint8, i); - for (i=0; ilen; i++) + for (i = 0; i < autn_data->len; i++) auth_data.autn_data[i] = g_array_index(autn_data, guint8, i); handle = (TapiHandle *)netconfig_tel_init(); - if (handle == NULL) { + if (handle == NULL) return NETCONFIG_ERROR_FAILED_REQ_SIM_AUTH; - } ret = tel_req_sim_authentication(handle, &auth_data, __netconfig_response_aka_authentication, NULL); @@ -354,7 +353,7 @@ static gboolean __netconfig_wifi_get_sim_authdata(Wifi *wifi, } wifi_complete_get_sim_auth(wifi, context, array->data); - g_array_free (array, TRUE); + g_array_free(array, TRUE); __netconfig_wifi_clean_authentication(); return TRUE; } @@ -385,7 +384,7 @@ static gboolean __netconfig_wifi_get_aka_authdata(Wifi *wifi, GDBusMethodInvocat wifi_authdata->resp_length); wifi_complete_get_aka_auth(wifi, context, array->data); - g_array_free (array, TRUE); + g_array_free(array, TRUE); __netconfig_wifi_clean_authentication(); @@ -423,7 +422,7 @@ static gboolean __netconfig_wifi_get_aka_authdata(Wifi *wifi, GDBusMethodInvocat } wifi_complete_get_aka_auth(wifi, context, array->data); - g_array_free (array, TRUE); + g_array_free(array, TRUE); __netconfig_wifi_clean_authentication(); return TRUE; @@ -474,9 +473,8 @@ gboolean handle_req_sim_auth(Wifi *wifi, GDBusMethodInvocation *context, GVarian result = __netconfig_wifi_req_sim_auth(rand_data_garray, context); g_array_free(rand_data_garray, FALSE); - if (result) { + if (result) wifi_complete_req_sim_auth(wifi, context, result); - } return result; } diff --git a/src/wifi-firmware.c b/src/wifi-firmware.c index 132b2fd..276ed1a 100755 --- a/src/wifi-firmware.c +++ b/src/wifi-firmware.c @@ -327,8 +327,7 @@ gboolean handle_start(WifiFirmware *firmware, GDBusMethodInvocation *context, co return TRUE; } else netconfig_error_wifi_driver_failed(context); - } - else + } else netconfig_error_wifi_driver_failed(context); return FALSE; diff --git a/src/wifi-indicator.c b/src/wifi-indicator.c index 2fbfef6..35753cc 100755 --- a/src/wifi-indicator.c +++ b/src/wifi-indicator.c @@ -101,16 +101,16 @@ static int __netconfig_wifi_update_and_get_rssi(void) /* read wireless status */ char *saveptr; - p_entry = strtok_r(p_entry, " .", &saveptr); // status "%x" + p_entry = strtok_r(p_entry, " .", &saveptr); /* status "%x" */ if (p_entry != NULL) sscanf(p_entry, "%x", &status); - p_entry = strtok_r(NULL, " .", &saveptr); // Quality link "%d" + p_entry = strtok_r(NULL, " .", &saveptr); /* Quality link "%d" */ if (p_entry != NULL) sscanf(p_entry, "%d", &link); - p_entry = strtok_r(NULL, " .", &saveptr); // Quality level "%d" + p_entry = strtok_r(NULL, " .", &saveptr); /* Quality level "%d" */ if (p_entry != NULL) sscanf(p_entry, "%d", &rssi_dbm); - p_entry = strtok_r(NULL, " .", &saveptr); // Quality noise "%d" + p_entry = strtok_r(NULL, " .", &saveptr); /* Quality noise "%d" */ if (p_entry != NULL) sscanf(p_entry, "%d", &noise); @@ -191,7 +191,7 @@ static void __netconfig_wifi_data_activity_booster(int level) if (level > 0) { /* enable booster */ - switch(level) { + switch (level) { case 1: params = g_variant_new("(ii)", level1, lock); break; @@ -221,7 +221,7 @@ static void __netconfig_wifi_data_activity_booster(int level) if (old_level == 0 || old_level == level) return; - switch(old_level) { + switch (old_level) { case 1: params = g_variant_new("(ii)", level1, unlock); break; @@ -329,7 +329,7 @@ static gboolean __wifi_indicator_monitor(gpointer data) return TRUE; rssi_dbm = __netconfig_wifi_update_and_get_rssi(); - //INFO("%d dbm", rssi_dbm); + /* INFO("%d dbm", rssi_dbm); */ snr_level = netconfig_wifi_rssi_level(rssi_dbm); __netconfig_wifi_set_rssi_level(snr_level); diff --git a/src/wifi-passpoint.c b/src/wifi-passpoint.c index 6dda6b7..8a43cc9 100755 --- a/src/wifi-passpoint.c +++ b/src/wifi-passpoint.c @@ -78,7 +78,7 @@ gboolean handle_get_passpoint(Wifi *wifi, GDBusMethodInvocation *context) g_return_val_if_fail(wifi != NULL, FALSE); #if defined TIZEN_WLAN_PASSPOINT - if (netconfig_wifi_get_passpoint(&enable)){ + if (netconfig_wifi_get_passpoint(&enable)) { wifi_complete_get_passpoint(wifi, context, enable); return TRUE; } diff --git a/src/wifi-power.c b/src/wifi-power.c index 9f4f09a..926ce46 100755 --- a/src/wifi-power.c +++ b/src/wifi-power.c @@ -102,18 +102,17 @@ static void __technology_reply(GObject *source_object, GAsyncResult *res, gpoint GDBusConnection *conn = NULL; GError *error = NULL; - conn = G_DBUS_CONNECTION (source_object); + conn = G_DBUS_CONNECTION(source_object); reply = g_dbus_connection_call_finish(conn, res, &error); if (reply == NULL) { if (error != NULL) { - if (g_strcmp0(error->message, CONNMAN_ERROR_INTERFACE ".AlreadyEnabled") == 0) { + if (g_strcmp0(error->message, CONNMAN_ERROR_INTERFACE ".AlreadyEnabled") == 0) wifi_state_update_power_state(TRUE); - } else if (g_strcmp0(error->message, CONNMAN_ERROR_INTERFACE ".AlreadyDisabled") == 0) { + else if (g_strcmp0(error->message, CONNMAN_ERROR_INTERFACE ".AlreadyDisabled") == 0) wifi_state_update_power_state(FALSE); - } else { + else ERR("Fail to request status [%d: %s]", error->code, error->message); - } g_error_free(error); } else { ERR("Fail torequest status"); @@ -290,7 +289,7 @@ static int _set_connman_technology_power(gboolean enable) else param0 = g_variant_new_boolean(value_disable); - params = g_variant_new("(sv)",key, param0); + params = g_variant_new("(sv)", key, param0); reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE, CONNMAN_WIFI_TECHNOLOGY_PREFIX, CONNMAN_TECHNOLOGY_INTERFACE, @@ -720,9 +719,8 @@ static void __emergency_mode_changed_cb(keynode_t *node, void *user_data) /* enhanced power saving mode on */ vconf_get_int(VCONF_WIFI_WEARABLE_WIFI_USE, &wifi_use); psmode_wifi_use = wifi_use; - if (wifi_use != 0) { + if (wifi_use != 0) netconfig_set_vconf_int(VCONF_WIFI_WEARABLE_WIFI_USE, 0); - } if (wifi_state == VCONFKEY_WIFI_OFF) return; @@ -1218,16 +1216,15 @@ void __netconfig_set_ether_macaddr() netconfig_set_vconf_str(VCONF_ETH_MAC_ADDRESS, mac_addr); } - DBG("MAC Address of eth0 [%s]",mac_addr); + DBG("MAC Address of eth0 [%s]", mac_addr); const char *path = NET_EXEC_PATH; char *const args[] = { "/sbin/ifconfig", "eth0", "hw", - "ether",mac_addr, "up", NULL}; + "ether", mac_addr, "up", NULL}; char *const envs[] = { NULL }; rv = netconfig_execute_file(path, args, envs); - if (rv < 0) { + if (rv < 0) ERR("Unable to execute system command"); - } g_free(mac_addr); } diff --git a/src/wifi-ssid-scan.c b/src/wifi-ssid-scan.c index 390fe1b..a516789 100755 --- a/src/wifi-ssid-scan.c +++ b/src/wifi-ssid-scan.c @@ -49,23 +49,22 @@ static void __check_security(const char *str_keymgmt, bss_info_t *bss_info) { INFO("keymgmt : %s", str_keymgmt); - if (g_strcmp0(str_keymgmt, "ieee8021x") == 0) { + if (g_strcmp0(str_keymgmt, "ieee8021x") == 0) bss_info->security = WIFI_SECURITY_IEEE8021X; - } else if (g_strcmp0(str_keymgmt, "wpa-psk") == 0) { + else if (g_strcmp0(str_keymgmt, "wpa-psk") == 0) bss_info->security = WIFI_SECURITY_PSK; - } else if (g_strcmp0(str_keymgmt, "wpa-psk-sha256") == 0) { + else if (g_strcmp0(str_keymgmt, "wpa-psk-sha256") == 0) bss_info->security = WIFI_SECURITY_PSK; - } else if (g_strcmp0(str_keymgmt, "wpa-ft-psk") == 0) { + else if (g_strcmp0(str_keymgmt, "wpa-ft-psk") == 0) bss_info->security = WIFI_SECURITY_PSK; - } else if (g_strcmp0(str_keymgmt, "wpa-ft-eap") == 0) { + else if (g_strcmp0(str_keymgmt, "wpa-ft-eap") == 0) bss_info->security = WIFI_SECURITY_IEEE8021X; - } else if (g_strcmp0(str_keymgmt, "wpa-eap") == 0) { + else if (g_strcmp0(str_keymgmt, "wpa-eap") == 0) bss_info->security = WIFI_SECURITY_IEEE8021X; - } else if (g_strcmp0(str_keymgmt, "wpa-eap-sha256") == 0) { + else if (g_strcmp0(str_keymgmt, "wpa-eap-sha256") == 0) bss_info->security = WIFI_SECURITY_IEEE8021X; - } else if (g_strcmp0(str_keymgmt, "wps") == 0) { + else if (g_strcmp0(str_keymgmt, "wps") == 0) bss_info->wps = TRUE; - } } static gboolean __ssid_scan_timeout(gpointer data) @@ -99,21 +98,20 @@ static void _parse_keymgmt_message(GVariant *param, bss_info_t *bss_info) g_variant_get(param, "a{sv}", &iter1); while (g_variant_iter_loop(iter1, "{sv}", &key, &var)) { - if (g_strcmp0(key, "KeyMgmt") == 0) {//check this :iterate + if (g_strcmp0(key, "KeyMgmt") == 0) { GVariantIter *iter2; g_variant_get(var, "as", &iter2); char *str; while (g_variant_iter_loop(iter2, "s", &str)) { - if (str == NULL) { + if (str == NULL) break; - } __check_security(str, bss_info); } - g_variant_iter_free (iter2); + g_variant_iter_free(iter2); } } - g_variant_iter_free (iter1); + g_variant_iter_free(iter1); return; } @@ -141,15 +139,14 @@ static gboolean _request_ssid_scan(const char *object_path, const char *ssid) return FALSE; } - builder1 = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}")); + builder1 = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); g_variant_builder_add(builder1, "{sv}", key1, g_variant_new_string(val1)); - builder2 = g_variant_builder_new(G_VARIANT_TYPE ("aay")); - builder3 = g_variant_builder_new (G_VARIANT_TYPE ("ay")); + builder2 = g_variant_builder_new(G_VARIANT_TYPE("aay")); + builder3 = g_variant_builder_new(G_VARIANT_TYPE("ay")); - for (i = 0; i < strlen(ssid); i++) { - g_variant_builder_add (builder3, "y", ssid[i]); - } + for (i = 0; i < strlen(ssid); i++) + g_variant_builder_add(builder3, "y", ssid[i]); g_variant_builder_add(builder2, "@ay", g_variant_builder_end(builder3)); g_variant_builder_add(builder1, "{sv}", key2, g_variant_builder_end(builder2)); @@ -184,9 +181,8 @@ static gboolean _request_ssid_scan(const char *object_path, const char *ssid) return FALSE; } - if (g_ssid != NULL) { + if (g_ssid != NULL) g_free(g_ssid); - } g_ssid = g_strdup(ssid); @@ -203,7 +199,7 @@ static void _emit_ssid_scan_completed(void) const char *prop_security = "security"; const char *prop_wps = "wps"; - builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}")); + builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); for (list = bss_info_list; list != NULL; list = list->next) { bss_info_t *bss_info = (bss_info_t *)list->data; if (bss_info && g_strcmp0((char *)bss_info->ssid, g_ssid) == 0) { @@ -246,9 +242,8 @@ gboolean wifi_ssid_scan(const char *ssid) netconfig_wifi_bgscan_stop(); if (ssid != NULL) { - if (scan_ssid != NULL) { + if (scan_ssid != NULL) g_free(scan_ssid); - } scan_ssid = g_strdup(ssid); } @@ -324,7 +319,7 @@ void wifi_ssid_scan_add_bss(GVariant *message) } if (path != NULL) - INFO("Object path of BSS added is %s",path); + INFO("Object path of BSS added is %s", path); bss_info = g_try_new0(bss_info_t, 1); if (bss_info == NULL) @@ -350,7 +345,7 @@ void wifi_ssid_scan_add_bss(GVariant *message) const guchar *ie; gsize ie_len; ie = g_variant_get_fixed_array(value, &ie_len, sizeof(guchar)); - DBG("The IE : %s",ie); + DBG("The IE : %s", ie); } } @@ -383,11 +378,10 @@ gboolean handle_request_specific_scan(Wifi *wifi, result = wifi_ssid_scan((const char *)ssid); - if (result != TRUE) { + if (result != TRUE) netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "FailSpecificScan"); - } else { + else wifi_complete_request_wps_scan(wifi, context); - } return result; } diff --git a/src/wifi-state.c b/src/wifi-state.c index e1e9fbd..8b9cc33 100755 --- a/src/wifi-state.c +++ b/src/wifi-state.c @@ -135,9 +135,8 @@ static gboolean __is_wifi_profile_available(void) g_variant_get(message, "(a(oa{sv}))", &iter); while (g_variant_iter_loop(iter, "(oa{sv})", &obj, &next)) { - if (obj == NULL || netconfig_is_wifi_profile((const gchar*)obj) == FALSE) { + if (obj == NULL || netconfig_is_wifi_profile((const gchar*)obj) == FALSE) continue; - } g_variant_iter_free(next); g_free(obj); @@ -160,9 +159,8 @@ static gboolean __is_favorited(GVariantIter *array) while (g_variant_iter_loop(array, "{sv}", &key, &var)) { gboolean value; - if (g_str_equal(key, "Favorite") != TRUE) { + if (g_str_equal(key, "Favorite") != TRUE) continue; - } value = g_variant_get_boolean(var); if (value) @@ -239,9 +237,8 @@ static gboolean _check_network_notification(gpointer data) } vconf_get_int(VCONFKEY_WIFI_UG_RUN_STATE, &ug_state); - if (ug_state == VCONFKEY_WIFI_UG_RUN_STATE_ON_FOREGROUND) { + if (ug_state == VCONFKEY_WIFI_UG_RUN_STATE_ON_FOREGROUND) goto cleanup; - } netconfig_send_notification_to_net_popup(NETCONFIG_ADD_FOUND_AP_NOTI, NULL); @@ -269,9 +266,8 @@ static char *_get_connman_favorite_service(void) g_variant_get(message, "(a(oa{sv}))", &iter); while (g_variant_iter_loop(iter, "(oa{sv})", &obj, &next)) { - if (obj == NULL || netconfig_is_wifi_profile(obj) == FALSE) { + if (obj == NULL || netconfig_is_wifi_profile(obj) == FALSE) continue; - } if (__is_favorited(next) == TRUE) { favorite_service = g_strdup(obj); @@ -291,13 +287,11 @@ static void __notification_value_changed_cb(keynode_t *node, void *user_data) { int value = -1; - if (vconf_get_int(VCONFKEY_WIFI_ENABLE_QS, &value) < 0) { + if (vconf_get_int(VCONFKEY_WIFI_ENABLE_QS, &value) < 0) return; - } - if (value == VCONFKEY_WIFI_QS_DISABLE) { + if (value == VCONFKEY_WIFI_QS_DISABLE) netconfig_send_notification_to_net_popup(NETCONFIG_DEL_FOUND_AP_NOTI, NULL); - } } static void _register_network_notification(void) @@ -390,7 +384,7 @@ static void _set_power_lock(gboolean power_lock) "org.tizen.system.deviced.display", lock_method, params); - if (reply == NULL){ + if (reply == NULL) { ERR("Failed to set_power_lock"); return; } @@ -414,7 +408,7 @@ void wifi_state_emit_power_completed(gboolean power_on) else wifi_emit_power_off_completed((Wifi *)get_wifi_object()); - DBG("Successfully sent signal [%s]",(power_on)?"powerOn":"powerOff"); + DBG("Successfully sent signal [%s]", (power_on) ? "powerOn" : "powerOff"); } void wifi_state_emit_power_failed(void) @@ -579,8 +573,8 @@ void wifi_state_set_service_state(wifi_service_state_e new_state) netconfig_wifi_bgscan_stop(); netconfig_wifi_bgscan_start(TRUE); - } else if ((old_state > NETCONFIG_WIFI_IDLE && old_state < NETCONFIG_WIFI_CONNECTED) && new_state == NETCONFIG_WIFI_IDLE){ - //in ipv6 case disconnect/association -> association + } else if ((old_state > NETCONFIG_WIFI_IDLE && old_state < NETCONFIG_WIFI_CONNECTED) && new_state == NETCONFIG_WIFI_IDLE) { + /* in ipv6 case disconnect/association -> association */ DBG("reset the bg scan period"); netconfig_wifi_set_bgscan_pause(FALSE); @@ -590,7 +584,7 @@ void wifi_state_set_service_state(wifi_service_state_e new_state) _wifi_state_changed(new_state); - if (new_state == NETCONFIG_WIFI_CONNECTED){ + if (new_state == NETCONFIG_WIFI_CONNECTED) { _wifi_state_connected_activation(); #if defined TIZEN_WEARABLE wc_launch_syspopup(WC_POPUP_TYPE_WIFI_CONNECTED); @@ -638,9 +632,8 @@ wifi_tech_state_e wifi_state_get_technology_state(void) g_variant_get(message, "(a(oa{sv}))", &iter); while (g_variant_iter_loop(iter, "(oa{sv})", &path, &next)) { - if (path == NULL || g_strcmp0(path, CONNMAN_WIFI_TECHNOLOGY_PREFIX) != 0) { + if (path == NULL || g_strcmp0(path, CONNMAN_WIFI_TECHNOLOGY_PREFIX) != 0) continue; - } while (g_variant_iter_loop(next, "{sv}", &key, &variant)) { const gchar *sdata = NULL; @@ -650,24 +643,24 @@ wifi_tech_state_e wifi_state_get_technology_state(void) data = g_variant_get_boolean(variant); DBG("key-[%s] - %s", key, data ? "True" : "False"); - if (strcmp(key, "Powered") == 0 && data) { + if (strcmp(key, "Powered") == 0 && data) wifi_tech_powered = TRUE; - } else if (strcmp(key, "Connected") == 0 && data) { + else if (strcmp(key, "Connected") == 0 && data) wifi_tech_connected = TRUE; - } else if (strcmp(key, "Tethering") == 0 && data) { - // For further use - } + /* For further use + else if (strcmp(key, "Tethering") == 0 && data) { + } */ } else if (g_variant_is_of_type(variant, G_VARIANT_TYPE_STRING)) { sdata = g_variant_get_string(variant, NULL); DBG("%s", sdata); } } - g_variant_iter_free (next); + g_variant_iter_free(next); } g_variant_unref(message); - g_variant_iter_free (iter); + g_variant_iter_free(iter); if (wifi_tech_powered == TRUE) ret = NETCONFIG_WIFI_TECH_POWERED; @@ -716,14 +709,14 @@ gboolean handle_get_wifi_state(Wifi *wifi, GDBusMethodInvocation *context) tech_state = wifi_state_get_technology_state(); service_state = wifi_state_get_service_state(); - if(tech_state == NETCONFIG_WIFI_TECH_UNKNOWN) { + if (tech_state == NETCONFIG_WIFI_TECH_UNKNOWN) param = g_variant_new("(s)", "unknown"); - } else if(tech_state == NETCONFIG_WIFI_TECH_OFF || - tech_state == NETCONFIG_WIFI_TECH_WPS_ONLY) { + else if (tech_state == NETCONFIG_WIFI_TECH_OFF || + tech_state == NETCONFIG_WIFI_TECH_WPS_ONLY) param = g_variant_new("(s)", "deactivated"); - } else if(tech_state == NETCONFIG_WIFI_TECH_CONNECTED) { + else if (tech_state == NETCONFIG_WIFI_TECH_CONNECTED) param = g_variant_new("(s)", "connected"); - } else { + else { switch (service_state) { case NETCONFIG_WIFI_FAILURE: param = g_variant_new("(s)", "failure"); diff --git a/src/wifi-tdls.c b/src/wifi-tdls.c index 14366c9..d34dbfa 100755 --- a/src/wifi-tdls.c +++ b/src/wifi-tdls.c @@ -39,7 +39,7 @@ char *peer_mac = NULL; int is_connected = 0; -void __netconfig_wifi_notify_tdls_event(const char *sig_name,const char *peer_mac) +void __netconfig_wifi_notify_tdls_event(const char *sig_name, const char *peer_mac) { GVariantBuilder *builder; GVariant *params; @@ -71,7 +71,7 @@ static GVariant * __netconfig_wifi_tdls_send_dbus_str(const char* method, const } params = g_variant_new("(s)", str); - INFO("[TizenMW-->WPAS] Sent Dbus Method :[%s],value[%s]", method,str); + INFO("[TizenMW-->WPAS] Sent Dbus Method :[%s],value[%s]", method, str); message = netconfig_invoke_dbus_method(SUPPLICANT_SERVICE, if_path, SUPPLICANT_INTERFACE ".Interface", method, params); @@ -84,9 +84,8 @@ gboolean handle_tdls_disconnect(Wifi *wifi, GDBusMethodInvocation *context, { DBG("[TizenMW-->WPAS]: TDLS Teardown Request: [%s]", peer_mac_Addr); - if(!is_connected) { + if (!is_connected) { ERR(" No active TDLS Connection !!!"); - } else { GVariant *message = NULL; message = __netconfig_wifi_tdls_send_dbus_str("TDLSTeardown", (const char*)peer_mac_Addr); @@ -161,7 +160,7 @@ void netconfig_wifi_tlds_disconnected_event(GVariant *message) if (g_strcmp0(peer_mac, peer_mac_addr) == 0) { INFO("TDLS Peer Disconnected Mac Address: [%s]", peer_mac); is_connected = 0; - __netconfig_wifi_notify_tdls_event("TDLSDisconnect",peer_mac); + __netconfig_wifi_notify_tdls_event("TDLSDisconnect", peer_mac); } else INFO("TDLS Peer Disconnected peer_mac(%s) != peer_mac_address(%s)", peer_mac, peer_mac_addr); } diff --git a/src/wifi-tel-intf.c b/src/wifi-tel-intf.c index efd2cf5..8a74aa9 100755 --- a/src/wifi-tel-intf.c +++ b/src/wifi-tel-intf.c @@ -89,9 +89,9 @@ TapiHandle * netconfig_tel_init(void) void netconfig_tel_deinit(void) { - int current_sim = _check_current_sim(); + int current_sim = _check_current_sim(); - if (current_sim < 0){ + if (current_sim < 0) { if (tapi_handle) tel_deinit(tapi_handle); diff --git a/src/wifi-wps.c b/src/wifi-wps.c index 3de9452..82da048 100755 --- a/src/wifi-wps.c +++ b/src/wifi-wps.c @@ -66,7 +66,7 @@ gboolean netconfig_wifi_is_wps_enabled(void) return netconfig_is_wps_enabled; } -static void __netconfig_wifi_wps_notify_scan_done(void)//check this +static void __netconfig_wifi_wps_notify_scan_done(void) { GVariantBuilder *builder = NULL; GVariantBuilder *builder1 = NULL; @@ -76,7 +76,7 @@ static void __netconfig_wifi_wps_notify_scan_done(void)//check this const char *prop_rssi = "rssi"; const char *prop_mode = "mode"; - builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}")); + builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); for (list = wps_bss_info_list; list != NULL; list = list->next) { struct wps_bss_info_t *bss_info = (struct wps_bss_info_t *)list->data; @@ -94,10 +94,9 @@ static void __netconfig_wifi_wps_notify_scan_done(void)//check this DBG("BSS found; SSID %s, BSSID %s, RSSI %d MODE %d", ssid, bssid_str, rssi, mode); - builder1 = g_variant_builder_new (G_VARIANT_TYPE ("ay")); - for (i = 0; i < ssid_len; i++) { - g_variant_builder_add (builder1, "y", ssid[i]); - } + builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay")); + for (i = 0; i < ssid_len; i++) + g_variant_builder_add(builder1, "y", ssid[i]); g_variant_builder_add(builder, "{sv}", prop_ssid, g_variant_builder_end(builder1)); g_variant_builder_unref(builder1); @@ -110,9 +109,8 @@ static void __netconfig_wifi_wps_notify_scan_done(void)//check this wifi_emit_wps_scan_completed((Wifi *)get_wifi_object(), g_variant_builder_end(builder)); g_variant_builder_unref(builder); - if (wps_bss_info_list != NULL) { + if (wps_bss_info_list != NULL) g_slist_free_full(wps_bss_info_list, g_free); - } wps_bss_info_list = NULL; wps_bss_list_count = 0; @@ -132,7 +130,7 @@ static void __netconfig_wifi_wps_get_bss_info_result( GDBusConnection *conn = NULL; GError *error = NULL; - conn = G_DBUS_CONNECTION (source_object); + conn = G_DBUS_CONNECTION(source_object); reply = g_dbus_connection_call_finish(conn, res, &error); if (error != NULL) { @@ -239,7 +237,7 @@ static void __netconfig_wifi_wps_get_bsss_result(GObject *source_object, gboolean counter_flag = FALSE; GError *error = NULL; - conn = G_DBUS_CONNECTION (source_object); + conn = G_DBUS_CONNECTION(source_object); reply = g_dbus_connection_call_finish(conn, res, &error); if (error != NULL) { ERR("Error code: [%d] Error message: [%s]", error->code, error->message); @@ -352,7 +350,7 @@ static int __netconfig_wifi_wps_request_scan(const char *if_path) return -EIO; } - builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}")); + builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); g_variant_builder_add(builder, "{sv}", key1, g_variant_new_string(val1)); message = g_variant_new("(@a{sv})", g_variant_builder_end(builder)); g_variant_builder_unref(builder); @@ -392,7 +390,7 @@ static void __netconfig_wifi_interface_create_result( GDBusConnection *conn = NULL; GError *error = NULL; - conn = G_DBUS_CONNECTION (source_object); + conn = G_DBUS_CONNECTION(source_object); message = g_dbus_connection_call_finish(conn, res, &error); if (error == NULL) { @@ -425,7 +423,7 @@ static int __netconfig_wifi_wps_create_interface(void) return -EIO; } - builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}")); + builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); g_variant_builder_add(builder, "{sv}", key, g_variant_new_string(val)); message = g_variant_new("(@a{sv})", g_variant_builder_end(builder)); @@ -539,7 +537,7 @@ static void __interface_wps_cancel_result(GObject *source_object, GDBusConnection *conn = NULL; GError *error = NULL; - conn = G_DBUS_CONNECTION (source_object); + conn = G_DBUS_CONNECTION(source_object); reply = g_dbus_connection_call_finish(conn, res, &error); if (reply == NULL) { diff --git a/src/wifi.c b/src/wifi.c index ea1b2d7..0ccdadb 100755 --- a/src/wifi.c +++ b/src/wifi.c @@ -53,7 +53,7 @@ static gboolean handle_check_black_list(Wifi *wifi, GDBusMethodInvocation *conte { ERR("Name (%s)", name); INFO("disable to check"); - wifi_complete_check_black_list (wifi, context, TRUE); + wifi_complete_check_black_list(wifi, context, TRUE); return TRUE; } @@ -113,7 +113,7 @@ void wifi_object_create_and_init(void) wifi_object = wifi_skeleton_new(); interface_wifi = G_DBUS_INTERFACE_SKELETON(wifi_object); - // WIFI power + /* WIFI power */ g_signal_connect(wifi_object, "handle-load-driver", G_CALLBACK(handle_load_driver), NULL); g_signal_connect(wifi_object, "handle-remove-driver", @@ -123,27 +123,27 @@ void wifi_object_create_and_init(void) g_signal_connect(wifi_object, "handle-remove-p2p-driver", G_CALLBACK(handle_remove_p2p_driver), NULL); - // WIFI state + /* WIFI state */ g_signal_connect(wifi_object, "handle-get-wifi-state", G_CALLBACK(handle_get_wifi_state), NULL); - // WIFI scan + /* WIFI scan */ g_signal_connect(wifi_object, "handle-request-specific-scan", G_CALLBACK(handle_request_specific_scan), NULL); g_signal_connect(wifi_object, "handle-request-wps-scan", G_CALLBACK(handle_request_wps_scan), NULL); - // WIFI direct + /* WIFI direct */ g_signal_connect(wifi_object, "handle-launch-direct", G_CALLBACK(handle_launch_direct), NULL); - // EAP config + /* EAP config */ g_signal_connect(wifi_object, "handle-create-eap-config", G_CALLBACK(handle_create_eap_config), NULL); g_signal_connect(wifi_object, "handle-delete-eap-config", G_CALLBACK(handle_delete_eap_config), NULL); - // WIFI configuration + /* WIFI configuration */ g_signal_connect(wifi_object, "handle-save-configuration", G_CALLBACK(handle_save_configuration), NULL); g_signal_connect(wifi_object, "handle-remove-configuration", @@ -156,13 +156,13 @@ void wifi_object_create_and_init(void) G_CALLBACK(handle_set_config_field), NULL); g_signal_connect(wifi_object, "handle-get-config-passphrase", G_CALLBACK(handle_get_config_passphrase), NULL); - // WIFI EAP configuration + /* WIFI EAP configuration */ g_signal_connect(wifi_object, "handle-save-eap-configuration", G_CALLBACK(handle_save_eap_configuration), NULL); g_signal_connect(wifi_object, "handle-load-eap-configuration", G_CALLBACK(handle_load_eap_configuration), NULL); - // BG scan mode + /* BG scan mode */ g_signal_connect(wifi_object, "handle-set-bgscan", G_CALLBACK(handle_set_bgscan), NULL); g_signal_connect(wifi_object, "handle-resume-bgscan", @@ -170,13 +170,13 @@ void wifi_object_create_and_init(void) g_signal_connect(wifi_object, "handle-pause-bgscan", G_CALLBACK(handle_pause_bgscan), NULL); - // Passpoint + /* Passpoint */ g_signal_connect(wifi_object, "handle-set-passpoint", G_CALLBACK(handle_set_passpoint), NULL); g_signal_connect(wifi_object, "handle-get-passpoint", G_CALLBACK(handle_get_passpoint), NULL); - // EAP authentication + /* EAP authentication */ g_signal_connect(wifi_object, "handle-get-aka-auth", G_CALLBACK(handle_get_aka_auth), NULL); g_signal_connect(wifi_object, "handle-get-sim-auth", @@ -188,11 +188,11 @@ void wifi_object_create_and_init(void) g_signal_connect(wifi_object, "handle-req-sim-auth", G_CALLBACK(handle_req_sim_auth), NULL); - // WIFI MDM blacklist + /* WIFI MDM blacklist */ g_signal_connect(wifi_object, "handle-check-black-list", G_CALLBACK(handle_check_black_list), NULL); - //TDLS methods + /* TDLS methods */ g_signal_connect(wifi_object, "handle-tdls-disconnect", G_CALLBACK(handle_tdls_disconnect), NULL); g_signal_connect(wifi_object, "handle-tdls-connected-peer", @@ -203,7 +203,7 @@ void wifi_object_create_and_init(void) ERR("Export WIFI_PATH for wifi failed"); } - /*Interface connman.Agent*/ + /* Interface connman.Agent */ connman_agent_object = net_connman_agent_skeleton_new(); interface_connman_agent = G_DBUS_INTERFACE_SKELETON(connman_agent_object);