diff options
author | Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> | 2011-11-03 10:46:29 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-11-07 13:05:23 +0100 |
commit | 46abc56fa8e49c07da5402352486c1fb7820aa68 (patch) | |
tree | a097305f5f14708a63889aecff6ca046db3a4ebf /gsupplicant | |
parent | 7341c1eac97cc75807895fc38ca7ee9ae975e234 (diff) | |
download | connman-46abc56fa8e49c07da5402352486c1fb7820aa68.tar.gz connman-46abc56fa8e49c07da5402352486c1fb7820aa68.tar.bz2 connman-46abc56fa8e49c07da5402352486c1fb7820aa68.zip |
gsupplicant: Add a function to enable or disable the selected network
Diffstat (limited to 'gsupplicant')
-rw-r--r-- | gsupplicant/gsupplicant.h | 3 | ||||
-rw-r--r-- | gsupplicant/supplicant.c | 23 |
2 files changed, 26 insertions, 0 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index 49815e15..c7106791 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 183e341c..1c360fb0 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) { |