Exemplo n.º 1
0
static void cgreg_notify(GAtResult *result, gpointer user_data)
{
	struct ofono_gprs *gprs = user_data;
	int status;
	struct gprs_data *gd = ofono_gprs_get_data(gprs);

	if (at_util_parse_reg_unsolicited(result, "+CGREG:", &status,
				NULL, NULL, NULL, gd->vendor) == FALSE)
		return;

	/*
	 * Telit AT modem firmware (tested with UE910-EUR) generates
	 * +CGREG: 0\r\n\r\n+CGEV: NW DETACH
	 * after a context is de-activated and ppp connection closed.
	 * Then, after a random amount of time (observed from a few seconds
	 * to a few hours), an unsolicited +CGREG: 1 arrives.
	 * Attempt to fix the problem, by sending AT+CGATT=1 once.
	 * This does not re-activate the context, but if a network connection
	 * is still correct, will generate an immediate +CGREG: 1.
	 */
	if (gd->vendor == OFONO_VENDOR_TELIT) {
		if (gd->attached && !status && !gd->telit_try_reattach) {
			DBG("Trying to re-attach gprs network");
			gd->telit_try_reattach = TRUE;
			g_at_chat_send(gd->chat, "AT+CGATT=1", none_prefix,
					NULL, NULL, NULL);
			return;
		}

		gd->telit_try_reattach = FALSE;
	}

	ofono_gprs_status_notify(gprs, status);
}
Exemplo n.º 2
0
Arquivo: gprs.c Projeto: yongsu/oFono
static void cgreg_notify(GAtResult *result, gpointer user_data)
{
	struct ofono_gprs *gprs = user_data;
	int status;
	struct gprs_data *gd = ofono_gprs_get_data(gprs);

	if (at_util_parse_reg_unsolicited(result, "+CGREG:", &status,
				NULL, NULL, NULL, gd->vendor) == FALSE)
		return;

	ofono_gprs_status_notify(gprs, status);
}
Exemplo n.º 3
0
static void creg_notify(GAtResult *result, gpointer user_data)
{
	struct ofono_netreg *netreg = user_data;
	int status, lac, ci, tech;
	struct netreg_data *nd = ofono_netreg_get_data(netreg);
	struct tech_query *tq;

	if (at_util_parse_reg_unsolicited(result, "+CREG:", &status,
				&lac, &ci, &tech, nd->vendor) == FALSE)
		return;

	if (status != 1 && status != 5)
		goto notify;

	tq = g_try_new0(struct tech_query, 1);
	if (tq == NULL)
		goto notify;

	tq->status = status;
	tq->lac = lac;
	tq->ci = ci;
	tq->netreg = netreg;

	switch (nd->vendor) {
	case OFONO_VENDOR_GOBI:
		if (g_at_chat_send(nd->chat, "AT*CNTI=0", none_prefix,
					cnti_query_tech_cb, tq, g_free) > 0)
			return;
		break;
	case OFONO_VENDOR_NOVATEL:
		if (g_at_chat_send(nd->chat, "AT$CNTI=0", none_prefix,
					cnti_query_tech_cb, tq, g_free) > 0)
			return;
		break;
	case OFONO_VENDOR_OPTION_HSO:
		if (g_at_chat_send(nd->chat, "AT_OCTI?;_OUWCTI?",
					option_tech_prefix,
					option_query_tech_cb, tq, g_free) > 0)
			return;
		break;
	}

	g_free(tq);

	if ((status == 1 || status == 5) && tech == -1)
		tech = nd->tech;

notify:
	ofono_netreg_status_notify(netreg, status, lac, ci, tech);
}
Exemplo n.º 4
0
static void creg_notify(GAtResult *result, gpointer user_data)
{
	int status, lac, ci, tech;

	if (state != STATE_REGISTERING)
		return;

	if (at_util_parse_reg_unsolicited(result, "+CREG:", &status,
						&lac, &ci, &tech) == FALSE)
		return;

	if (status != 1 && status != 5)
		return;

	activate_gprs(status);
}
Exemplo n.º 5
0
static void cgreg_notify(GAtResult *result, gpointer user_data)
{
	int status, lac, ci, tech;

	if (state != STATE_ATTACHING)
		return;

	if (at_util_parse_reg_unsolicited(result, "+CGREG:", &status,
						&lac, &ci, &tech) == FALSE)
		return;

	if (status != 1 && status != 5)
		return;

	setup_context(status);
}