diff options
author | Alok Barsode <alok.barsode@linux.intel.com> | 2011-08-24 16:44:14 +0300 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-08-25 11:14:21 +0200 |
commit | fa0e75c2255edd7cecd8a1d63390e7e000cc7d83 (patch) | |
tree | 388b4b0d8bdacc132623fcffc414e01e4575e42d /src/technology.c | |
parent | eca384a6167bd4b90d229c3fe9ba7d23d020e68b (diff) | |
download | connman-fa0e75c2255edd7cecd8a1d63390e7e000cc7d83.tar.gz connman-fa0e75c2255edd7cecd8a1d63390e7e000cc7d83.tar.bz2 connman-fa0e75c2255edd7cecd8a1d63390e7e000cc7d83.zip |
technology: Redo offlinemode logic
Traverse the list of technologies and enable/disable each instead of
traversing the device list.
Diffstat (limited to 'src/technology.c')
-rw-r--r-- | src/technology.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/technology.c b/src/technology.c index fb7f0580..19a096d7 100644 --- a/src/technology.c +++ b/src/technology.c @@ -707,11 +707,6 @@ int __connman_technology_enabled(enum connman_service_type type) state_changed(technology); } - if (__connman_profile_get_offlinemode() == TRUE) { - __connman_profile_set_offlinemode(FALSE, FALSE); - __connman_profile_save_default(); - } - if (technology->pending_reply != NULL) { g_dbus_send_reply(connection, technology->pending_reply, DBUS_TYPE_INVALID); dbus_message_unref(technology->pending_reply); @@ -873,6 +868,33 @@ done: return err; } +int __connman_technology_set_offlinemode(connman_bool_t offlinemode) +{ + GSList *list; + int err = -EINVAL; + + DBG("offlinemode %s", offlinemode ? "On" : "Off"); + + /* Traverse technology list, enable/disable each technology. */ + for (list = technology_list; list; list = list->next) { + struct connman_technology *technology = list->data; + + if (offlinemode) + err = __connman_technology_disable(technology->type, NULL); + if (!offlinemode && technology->enable_persistent) + err = __connman_technology_enable(technology->type, NULL); + } + + if (err == 0 || err == -EINPROGRESS) { + __connman_profile_set_offlinemode(offlinemode); + __connman_profile_save_default(); + + __connman_notifier_offlinemode(offlinemode); + } + + return err; +} + static void technology_blocked(struct connman_technology *technology, connman_bool_t blocked) { |