Open Source Telephony
 help / color / mirror / Atom feed
From: Yang Gu <yang.gu@intel.com>
To: ofono@ofono.org
Subject: [PATCH 4/5] Refactor ussd parser
Date: Thu, 17 Jun 2010 18:35:10 +0800	[thread overview]
Message-ID: <1276770911-8817-4-git-send-email-yang.gu@intel.com> (raw)
In-Reply-To: <1276770911-8817-1-git-send-email-yang.gu@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1555 bytes --]

---
 drivers/isimodem/ussd.c |   35 ++++++-----------------------------
 1 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/drivers/isimodem/ussd.c b/drivers/isimodem/ussd.c
index 8be20b6..7002d09 100644
--- a/drivers/isimodem/ussd.c
+++ b/drivers/isimodem/ussd.c
@@ -73,44 +73,21 @@ static void ussd_parse(struct ofono_ussd *ussd, const void *restrict data,
 			size_t len)
 {
 	const unsigned char *msg = data;
-	unsigned char buf[256];
-	unsigned char *unpacked;
-	long written;
-	int status;
+	int status = OFONO_USSD_STATUS_NOT_SUPPORTED;
 	char *converted = NULL;
-	gboolean udhi;
-	enum sms_charset charset;
-	gboolean compressed;
-	gboolean iso639;
 
 	if (!msg || len < 4)
-		goto error;
+		goto out;
 
 	status = isi_type_to_status(msg[2]);
 
 	if (msg[3] == 0 || (size_t)(msg[3] + 4) > len)
-		goto error;
-
-	if (!cbs_dcs_decode(msg[1], &udhi, NULL, &charset,
-				&compressed, NULL, &iso639))
-		goto error;
-
-	if (udhi || compressed || iso639)
-		goto error;
-
-	if (charset != SMS_CHARSET_7BIT)
-		goto error;
-
-	unpacked = unpack_7bit_own_buf(msg + 4, msg[3], 0, TRUE,
-					SS_MAX_USSD_LENGTH, &written, 0, buf);
+		goto out;
 
-	converted = convert_gsm_to_utf8((const guint8 *)unpacked, written,
-					NULL, NULL, 0);
+	converted = ussd_decode(msg[1], msg[3], msg + 4);
 
-	goto out;
-
-error:
-	status = OFONO_USSD_STATUS_NOT_SUPPORTED;
+	if (converted)
+		status = OFONO_USSD_STATUS_NOTIFY;
 
 out:
 	ofono_ussd_notify(ussd, status, converted);
-- 
1.7.0.4


  parent reply	other threads:[~2010-06-17 10:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-17 10:35 [PATCH 1/5] stk: Add parser for send ussd commands Yang Gu
2010-06-17 10:35 ` [PATCH 2/5] teststk: Add test for send ussd parser Yang Gu
2010-06-17 10:35 ` [PATCH 3/5] Modify " Yang Gu
2010-06-17 10:35 ` Yang Gu [this message]
2010-06-21 14:18   ` [PATCH 4/5] Refactor " Denis Kenzior
2010-06-17 10:35 ` [PATCH 5/5] stk: Add parser for timing advance objects Yang Gu
2010-06-18 19:04 ` [PATCH 1/5] stk: Add parser for send ussd commands Denis Kenzior
2010-06-20 13:52   ` Gu, Yang
2010-06-20 16:26     ` Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1276770911-8817-4-git-send-email-yang.gu@intel.com \
    --to=yang.gu@intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox