From 46d8e827d58417870243a5645c97adffc189303e Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Fri, 25 Jun 2010 17:36:12 +0200 Subject: [PATCH] Set the network roaming toggle according to oFono status oFono's NetworkRegistration interface gives a status propery indicating (among other things) if we're roaming or not. --- plugins/ofono.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/plugins/ofono.c b/plugins/ofono.c index 2995f26..2f67a99 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -237,6 +237,22 @@ static void set_network_name_reply(DBusPendingCall *call, void *user_data) dbus_message_iter_get_basic(&value, &name); connman_network_set_name(network, name); create_service(network); + } else if (g_strcmp0(key, "Status") == 0) { + const char *status; + connman_bool_t roaming; + + dbus_message_iter_get_basic(&value, &status); + if (g_strcmp0(status, "roaming") == 0) + roaming = TRUE; + else if (g_strcmp0(status, "registered") == 0) + roaming = FALSE; + else { + dbus_message_iter_next(&dict); + continue; + } + + connman_network_set_roaming(network, roaming); + connman_network_update(network); } dbus_message_iter_next(&dict); @@ -409,6 +425,20 @@ static gboolean registration_changed(DBusConnection *connection, dbus_message_iter_get_basic(&value, &strength); connman_network_set_strength(network, strength); connman_network_update(network); + } else if (g_strcmp0(key, "Status") == 0) { + const char *status; + connman_bool_t roaming; + + dbus_message_iter_get_basic(&value, &status); + if (g_strcmp0(status, "roaming") == 0) + roaming = TRUE; + else if (g_strcmp0(status, "registered") == 0) + roaming = FALSE; + else + return TRUE; + + connman_network_set_roaming(network, roaming); + connman_network_update(network); } return TRUE; -- 2.7.4