summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2011-12-12 18:32:53 +0100
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2011-12-12 18:37:13 +0100
commit8200c91aa4224800421ceedf66d29d454b4a89d7 (patch)
treed08787addacbdf4d842d58f3f02b71ff58af75fa /plugins
parentc39f3f76ab12b75efb762ad9cdaadb4228ac1282 (diff)
downloadconnman-8200c91aa4224800421ceedf66d29d454b4a89d7.tar.gz
connman-8200c91aa4224800421ceedf66d29d454b4a89d7.tar.bz2
connman-8200c91aa4224800421ceedf66d29d454b4a89d7.zip
ofono: Move netreg strength update into a function
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ofono.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/plugins/ofono.c b/plugins/ofono.c
index 4909e03c..f8f3b244 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -1240,6 +1240,20 @@ static void netreg_update_name(struct modem_data *modem,
connman_network_update(modem->network);
}
+static void netreg_update_strength(struct modem_data *modem,
+ DBusMessageIter *value)
+{
+ dbus_message_iter_get_basic(value, &modem->strength);
+
+ DBG("%s Strength %d", modem->path, modem->strength);
+
+ if (modem->network == NULL)
+ return;
+
+ connman_network_set_strength(modem->network, modem->strength);
+ connman_network_update(modem->network);
+}
+
static gboolean netreg_changed(DBusConnection *connection, DBusMessage *message,
void *user_data)
{
@@ -1266,15 +1280,7 @@ static gboolean netreg_changed(DBusConnection *connection, DBusMessage *message,
if (g_str_equal(key, "Name") == TRUE) {
netreg_update_name(modem, &value);
} else if (g_str_equal(key, "Strength") == TRUE) {
- dbus_message_iter_get_basic(&value, &modem->strength);
-
- DBG("%s Strength %d", modem->path, modem->strength);
-
- if (modem->network == NULL)
- return TRUE;
-
- connman_network_set_strength(modem->network, modem->strength);
- connman_network_update(modem->network);
+ netreg_update_strength(modem, &value);
}
return TRUE;
@@ -1298,16 +1304,7 @@ static void netreg_properties_reply(struct modem_data *modem,
if (g_str_equal(key, "Name") == TRUE) {
netreg_update_name(modem, &value);
} else if (g_str_equal(key, "Strength") == TRUE) {
- dbus_message_iter_get_basic(&value, &modem->strength);
-
- DBG("%s Strength %d", modem->path,
- modem->strength);
-
- if (modem->network != NULL) {
- connman_network_set_strength(modem->network,
- modem->strength);
- connman_network_update(modem->network);
- }
+ netreg_update_strength(modem, &value);
}
dbus_message_iter_next(dict);