Exemplo n.º 1
0
static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
{
    DBusConnection *conn = ofono_dbus_get_connection();
    struct dundee_device *device = user_data;

    DBG("%p", device);
    DBG("PPP Link down: %d\n", reason);

    g_at_ppp_unref(device->ppp);
    device->ppp = NULL;

    g_at_chat_resume(device->chat);

    g_free(device->settings.interface);
    g_free(device->settings.ip);
    g_strfreev(device->settings.nameservers);
    device->settings.interface = NULL;
    device->settings.ip = NULL;
    device->settings.nameservers = NULL;

    device->active = FALSE;

    settings_changed(device);
    ofono_dbus_signal_property_changed(conn, device->path,
                                       DUNDEE_DEVICE_INTERFACE, "Active",
                                       DBUS_TYPE_BOOLEAN, &device->active);

    device->driver->disconnect(device, disconnect_callback, device);
}
Exemplo n.º 2
0
static gboolean setup_ppp(struct ofono_gprs_context *gc)
{
	struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
	GAtIO *io;

	io = g_at_chat_get_io(gcd->chat);

	g_at_chat_suspend(gcd->chat);

	/* open ppp */
	gcd->ppp = g_at_ppp_new_from_io(io);

	if (gcd->ppp == NULL) {
		g_at_chat_resume(gcd->chat);
		return FALSE;
	}

	g_at_ppp_set_credentials(gcd->ppp, gcd->username, gcd->password);

	/* set connect and disconnect callbacks */
	g_at_ppp_set_connect_function(gcd->ppp, ppp_connect, gc);
	g_at_ppp_set_disconnect_function(gcd->ppp, ppp_disconnect, gc);

	/* open the ppp connection */
	g_at_ppp_open(gcd->ppp);

	return TRUE;
}
Exemplo n.º 3
0
static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
{
	struct ofono_gprs_context *gc = user_data;
	struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);

	DBG("");

	g_at_ppp_unref(gcd->ppp);
	gcd->ppp = NULL;

	switch (gcd->state) {
	case STATE_ENABLING:
		CALLBACK_WITH_FAILURE(gcd->up_cb, NULL, FALSE, NULL,
					NULL, NULL, NULL, gcd->cb_data);
		break;
	case STATE_DISABLING:
		CALLBACK_WITH_SUCCESS(gcd->down_cb, gcd->cb_data);
		break;
	default:
		ofono_gprs_context_deactivated(gc, gcd->active_context);
		break;
	}

	gcd->active_context = 0;
	gcd->state = STATE_IDLE;
	/*
	 * If the channel of gcd->chat is NULL, it might cause
	 * gprs_context_remove get called and the gprs context will be
	 * removed.
	 */
	g_at_chat_resume(gcd->chat);
}
Exemplo n.º 4
0
static gboolean setup_ppp(struct ofono_gprs_context *gc)
{
	struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
	GAtIO *io;

	DBG("");

	io = g_at_chat_get_io(gcd->chat);

	g_at_chat_suspend(gcd->chat);

	/* open ppp */
	gcd->ppp = g_at_ppp_new();

	if (gcd->ppp == NULL) {
		g_at_chat_resume(gcd->chat);
		return FALSE;
	}

	if (getenv("OFONO_PPP_DEBUG"))
		g_at_ppp_set_debug(gcd->ppp, ppp_debug, "PPP");

	g_at_ppp_set_auth_method(gcd->ppp, gcd->auth_method);
	g_at_ppp_set_credentials(gcd->ppp, gcd->username, gcd->password);

	/* set connect and disconnect callbacks */
	g_at_ppp_set_connect_function(gcd->ppp, ppp_connect, gc);
	g_at_ppp_set_disconnect_function(gcd->ppp, ppp_disconnect, gc);

	/* open the ppp connection */
	g_at_ppp_open(gcd->ppp, io);

	return TRUE;
}
Exemplo n.º 5
0
static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
{
	struct ofono_cdma_connman *cm = user_data;
	struct connman_data *cd = ofono_cdma_connman_get_data(cm);

	DBG("");

	g_at_ppp_unref(cd->ppp);
	cd->ppp = NULL;

	switch (cd->state) {
	case STATE_ENABLING:
		CALLBACK_WITH_FAILURE(cd->up_cb, NULL, FALSE, NULL,
					NULL, NULL, NULL, cd->cb_data);
		break;
	case STATE_DISABLING:
		CALLBACK_WITH_SUCCESS(cd->down_cb, cd->cb_data);
		break;
	default:
		/* TODO: Handle network initiated disconnection */
		break;
	}

	cd->state = STATE_IDLE;
	g_at_chat_resume(cd->chat);
}
Exemplo n.º 6
0
static gboolean setup_ppp(struct ofono_cdma_connman *cm)
{
	struct connman_data *cd = ofono_cdma_connman_get_data(cm);
	GAtIO *io;

	DBG("");

	io = g_at_chat_get_io(cd->chat);

	g_at_chat_suspend(cd->chat);

	/* open ppp */
	cd->ppp = g_at_ppp_new();

	if (cd->ppp == NULL) {
		g_at_chat_resume(cd->chat);
		return FALSE;
	}

	if (getenv("OFONO_PPP_DEBUG"))
		g_at_ppp_set_debug(cd->ppp, ppp_debug, "PPP");

	/* set connect and disconnect callbacks */
	g_at_ppp_set_connect_function(cd->ppp, ppp_connect, cm);
	g_at_ppp_set_disconnect_function(cd->ppp, ppp_disconnect, cm);

	/* open the ppp connection */
	g_at_ppp_open(cd->ppp, io);

	return TRUE;
}
Exemplo n.º 7
0
static void at_gprs_context_remove(struct ofono_gprs_context *gc)
{
	struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);

	DBG("");

	if (gcd->state != STATE_IDLE && gcd->ppp) {
		g_at_ppp_unref(gcd->ppp);
		g_at_chat_resume(gcd->chat);
	}

	ofono_gprs_context_set_data(gc, NULL);
	g_free(gcd);
}
Exemplo n.º 8
0
static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
{
	g_print("PPP Link down: %d\n", reason);

	g_at_ppp_unref(ppp);
	ppp = NULL;

	if (option_modem == NULL)
		g_at_chat_set_debug(modem, gsmdial_debug, "");
	else
		g_at_chat_set_debug(modem, gsmdial_debug, "Modem");

	g_at_chat_register(modem, "NO CARRIER", no_carrier_notify,
					FALSE, NULL, NULL);
	g_at_chat_resume(modem);
}
Exemplo n.º 9
0
static void cdma_connman_remove(struct ofono_cdma_connman *cm)
{
	struct connman_data *cd = ofono_cdma_connman_get_data(cm);

	DBG("");

	if (cd->state != STATE_IDLE && cd->ppp) {
		g_at_ppp_unref(cd->ppp);
		g_at_chat_resume(cd->chat);
	}

	ofono_cdma_connman_set_data(cm, NULL);

	g_at_chat_unref(cd->chat);
	g_free(cd);
}
Exemplo n.º 10
0
static void ppp_suspend_ato0(gpointer user_data)
{
	g_at_chat_resume(modem);
	g_at_chat_send(modem, "ATO0", none_prefix, resume_ppp, NULL, NULL);
}