diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-12-12 18:57:19 +0100 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-12-12 19:00:35 +0100 |
commit | 7c4dac19371496e8f7cf8cd1ea0ba93709dca239 (patch) | |
tree | ca8df66e79d7a4fbf141dd5e45f0fefbdddfa0fa /plugins | |
parent | dd77dd6f6888e128e66825e4b53c528a6531d420 (diff) | |
download | connman-7c4dac19371496e8f7cf8cd1ea0ba93709dca239.tar.gz connman-7c4dac19371496e8f7cf8cd1ea0ba93709dca239.tar.bz2 connman-7c4dac19371496e8f7cf8cd1ea0ba93709dca239.zip |
ofono: Move cm powered update into a function
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/ofono.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/plugins/ofono.c b/plugins/ofono.c index 378e49dc..fa0f8080 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -1386,6 +1386,20 @@ static void cm_update_attached(struct modem_data *modem, netreg_get_properties(modem); } +static void cm_update_powered(struct modem_data *modem, + DBusMessageIter *value) +{ + dbus_message_iter_get_basic(value, &modem->cm_powered); + + DBG("%s ConnnectionManager Powered %d", modem->path, + modem->cm_powered); + + if (modem->cm_powered == TRUE) + return; + + cm_set_powered(modem); +} + static gboolean cm_changed(DBusConnection *connection, DBusMessage *message, void *user_data) { @@ -1412,13 +1426,7 @@ static gboolean cm_changed(DBusConnection *connection, DBusMessage *message, if (g_str_equal(key, "Attached") == TRUE) { cm_update_attached(modem, &value); } else if (g_str_equal(key, "Powered") == TRUE) { - dbus_message_iter_get_basic(&value, &modem->cm_powered); - - DBG("%s ConnnectionManager Powered %d", modem->path, - modem->cm_powered); - - if (modem->cm_powered == FALSE) - cm_set_powered(modem); + cm_update_powered(modem, &value); } return TRUE; @@ -1441,13 +1449,7 @@ static void cm_properties_reply(struct modem_data *modem, DBusMessageIter *dict) if (g_str_equal(key, "Attached") == TRUE) { cm_update_attached(modem, &value); } else if (g_str_equal(key, "Powered") == TRUE) { - dbus_message_iter_get_basic(&value, &modem->cm_powered); - - DBG("%s ConnnectionManager Powered %d", modem->path, - modem->cm_powered); - - if (modem->cm_powered == FALSE) - cm_set_powered(modem); + cm_update_powered(modem, &value); } dbus_message_iter_next(dict); |