--- plugins/ofono.c | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/plugins/ofono.c b/plugins/ofono.c index 43872ff..899d3e6 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -456,7 +456,7 @@ static void set_apn(struct connman_network *network) { const char *apn, *path; - apn = connman_network_get_string(network, "Cellular.APN"); + apn = connman_network_get_apn(network); if (apn == NULL) return; @@ -549,7 +549,7 @@ static int add_network(struct connman_device *device, { struct modem_data *modem = connman_device_get_data(device); struct connman_network *network; - char *ident; + char *ident, *apn = NULL; const char *hash_path; char const *operator; dbus_bool_t active = FALSE; @@ -615,13 +615,9 @@ static int add_network(struct connman_device *device, DBG("path %p type %s", path, type); goto error; } - } else if (g_str_equal(key, "AccessPointName")) { - const char *ap; - - dbus_message_iter_get_basic(&value, &ap); - - connman_network_set_string(network, "Cellular.APN", ap); - } else if (g_str_equal(key, "Settings")) + } else if (g_str_equal(key, "AccessPointName")) + dbus_message_iter_get_basic(&value, &apn); + else if (g_str_equal(key, "Settings")) update_settings(&value, network); else if (g_str_equal(key, "Active") == TRUE) dbus_message_iter_get_basic(&value, &active); @@ -632,6 +628,9 @@ static int add_network(struct connman_device *device, if (connman_device_add_network(device, network) != 0) goto error; + if (apn != NULL) + connman_network_set_apn(network, apn); + if (active) set_connected(network, active); @@ -1735,7 +1734,7 @@ static gboolean context_changed(DBusConnection *connection, const char *path = dbus_message_get_path(message); struct connman_network *network; DBusMessageIter iter, value; - const char *key; + const char *key, *apn; DBG("path %s", path); @@ -1756,7 +1755,10 @@ static gboolean context_changed(DBusConnection *connection, dbus_message_iter_next(&iter); dbus_message_iter_recurse(&iter, &value); - if (g_str_equal(key, "Settings") == TRUE) + if (g_str_equal(key, "AccessPointName")) { + dbus_message_iter_get_basic(&value, &apn); + connman_network_set_apn(network, apn); + } else if (g_str_equal(key, "Settings") == TRUE) update_settings(&value, network); else if (g_str_equal(key, "Active") == TRUE) { dbus_bool_t active; -- 1.7.0.4 _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman