From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 01/12] atutil changes for parsing cscs query and cscs support
Date: Thu, 09 Sep 2010 09:45:17 -0500 [thread overview]
Message-ID: <4C88F2FD.7080109@gmail.com> (raw)
In-Reply-To: <1284035516-21359-2-git-send-email-jeevaka.badrappan@elektrobit.com>
[-- Attachment #1: Type: text/plain, Size: 5310 bytes --]
Hi Jeevaka,
On 09/09/2010 07:31 AM, Jeevaka Badrappan wrote:
> ---
> drivers/atmodem/atutil.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++
> drivers/atmodem/atutil.h | 26 +++++++++++++++
> 2 files changed, 104 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
> index f566237..ffbcb6c 100644
> --- a/drivers/atmodem/atutil.c
> +++ b/drivers/atmodem/atutil.c
> @@ -341,3 +341,81 @@ gboolean at_util_parse_sms_index_delivery(GAtResult *result, const char *prefix,
>
> return TRUE;
> }
> +
> +gboolean at_util_charset_string_to_charset(const char *str,
> + enum at_util_charset *charset)
> +{
> + if (!g_strcmp0(str, "GSM"))
> + *charset = AT_UTIL_CHARSET_GSM;
> + else if (!g_strcmp0(str, "HEX"))
> + *charset = AT_UTIL_CHARSET_HEX;
> + else if (!g_strcmp0(str, "IRA"))
> + *charset = AT_UTIL_CHARSET_IRA;
> + else if (!g_strcmp0(str, "PCCP437"))
> + *charset = AT_UTIL_CHARSET_PCCP437;
> + else if (!g_strcmp0(str, "PCDN"))
> + *charset = AT_UTIL_CHARSET_PCDN;
> + else if (!g_strcmp0(str, "UCS2"))
> + *charset = AT_UTIL_CHARSET_UCS2;
> + else if (!g_strcmp0(str, "UTF-8"))
> + *charset = AT_UTIL_CHARSET_UTF8;
> + else if (!g_strcmp0(str, "8859-1"))
> + *charset = AT_UTIL_CHARSET_8859_1;
> + else if (!g_strcmp0(str, "8859-2"))
> + *charset = AT_UTIL_CHARSET_8859_2;
> + else if (!g_strcmp0(str, "8859-3"))
> + *charset = AT_UTIL_CHARSET_8859_3;
> + else if (!g_strcmp0(str, "8859-4"))
> + *charset = AT_UTIL_CHARSET_8859_4;
> + else if (!g_strcmp0(str, "8859-5"))
> + *charset = AT_UTIL_CHARSET_8859_5;
> + else if (!g_strcmp0(str, "8859-6"))
> + *charset = AT_UTIL_CHARSET_8859_6;
> + else if (!g_strcmp0(str, "8859-C"))
> + *charset = AT_UTIL_CHARSET_8859_C;
> + else if (!g_strcmp0(str, "8859-A"))
> + *charset = AT_UTIL_CHARSET_8859_A;
> + else if (!g_strcmp0(str, "8859-G"))
> + *charset = AT_UTIL_CHARSET_8859_G;
> + else if (!g_strcmp0(str, "8859-H"))
> + *charset = AT_UTIL_CHARSET_8859_H;
> + else
> + return FALSE;
> +
> + return TRUE;
> +}
> +
> +gboolean at_util_parse_cscs_supported(GAtResult *result, int *supported)
> +{
> + GAtResultIter iter;
> + const char *str;
> + enum at_util_charset charset;
> + g_at_result_iter_init(&iter, result);
> +
> + if (!g_at_result_iter_next(&iter, "+CSCS:"))
> + return FALSE;
> +
> + /* Some modems don't report CSCS in a proper list */
> + g_at_result_iter_open_list(&iter);
> +
> + while (g_at_result_iter_next_string(&iter, &str)) {
> + if (at_util_charset_string_to_charset(str, &charset))
> + *supported |= charset;
If you're going to do this, then you better make sure that the enum
values are setup for ORing. Right now a modem supporting
AT_UTIL_CHARSET_8859_A will test positive to supporting UTF8, GSM, HEX,
PCCDN to name a few.
> + }
> +
> + g_at_result_iter_close_list(&iter);
> +
> + return TRUE;
> +}
> +
> +gboolean at_util_parse_cscs_query(GAtResult *result, const char **charset)
I suggest you do the conversion of string to the enum here and perhaps
make at_util_charset_string_to_charset static.
> +{
> + GAtResultIter iter;
> +
> + g_at_result_iter_init(&iter, result);
> +
> + if (!g_at_result_iter_next(&iter, "+CSCS:"))
> + return FALSE;
> +
> + return g_at_result_iter_next_string(&iter, charset);
> +}
> diff --git a/drivers/atmodem/atutil.h b/drivers/atmodem/atutil.h
> index 9e0a84b..845d8de 100644
> --- a/drivers/atmodem/atutil.h
> +++ b/drivers/atmodem/atutil.h
> @@ -27,6 +27,27 @@ enum at_util_sms_store {
> AT_UTIL_SMS_STORE_BM = 4,
> };
>
> +/* 3GPP TS 27.007 Release 8 Section 5.5 */
> +enum at_util_charset {
> + AT_UTIL_CHARSET_GSM = 1,
> + AT_UTIL_CHARSET_HEX = 2,
> + AT_UTIL_CHARSET_IRA = 3,
> + AT_UTIL_CHARSET_PCCP437 = 4,
> + AT_UTIL_CHARSET_PCDN = 5,
> + AT_UTIL_CHARSET_UCS2 = 6,
> + AT_UTIL_CHARSET_UTF8 = 7,
> + AT_UTIL_CHARSET_8859_1 = 8,
> + AT_UTIL_CHARSET_8859_2 = 9,
> + AT_UTIL_CHARSET_8859_3 = 10,
> + AT_UTIL_CHARSET_8859_4 = 11,
> + AT_UTIL_CHARSET_8859_5 = 12,
> + AT_UTIL_CHARSET_8859_6 = 13,
> + AT_UTIL_CHARSET_8859_C = 14,
> + AT_UTIL_CHARSET_8859_A = 15,
> + AT_UTIL_CHARSET_8859_G = 16,
> + AT_UTIL_CHARSET_8859_H = 17,
> +};
Please refer to doc/coding-style.txt Section M11 on the preferred coding
style. Namely, use a single space after the enum name and before the
'=' and several tabs to align the enum value. There should be plenty of
examples in stkutil.h...
> +
> void decode_at_error(struct ofono_error *error, const char *final);
> gint at_util_call_compare_by_status(gconstpointer a, gconstpointer b);
> gint at_util_call_compare_by_phone_number(gconstpointer a, gconstpointer b);
> @@ -46,6 +67,11 @@ gboolean at_util_parse_sms_index_delivery(GAtResult *result, const char *prefix,
> enum at_util_sms_store *store,
> int *index);
>
> +gboolean at_util_charset_string_to_charset(const char *str,
> + enum at_util_charset *charset);
> +gboolean at_util_parse_cscs_supported(GAtResult *result, int *supported);
> +gboolean at_util_parse_cscs_query(GAtResult *result, const char **charset);
> +
> struct cb_data {
> void *cb;
> void *data;
Regards,
-Denis
next prev parent reply other threads:[~2010-09-09 14:45 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-09 12:31 Add support for Send USSD proactive command handling Jeevaka Badrappan
2010-09-09 12:31 ` [PATCH 01/12] atutil changes for parsing cscs query and cscs support Jeevaka Badrappan
2010-09-09 14:45 ` Denis Kenzior [this message]
2010-09-09 18:56 ` Jeevaka Badrappan
2010-09-09 18:56 ` [PATCH 01/13] " Jeevaka Badrappan
2010-09-10 17:27 ` Denis Kenzior
2010-09-09 12:31 ` [PATCH 02/12] atgen changes for setting TE character set Jeevaka Badrappan
2010-09-09 14:50 ` Denis Kenzior
2010-09-09 19:00 ` [PATCH 02/13] " Jeevaka Badrappan
2010-09-09 12:31 ` [PATCH 03/12] phonesim " Jeevaka Badrappan
2010-09-09 19:01 ` [PATCH 03/13] " Jeevaka Badrappan
2010-09-10 17:07 ` Denis Kenzior
2010-09-10 20:29 ` [PATCH 2/7] " Jeevaka Badrappan
2010-09-09 12:31 ` [PATCH 04/12] USSD atom driver changes to read current character setting Jeevaka Badrappan
2010-09-09 19:02 ` [PATCH 04/13] " Jeevaka Badrappan
2010-09-09 12:31 ` [PATCH 05/12] Add internal api __ofono_call_barring_is_busy Jeevaka Badrappan
2010-09-09 15:06 ` Denis Kenzior
2010-09-09 12:31 ` [PATCH 06/12] Add internal api __ofono_call_forwarding_is_busy Jeevaka Badrappan
2010-09-09 15:07 ` Denis Kenzior
2010-09-09 12:31 ` [PATCH 07/12] Add internal api __ofono_call_settings_is_busy Jeevaka Badrappan
2010-09-09 15:07 ` Denis Kenzior
2010-09-09 12:31 ` [PATCH 08/12] Add Send USSD command specific result codes Jeevaka Badrappan
2010-09-09 15:09 ` Denis Kenzior
2010-09-09 12:31 ` [PATCH 09/12] Add Send USSD terminal response data structures Jeevaka Badrappan
2010-09-09 15:20 ` Denis Kenzior
2010-09-09 12:31 ` [PATCH 10/12] Add build_dataobj_ussd_text for ussd specific text string handling Jeevaka Badrappan
2010-09-09 15:31 ` Denis Kenzior
2010-09-09 19:06 ` [PATCH 10/13] " Jeevaka Badrappan
2010-09-10 17:29 ` Denis Kenzior
2010-09-10 20:19 ` [PATCH 4/7] " Jeevaka Badrappan
2010-09-10 20:22 ` Denis Kenzior
2010-09-09 12:31 ` [PATCH 11/12] Internal and Driver api changes for Send USSD proactive command Jeevaka Badrappan
2010-09-09 15:59 ` Denis Kenzior
2010-09-09 20:25 ` [PATCH 6/8] " Jeevaka Badrappan
2010-09-09 20:25 ` [PATCH 7/8] Add __ofono_ussd_initiate internal api for Sending USSD Jeevaka Badrappan
2010-09-09 12:31 ` [PATCH 12/12] Handling of Send USSD proactive command Jeevaka Badrappan
2010-09-09 15:37 ` Denis Kenzior
2010-09-09 19:42 ` [PATCH 8/8] " Jeevaka Badrappan
2010-09-13 23:00 ` Added UCS2 handling and review comments incorporated Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 1/8] smsutil: Add USSD encoding function Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 2/8] util: Add UCS2 to GSM 7bit converion function Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 3/8] test-util: Add function for validating UCS2 to GSM bit conversion Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 4/8] USSD atom driver changes to read current character setting Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 5/8] Internal and Driver API changes for Send USSD Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 6/8] Add __ofono_ussd_initiate internal api for Sending USSD Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 7/8] stk: Handling of Send USSD proactive command Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 8/8] stkutil: Add handling of error case scenario in build USSD data object Jeevaka Badrappan
2010-09-14 21:49 ` [PATCH 3/4] stk: Handling of Send USSD proactive command Jeevaka Badrappan
2010-09-15 17:15 ` Denis Kenzior
2010-09-14 17:45 ` [PATCH 6/8] Add __ofono_ussd_initiate internal api for Sending USSD Denis Kenzior
2010-09-14 21:31 ` [PATCH 2/4] " Jeevaka Badrappan
2010-09-15 17:13 ` Denis Kenzior
2010-09-14 17:24 ` [PATCH 5/8] Internal and Driver API changes for Send USSD Denis Kenzior
2010-09-14 21:23 ` [PATCH 1/4] " Jeevaka Badrappan
2010-09-15 17:13 ` Denis Kenzior
2010-09-14 17:01 ` [PATCH 4/8] USSD atom driver changes to read current character setting Denis Kenzior
2010-09-14 17:01 ` [PATCH 3/8] test-util: Add function for validating UCS2 to GSM bit conversion Denis Kenzior
2010-09-14 17:01 ` [PATCH 2/8] util: Add UCS2 to GSM 7bit converion function Denis Kenzior
2010-09-14 16:58 ` [PATCH 1/8] smsutil: Add USSD encoding function 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=4C88F2FD.7080109@gmail.com \
--to=denkenz@gmail.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