コード例 #1
0
ファイル: sim-legacy.c プロジェクト: intgr/ofono
static void event_notify(struct qmi_result *result, void *user_data)
{
	struct ofono_sim *sim = user_data;
	uint8_t state;

	DBG("");

	if (qmi_result_get_uint8(result, QMI_DMS_NOTIFY_UIM_STATE, &state))
		process_uim_state(sim, state);
}
コード例 #2
0
ファイル: sim-legacy.c プロジェクト: intgr/ofono
static void get_uim_state(struct qmi_result *result, void *user_data)
{
	struct ofono_sim *sim = user_data;
	uint8_t state;

	DBG("");

	if (qmi_result_set_error(result, NULL))
		goto done;

	if (qmi_result_get_uint8(result, QMI_DMS_RESULT_UIM_STATE, &state))
		process_uim_state(sim, state);

done:
	ofono_sim_register(sim);
}
コード例 #3
0
ファイル: network-registration.c プロジェクト: endocode/ofono
static bool extract_ss_info(struct qmi_result *result, int *status,
				int *lac, int *cellid, int *tech,
				struct ofono_network_operator *operator)
{
	const struct qmi_nas_serving_system *ss;
	const struct qmi_nas_current_plmn *plmn;
	uint8_t i, roaming;
	uint16_t value16, len, opname_len;
	uint32_t value32;

	DBG("");

	ss = qmi_result_get(result, QMI_NAS_RESULT_SERVING_SYSTEM, &len);
	if (!ss)
		return false;

	*status = ss->status;

	DBG("serving system status %d", ss->status);

	*tech = -1;

	for (i = 0; i < ss->radio_if_count; i++) {
		DBG("radio in use %d", ss->radio_if[i]);

		*tech = qmi_nas_rat_to_tech(ss->radio_if[i]);
	}

	if (qmi_result_get_uint8(result, QMI_NAS_RESULT_ROAMING_STATUS,
								&roaming)) {
		if (ss->status == 1 && roaming == 0)
			*status = NETWORK_REGISTRATION_STATUS_ROAMING;
	}

	if (!operator)
		return true;

	plmn = qmi_result_get(result, QMI_NAS_RESULT_CURRENT_PLMN, &len);
	if (plmn) {
		snprintf(operator->mcc, OFONO_MAX_MCC_LENGTH + 1, "%03d",
						GUINT16_FROM_LE(plmn->mcc));
		snprintf(operator->mnc, OFONO_MAX_MNC_LENGTH + 1, "%02d",
						GUINT16_FROM_LE(plmn->mnc));
		opname_len = plmn->desc_len;
		if (opname_len > OFONO_MAX_OPERATOR_NAME_LENGTH)
			opname_len = OFONO_MAX_OPERATOR_NAME_LENGTH;

		/*
		 * Telit QMI modems can return non-utf-8 characters in
		 * plmn-desc. When that happens, libdbus will abort ofono.
		 * If non-utf-8 characters are detected, use mccmnc string.
		 */
		if (g_utf8_validate(plmn->desc, opname_len, NULL)) {
			strncpy(operator->name, plmn->desc, opname_len);
			operator->name[opname_len] = '\0';
		} else
			snprintf(operator->name, OFONO_MAX_OPERATOR_NAME_LENGTH,
					"%s%s",	operator->mcc, operator->mnc);

		DBG("%s (%s:%s)", operator->name, operator->mcc, operator->mnc);
	}

	if (qmi_result_get_uint16(result, QMI_NAS_RESULT_LOCATION_AREA_CODE,
								&value16))
		*lac = value16;
	else
		*lac = -1;

	if (qmi_result_get_uint32(result, QMI_NAS_RESULT_CELL_ID, &value32))
		*cellid = value32;
	else
		*cellid = -1;

	DBG("lac %d cellid %d tech %d", *lac, *cellid, *tech);

	return true;
}