コード例 #1
0
ファイル: ril_call_settings.c プロジェクト: CODeRUS/ofono
static void ril_call_settings_cw_query_cb(GRilIoChannel *io, int status,
				const void *data, guint len, void *user_data)
{
	struct ofono_error error;
	struct ril_call_settings_cbd *cbd = user_data;
	ofono_call_settings_status_cb_t cb = cbd->cb.status;

	if (status == RIL_E_SUCCESS) {
		GRilIoParser rilp;
		int res = 0;
		int sv = 0;

		grilio_parser_init(&rilp, data, len);

		/* first value in int[] is len so let's skip that */
		grilio_parser_get_int32(&rilp, NULL);

		/* status of call waiting service, disabled is returned only if
		 * service is not active for any service class */
		grilio_parser_get_int32(&rilp, &res);
		DBG("CW enabled/disabled: %d", res);

		if (res > 0) {
			/* services for which call waiting is enabled,
			   27.007 7.12 */
			grilio_parser_get_int32(&rilp, &sv);
			DBG("CW enabled for: %d", sv);
		}

		cb(ril_error_ok(&error), sv, cbd->data);
	} else {
		cb(ril_error_failure(&error), -1, cbd->data);
	}
}
コード例 #2
0
ファイル: ril_sms.c プロジェクト: Herrie82/ofono-fix2
static void ril_sms_on_sim(GRilIoChannel *io, guint ril_event,
			const void *data, guint len, void *user_data)
{
	struct ril_sms *sd = user_data;
	struct ofono_sim *sim = ril_modem_ofono_sim(sd->modem);
	int data_len = 0, rec = 0;
	GRilIoParser rilp;

	ofono_info("new sms on sim");
	grilio_parser_init(&rilp, data, len);
	if (sim &&
		grilio_parser_get_int32(&rilp, &data_len) && data_len > 0 &&
		grilio_parser_get_int32(&rilp, &rec)) {
		DBG("rec %d", rec);
		if (sd->sim_context) {
			ofono_sim_read_record(sd->sim_context,
					SIM_EFSMS_FILEID,
					OFONO_SIM_FILE_STRUCTURE_FIXED,
					rec, EFSMS_LENGTH,
					sim_path, sizeof(sim_path),
					ril_sms_on_sim_cb,
					ril_sms_on_sim_req_new(sd,rec));
		}
	}
}
コード例 #3
0
ファイル: ril_sms.c プロジェクト: Herrie82/ofono-fix2
static void ril_sms_submit_cb(GRilIoChannel *io, int status,
				const void *data, guint len, void *user_data)
{
	struct ril_sms_cbd *cbd = user_data;
	ofono_sms_submit_cb_t cb = cbd->cb.submit;
	struct ofono_error error;
	int mr = 0;

	if (status == RIL_E_SUCCESS) {
		GRilIoParser rilp;
		int err = -1;

		grilio_parser_init(&rilp, data, len);

		/* TP-Message-Reference for GSM/
		 * BearerData MessageId for CDMA
		 */
		grilio_parser_get_int32(&rilp, &mr);
		grilio_parser_skip_string(&rilp);

		/* error: 3GPP 27.005, 3.2.5, -1 if unknown or not applicable */
		grilio_parser_get_int32(&rilp, &err);
		DBG("sms msg ref: %d, error: %d", mr, err);
		ril_error_init_ok(&error);
	} else if (status == RIL_E_GENERIC_FAILURE) {
		ofono_info("not allowed by MO SMS control, do not retry");
		error.type = OFONO_ERROR_TYPE_CMS;
		error.error = 500;
	} else {
		ofono_error("sms sending failed, retry");
		ril_error_init_failure(&error);
	}

	cb(&error, mr, cbd->data);
}
コード例 #4
0
ファイル: ril_radio_settings.c プロジェクト: CODeRUS/ofono
static void ril_radio_settings_query_rat_mode_cb(GRilIoChannel *io, int status,
				const void *data, guint len, void *user_data)
{
	struct ofono_error error;
	struct ril_radio_settings_cbd *cbd = user_data;
	ofono_radio_settings_rat_mode_query_cb_t cb = cbd->cb.rat_mode_query;

	DBG("");
	if (status == RIL_E_SUCCESS) {
		GRilIoParser rilp;
		int mode = OFONO_RADIO_ACCESS_MODE_ANY;
		int pref = -1;

		grilio_parser_init(&rilp, data, len);
		grilio_parser_get_int32(&rilp, NULL);
		grilio_parser_get_int32(&rilp, &pref);

		switch (pref) {
		case PREF_NET_TYPE_LTE_ONLY:
			mode = OFONO_RADIO_ACCESS_MODE_LTE;
		case PREF_NET_TYPE_GSM_ONLY:
			mode = OFONO_RADIO_ACCESS_MODE_GSM;
			break;
		case PREF_NET_TYPE_GSM_WCDMA_AUTO:/* according to UI design */
			if (!cb) {
				ril_radio_settings_force_rat(cbd->rsd, pref);
			}
		case PREF_NET_TYPE_WCDMA:
		case PREF_NET_TYPE_GSM_WCDMA: /* according to UI design */
			mode = OFONO_RADIO_ACCESS_MODE_UMTS;
			break;
		case PREF_NET_TYPE_LTE_CDMA_EVDO:
		case PREF_NET_TYPE_LTE_GSM_WCDMA:
		case PREF_NET_TYPE_LTE_CMDA_EVDO_GSM_WCDMA:
			if (!cb) {
				ril_radio_settings_force_rat(cbd->rsd, pref);
			}
			break;
		case PREF_NET_TYPE_CDMA_EVDO_AUTO:
		case PREF_NET_TYPE_CDMA_ONLY:
		case PREF_NET_TYPE_EVDO_ONLY:
		case PREF_NET_TYPE_GSM_WCDMA_CDMA_EVDO_AUTO:
		default:
			break;
		}

		ofono_info("rat mode %d (ril %d)", mode, pref);
		if (cb) {
			cb(ril_error_ok(&error), mode, cbd->data);
		}
	} else {
		ofono_error("rat mode query failed");
		if (cb) {
			cb(ril_error_failure(&error), -1, cbd->data);
		}
	}
}
コード例 #5
0
ファイル: ril_call_settings.c プロジェクト: CODeRUS/ofono
static void ril_call_settings_clip_query_cb(GRilIoChannel *io, int status,
				const void *data, guint len, void *user_data)
{
	struct ofono_error error;
	struct ril_call_settings_cbd *cbd = user_data;
	ofono_call_settings_status_cb_t cb = cbd->cb.status;

	if (status == RIL_E_SUCCESS) {
		GRilIoParser rilp;
		int res = 0;

		/* data length of the response */
		grilio_parser_init(&rilp, data, len);
		if (grilio_parser_get_int32(&rilp, &res) && res > 0) {
			grilio_parser_get_int32(&rilp, &res);
		}

		cb(ril_error_ok(&error), res, cbd->data);
	} else {
		cb(ril_error_failure(&error), -1, cbd->data);
	}
}
コード例 #6
0
ファイル: ril_call_settings.c プロジェクト: CODeRUS/ofono
static void ril_call_settings_clir_cb(GRilIoChannel *io, int status,
				const void *data, guint len, void *user_data)
{
	struct ofono_error error;
	struct ril_call_settings_cbd *cbd = user_data;
	ofono_call_settings_clir_cb_t cb = cbd->cb.clir;

	if (status == RIL_E_SUCCESS) {
		GRilIoParser rilp;
		int override = -1, network = -1;

		grilio_parser_init(&rilp, data, len);
		/*first value in int[] is len so let's skip that*/
		grilio_parser_get_int32(&rilp, NULL);
		/* Set HideCallerId property from network */
		grilio_parser_get_int32(&rilp, &override);
		/* CallingLineRestriction indicates the state of
		the CLIR supplementary service in the network */
		grilio_parser_get_int32(&rilp, &network);

		cb(ril_error_ok(&error), override, network, cbd->data);
	} else {
コード例 #7
0
ファイル: ril_util.c プロジェクト: CODeRUS/ofono
gboolean ril_util_parse_reg(const void *data, guint len,
						struct ril_reg_data *reg)
{
	GRilIoParser rilp;
	int nparams;
	gchar *sstatus = NULL, *slac = NULL, *sci = NULL;
	gchar *stech = NULL, *sreason = NULL, *smax = NULL;

	memset(reg, 0, sizeof(*reg));

	/* Size of response string array
	 *
	 * Should be:
	 *   >= 4 for VOICE_REG reply
	 *   >= 5 for DATA_REG reply
	 */
	grilio_parser_init(&rilp, data, len);
	if (!grilio_parser_get_int32(&rilp, &nparams) || nparams < 4) {
		DBG("broken response");
		return FALSE;
	}

	sstatus = grilio_parser_get_utf8(&rilp);
	if (!sstatus) {
		DBG("No sstatus value returned!");
		return FALSE;
	}

	slac = grilio_parser_get_utf8(&rilp);
	sci = grilio_parser_get_utf8(&rilp);
	stech = grilio_parser_get_utf8(&rilp);
	nparams -= 4;

	reg->ril_status = atoi(sstatus);
	if (reg->ril_status > 10) {
		reg->status = reg->ril_status - 10;
	} else {
		reg->status = reg->ril_status;
	}

	/* FIXME: need to review VOICE_REGISTRATION response
	 * as it returns ~15 parameters ( vs. 6 for DATA ).
	 *
	 * The first four parameters are the same for both
	 * responses ( although status includes values for
	 * emergency calls for VOICE response ).
	 *
	 * Parameters 5 & 6 have different meanings for
	 * voice & data response.
	 */
	if (nparams--) {
		/* TODO: different use for CDMA */
		sreason = grilio_parser_get_utf8(&rilp);
		if (nparams--) {
			/* TODO: different use for CDMA */
			smax = grilio_parser_get_utf8(&rilp);
			if (smax) {
				reg->max_calls = atoi(smax);
			}
		}
	}

	reg->lac = slac ? strtol(slac, NULL, 16) : -1;
	reg->ci = sci ? strtol(sci, NULL, 16) : -1;
	reg->access_tech = ril_parse_tech(stech, &reg->ril_tech);

	DBG("%s,%s,%s,%d,%s,%s,%s", registration_status_to_string(reg->status),
			slac, sci, reg->ril_tech,
			registration_tech_to_string(reg->access_tech),
			sreason, smax);

	g_free(sstatus);
	g_free(slac);
	g_free(sci);
	g_free(stech);
	g_free(sreason);
	g_free(smax);
	return TRUE;
}