summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2015-11-05 12:48:32 -0600
committerDenis Kenzior <denkenz@gmail.com>2015-11-05 12:48:32 -0600
commit94ce2805458c474d30e218a97bed265f53a58b65 (patch)
tree5b831d4edfc422bb554c5004c434af79bac09ef3 /drivers
parenta0eab81cc4f0037da6355d1dacdb46c546ec217e (diff)
downloadofono-94ce2805458c474d30e218a97bed265f53a58b65.tar.bz2
rilmodem: Implement ril_ussd_notify inline
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rilmodem/ussd.c63
1 files changed, 40 insertions, 23 deletions
diff --git a/drivers/rilmodem/ussd.c b/drivers/rilmodem/ussd.c
index 04985ec7..746acac7 100644
--- a/drivers/rilmodem/ussd.c
+++ b/drivers/rilmodem/ussd.c
@@ -41,7 +41,6 @@
#include "gril.h"
#include "grilutil.h"
#include "grilrequest.h"
-#include "grilunsol.h"
#include "rilmodem.h"
@@ -169,42 +168,60 @@ 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;
+ 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;
- unsol = g_ril_unsol_parse_ussd(ud->ril, message);
- if (unsol == NULL) {
- ofono_error("%s: Parsing error", __func__);
+ 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 &&
- unsol->message != NULL && unsol->type == 2)
- unsol->type = 0;
+ 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.
*/
- if (unsol->message != NULL) {
- gsize written;
- char *ucs2;
-
- ucs2 = g_convert(unsol->message, -1, "UCS-2BE//TRANSLIT",
+ ucs2 = g_convert(str, -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_free(str);
+
+ if (ucs2 == NULL) {
+ ofono_error("%s: Error transcoding", __func__);
+ return;
}
- g_ril_unsol_free_ussd(unsol);
+ ofono_ussd_notify(ussd, type, 0x48, (unsigned char *) ucs2, written);
+ g_free(ucs2);
}
static gboolean ril_delayed_register(gpointer user_data)