diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-12-20 16:57:27 +0100 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-12-22 11:10:15 +0100 |
commit | fdd27a0e36ae0907443bd028bc153344c5a74841 (patch) | |
tree | c0a48679a11a46d2b53b23c35daa939937a5c01a | |
parent | 61c3cc64feae21461666e860c04791e7d41644c9 (diff) | |
download | connman-fdd27a0e36ae0907443bd028bc153344c5a74841.tar.gz connman-fdd27a0e36ae0907443bd028bc153344c5a74841.tar.bz2 connman-fdd27a0e36ae0907443bd028bc153344c5a74841.zip |
ofono: Refactore IMSI update
Streamline Property handling code with the rest of the plugin.
-rw-r--r-- | plugins/ofono.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/plugins/ofono.c b/plugins/ofono.c index bf0e0fd9..ba652c39 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -1799,13 +1799,14 @@ static connman_bool_t connection_manager_init(struct modem_data *modem) return FALSE; } -static void update_sim_imsi(struct modem_data *modem, - const char *imsi) +static void sim_update_imsi(struct modem_data *modem, + DBusMessageIter* value) { - DBG("%s imsi %s", modem->path, imsi); + char *imsi; - if (g_strcmp0(modem->imsi, imsi) == 0) - return; + dbus_message_iter_get_basic(value, &imsi); + + DBG("%s imsi %s", modem->path, imsi); g_free(modem->imsi); modem->imsi = g_strdup(imsi); @@ -1835,11 +1836,7 @@ static gboolean sim_changed(DBusConnection *connection, DBusMessage *message, dbus_message_iter_recurse(&iter, &value); if (g_str_equal(key, "SubscriberIdentity") == TRUE) { - char *imsi; - - dbus_message_iter_get_basic(&value, &imsi); - - update_sim_imsi(modem, imsi); + sim_update_imsi(modem, &value); if (modem->online == FALSE) { modem_set_online(modem); @@ -1873,11 +1870,7 @@ static void sim_properties_reply(struct modem_data *modem, dbus_message_iter_recurse(&entry, &value); if (g_str_equal(key, "SubscriberIdentity") == TRUE) { - char *imsi; - - dbus_message_iter_get_basic(&value, &imsi); - - update_sim_imsi(modem, imsi); + sim_update_imsi(modem, &value); if (modem->online == FALSE) { modem_set_online(modem); |