Esempio n. 1
0
static void ril_ussd_notify(struct ril_msg *message, gpointer user_data)
{
	struct ofono_ussd *ussd = user_data;
	struct ussd_data *ud = ofono_ussd_get_data(ussd);
	struct unsol_ussd *unsol;

	unsol = g_ril_unsol_parse_ussd(ud->ril, message);
	if (unsol == NULL) {
		ofono_error("%s: Parsing error", __func__);
		return;
	}

	/*
	 * TODO
	 *
	 * With data coding scheme 0x44, we are saying that the ussd string is
	 * 8-bit data, uncompressed, and with unspecified message class. This
	 * must be changed in the future so we get the UTF16 from the RIL parcel
	 * and decode it properly. For the DCS coding, see 3gpp 23.038, sect. 5.
	 */
	if (unsol->message != NULL)
		ofono_ussd_notify(ussd, unsol->type, 0x44,
					(const unsigned char *) unsol->message,
					strlen(unsol->message));
	else
		ofono_ussd_notify(ussd, unsol->type, 0, NULL, 0);

	g_ril_unsol_free_ussd(unsol);
}
Esempio n. 2
0
static void ril_ussd_notify(struct ril_msg *message, gpointer user_data)
{
	struct ofono_ussd *ussd = user_data;
	struct ussd_data *ud = ofono_ussd_get_data(ussd);
	struct parcel rilp;
	int numstr;
	char *typestr;
	int type;
	char *str = NULL;
	gsize written;
	char *ucs2;

	g_ril_init_parcel(message, &rilp);

	numstr = parcel_r_int32(&rilp);
	if (numstr < 1)
		return;

	typestr = parcel_r_string(&rilp);
	if (typestr == NULL || *typestr == '\0')
		return;

	type = *typestr - '0';
	g_free(typestr);

	if (numstr > 1)
		str = parcel_r_string(&rilp);

	g_ril_append_print_buf(ud->ril, "{%d,%s}", type, str);

	g_ril_print_unsol(ud->ril, message);

	/* To fix bug in MTK: USSD-Notify arrive with type 2 instead of 0 */
	if (g_ril_vendor(ud->ril) == OFONO_RIL_VENDOR_MTK &&
			str != NULL && type == 2)
		type = 0;

	if (str == NULL) {
		ofono_ussd_notify(ussd, type, 0, NULL, 0);
		return;
	}

	/*
	 * With data coding scheme 0x48, we are saying that the ussd string is a
	 * UCS-2 string, uncompressed, and with unspecified message class. For
	 * the DCS coding, see 3gpp 23.038, sect. 5.
	 */
	ucs2 = g_convert(str, -1, "UCS-2BE//TRANSLIT",
					"UTF-8", NULL, &written, NULL);
	g_free(str);

	if (ucs2 == NULL) {
		ofono_error("%s: Error transcoding", __func__);
		return;
	}

	ofono_ussd_notify(ussd, type, 0x48, (unsigned char *) ucs2, written);
	g_free(ucs2);
}
Esempio n. 3
0
static void ril_ussd_notify(struct ril_msg *message, gpointer user_data)
{
	struct ofono_ussd *ussd = user_data;
	struct ussd_data *ud = ofono_ussd_get_data(ussd);
	struct unsol_ussd *unsol;
	enum ofono_ril_vendor vendor;

	unsol = g_ril_unsol_parse_ussd(ud->ril, message);
	if (unsol == NULL) {
		ofono_error("%s: Parsing error", __func__);
		return;
	}

	/* To fix bug in MTK: USSD-Notify arrive with type 2 instead of 0 */
	vendor = g_ril_vendor(ud->ril);
	if ((vendor == OFONO_RIL_VENDOR_MTK ||
				vendor == OFONO_RIL_VENDOR_MTK2)
			&& unsol->message != NULL && unsol->type == 2)
		unsol->type = 0;

	/*
	 * With data coding scheme 0x48, we are saying that the ussd string is a
	 * UCS-2 string, uncompressed, and with unspecified message class. For
	 * the DCS coding, see 3gpp 23.038, sect. 5.
	 */
	if (unsol->message != NULL) {
		gsize written;
		char *ucs2;

		ucs2 = g_convert(unsol->message, -1, "UCS-2BE//TRANSLIT",
					"UTF-8", NULL, &written, NULL);
		if (ucs2 != NULL) {
			ofono_ussd_notify(ussd, unsol->type, 0x48,
					(unsigned char *) ucs2, written);
			g_free(ucs2);
		} else {
			ofono_error("%s: Error transcoding", __func__);
		}
	} else {
		ofono_ussd_notify(ussd, unsol->type, 0, NULL, 0);
	}

	g_ril_unsol_free_ussd(unsol);
}
Esempio n. 4
0
static void ril_ussd_notify(struct ril_msg *message, gpointer user_data)
{
	struct ofono_ussd *ussd = user_data;
	struct parcel rilp;
	gchar *ussd_from_network;
	gchar *type;
	gint ussdtype;

	ril_util_init_parcel(message, &rilp);
	parcel_r_int32(&rilp);
	type = parcel_r_string(&rilp);
	ussdtype = g_ascii_xdigit_value(*type);
	ussd_from_network = parcel_r_string(&rilp);

	if (ussd_from_network)
		ofono_ussd_notify(ussd, ussdtype, 0xFF,
			(const unsigned char *)ussd_from_network,
			strlen(ussd_from_network));
	else
		ofono_ussd_notify(ussd, ussdtype, 0, NULL, 0);

	return;
}
Esempio n. 5
0
static void ril_ussd_cb(struct ril_msg *message, gpointer user_data)
{
	struct ofono_ussd *ussd = user_data;
	struct ussd_data *ud = ofono_ussd_get_data(ussd);

	/*
	 * We fake an ON_USSD event if there was an error sending the request,
	 * as core will be waiting for one to respond to the Initiate() call.
	 * Note that we already made the callback (see ril_ussd_request()).
	 */
	if (message->error == RIL_E_SUCCESS)
		g_ril_print_response_no_args(ud->ril, message);
	else
		ofono_ussd_notify(ussd, OFONO_USSD_STATUS_NOT_SUPPORTED,
					0, NULL, 0);
}