return 0;
}
+static void set_apn_reply(DBusPendingCall *call, void *user_data)
+{
+ DBusMessage *reply;
+ DBusError error;
+
+ reply = dbus_pending_call_steal_reply(call);
+
+ dbus_error_init(&error);
+ if (dbus_set_error_from_message(&error, reply)) {
+ connman_error("%s", error.message);
+
+ dbus_error_free(&error);
+ }
+
+ dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
+}
+
+static void set_apn(struct connman_network *network)
+{
+ DBusMessage *message;
+ DBusPendingCall *call;
+ DBusMessageIter iter;
+ const char *apn, *path;
+
+ apn = connman_network_get_string(network, "Cellular.APN");
+ if (apn == NULL)
+ return;
+
+ path = connman_network_get_string(network, "Path");
+ if (path == NULL)
+ return;
+
+ DBG("path %s, apn %s", path, apn);
+
+ message = dbus_message_new_method_call(OFONO_SERVICE, path,
+ OFONO_PRI_CONTEXT_INTERFACE, SET_PROPERTY);
+ if (message == NULL)
+ return;
+
+ dbus_message_set_auto_start(message, FALSE);
+
+ dbus_message_iter_init_append(message, &iter);
+ connman_dbus_property_append_basic(&iter, "AccessPointName",
+ DBUS_TYPE_STRING, &apn);
+
+ if (dbus_connection_send_with_reply(connection, message,
+ &call, TIMEOUT) == FALSE) {
+ dbus_message_unref(message);
+ return;
+ }
+
+ if (call == NULL) {
+ connman_error("D-Bus connection not available");
+ dbus_message_unref(message);
+ return;
+ }
+
+ dbus_pending_call_set_notify(call, set_apn_reply, NULL, NULL);
+
+ dbus_message_unref(message);
+}
+
static int network_connect(struct connman_network *network)
{
if (connman_network_get_index(network) >= 0)
return -EISCONN;
+ set_apn(network);
+
return set_network_active(network, TRUE);
}
case CONNMAN_NETWORK_TYPE_WIMAX:
case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN:
case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN:
- case CONNMAN_NETWORK_TYPE_CELLULAR:
break;
+ case CONNMAN_NETWORK_TYPE_CELLULAR:
case CONNMAN_NETWORK_TYPE_MBM:
case CONNMAN_NETWORK_TYPE_HSO:
connman_network_set_string(service->network,