From: Yang Gu <yang.gu@intel.com>
To: ofono@ofono.org
Subject: [PATCH 05/12] Modify ussd parser
Date: Sun, 13 Jun 2010 17:43:15 +0800 [thread overview]
Message-ID: <1276422202-16240-5-git-send-email-yang.gu@intel.com> (raw)
In-Reply-To: <1276422202-16240-1-git-send-email-yang.gu@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2257 bytes --]
* Original code doesn't call unpack_7bit(), which seems not correct.
* An utility function is used to handle it, which supports 8-bit
and ucs2 besides 7-bit character.
* Status is assigned with correct value when error occurs
---
drivers/atmodem/ussd.c | 33 ++++++---------------------------
1 files changed, 6 insertions(+), 27 deletions(-)
diff --git a/drivers/atmodem/ussd.c b/drivers/atmodem/ussd.c
index 555ce13..2b006eb 100644
--- a/drivers/atmodem/ussd.c
+++ b/drivers/atmodem/ussd.c
@@ -40,6 +40,7 @@
#include "gatresult.h"
#include "atmodem.h"
+#include "ussdutil.h"
struct cusd_req {
ofono_ussd_cb_t cb;
@@ -53,14 +54,10 @@ static const char *none_prefix[] = { NULL };
static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd)
{
GAtResultIter iter;
- int status;
int dcs;
const char *content;
+ int status = OFONO_USSD_STATUS_NOT_SUPPORTED;
char *converted = NULL;
- gboolean udhi;
- enum sms_charset charset;
- gboolean compressed;
- gboolean iso639;
g_at_result_iter_init(&iter, result);
@@ -76,32 +73,14 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd)
if (!g_at_result_iter_next_number(&iter, &dcs))
goto out;
- if (!cbs_dcs_decode(dcs, &udhi, NULL, &charset,
- &compressed, NULL, &iso639))
- goto out;
-
- if (udhi || compressed || iso639)
- goto out;
+ converted = ussd_decode(dcs, strlen(content), (unsigned char *)content);
- if (charset == SMS_CHARSET_7BIT)
- converted = convert_gsm_to_utf8((const guint8 *) content,
- strlen(content), NULL, NULL, 0);
-
- else if (charset == SMS_CHARSET_8BIT) {
- /* TODO: Figure out what to do with 8 bit data */
- ofono_error("8-bit coded USSD response received");
- status = 4; /* Not supported */
- } else {
- /* No other encoding is mentioned in TS27007 7.15 */
- ofono_error("Unsupported USSD data coding scheme (%02x)", dcs);
- status = 4; /* Not supported */
- }
+ if (converted)
+ status = OFONO_USSD_STATUS_NOTIFY;
out:
ofono_ussd_notify(ussd, status, converted);
-
- if (converted)
- g_free(converted);
+ g_free(converted);
}
static void cusd_request_cb(gboolean ok, GAtResult *result, gpointer user_data)
--
1.7.0.4
next prev parent reply other threads:[~2010-06-13 9:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-13 9:43 [PATCH 01/12] stk: Add parser for send ss commands Yang Gu
2010-06-13 9:43 ` [PATCH 02/12] teststk: Add test for send ss parser Yang Gu
2010-06-13 9:43 ` [PATCH 03/12] stk: Add parser for send ussd commands Yang Gu
2010-06-16 22:44 ` Denis Kenzior
2010-06-13 9:43 ` [PATCH 04/12] teststk: Add test for send ussd parser Yang Gu
2010-06-13 9:43 ` Yang Gu [this message]
2010-06-16 22:48 ` [PATCH 05/12] Modify " Denis Kenzior
2010-06-17 10:33 ` Gu, Yang
2010-06-17 9:35 ` Denis Kenzior
2010-06-13 9:43 ` [PATCH 06/12] Refactor " Yang Gu
2010-06-16 22:49 ` Denis Kenzior
2010-06-21 14:09 ` Aki Niemi
2010-06-21 14:08 ` Aki Niemi
2010-06-13 9:43 ` [PATCH 07/12] Add several proactive command parsers Yang Gu
2010-06-13 9:43 ` [PATCH 08/12] stk: Add parser for cell broadcast page objects Yang Gu
2010-06-13 9:43 ` [PATCH 09/12] stk: Add parser for bcch channel list objects Yang Gu
2010-06-13 9:43 ` [PATCH 10/12] stk: Add parser for timing advance objects Yang Gu
2010-06-16 22:50 ` Denis Kenzior
2010-06-16 23:19 ` andrzej zaborowski
2010-06-17 1:44 ` Gu, Yang
2010-06-13 9:43 ` [PATCH 11/12] stk: Add parser for PDP activation param objects Yang Gu
2010-06-13 9:43 ` [PATCH 12/12] stk: Add parser for UTRAN meas qualifier objects Yang Gu
2010-06-16 22:42 ` [PATCH 01/12] stk: Add parser for send ss commands 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=1276422202-16240-5-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