From: Tomasz Bursztyka Date: Thu, 3 Nov 2011 08:46:29 +0000 (+0200) Subject: gsupplicant: Add a function to enable or disable the selected network X-Git-Tag: 0.78~78 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fconnman.git;a=commitdiff_plain;h=46abc56fa8e49c07da5402352486c1fb7820aa68 gsupplicant: Add a function to enable or disable the selected network --- diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index 49815e1..c710679 100644 --- a/gsupplicant/gsupplicant.h +++ b/gsupplicant/gsupplicant.h @@ -200,6 +200,9 @@ unsigned int g_supplicant_interface_get_mode(GSupplicantInterface *interface); unsigned int g_supplicant_interface_get_max_scan_ssids( GSupplicantInterface *interface); +int g_supplicant_interface_enable_selected_network(GSupplicantInterface *interface, + dbus_bool_t enable); + /* Network API */ struct _GSupplicantNetwork; diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 183e341..1c360fb 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -743,6 +743,29 @@ unsigned int g_supplicant_interface_get_max_scan_ssids( return interface->max_scan_ssids; } +static void set_network_enabled(DBusMessageIter *iter, void *user_data) +{ + dbus_bool_t enable = *(dbus_bool_t *)user_data; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &enable); +} + +int g_supplicant_interface_enable_selected_network(GSupplicantInterface *interface, + dbus_bool_t enable) +{ + if (interface == NULL) + return -1; + + if (interface->network_path == NULL) + return -1; + + SUPPLICANT_DBG(" "); + return supplicant_dbus_property_set(interface->network_path, + SUPPLICANT_INTERFACE ".Network", + "Enabled", DBUS_TYPE_BOOLEAN_AS_STRING, + set_network_enabled, NULL, &enable); +} + GSupplicantInterface *g_supplicant_network_get_interface( GSupplicantNetwork *network) {