From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 17/18] isimodem: CBS for wgmodem2.5
Date: Wed, 16 Feb 2011 10:10:32 -0600 [thread overview]
Message-ID: <4D5BF6F8.9080506@gmail.com> (raw)
In-Reply-To: <d01065fc1a0d34feedf665921f2fe4270850af4d.1297772944.git.andreas.westin@stericsson.com>
[-- Attachment #1: Type: text/plain, Size: 1997 bytes --]
Hi Andreas,
> +static void reset_buf(char *buf, char *buf_2, int buf_len)
> +{
> + memset(buf, '\0', buf_len);
> + memset(buf_2, '\0', buf_len);
> +}
> +
> +static int get_topics_len(const char *topics)
> +{
> + int i = 0;
> + int k = 0;
> + int length = 0;
> + char buf[6];
> + char buf_2[6];
> +
> + reset_buf(buf, buf_2, 6);
> +
> + while (*topics != '\0') {
> + if (*topics == ',') {
> + reset_buf(buf, buf_2, 6);
> + k = 0;
> + length++;
> + } else if (*topics != ',' && *topics != '-') {
> + buf[k] = *topics;
> + k++;
> + } else if (*topics == '-') {
> + topics++;
> + i++;
> + k = 0;
> +
> + while (*topics != ',' && *topics != '\0') {
> + buf_2[k] = *topics;
> + topics++;
> + i++;
> + k++;
> + }
> +
> + length = length + atoi(buf_2) - atoi(buf) + 1;
> + k = 0;
> + }
> +
> + topics++;
> + i++;
> + }
> +
> + topics = topics - i;
> + return length;
> +}
> +
> +static void parse_topics(const char *topics, gint16 *topics_parsed)
> +{
> + int j = 0;
> + int k = 0;
> + char buf[6];
> + char buf_2[6];
> +
> + reset_buf(buf, buf_2, 6);
> +
> + while (*topics != '\0') {
> + if (*topics != ',' && *topics != '-') {
> + buf[j] = *topics;
> + j++;
> + } else if (*topics == '-') {
> + topics++;
> + j = 0;
> +
> + while (*topics != ',' && *topics != '\0') {
> + buf_2[j] = *topics;
> + topics++;
> + j++;
> + }
> +
> + for (j = 0; j <= (atoi(buf_2) - atoi(buf)); j++) {
> + topics_parsed[k] = atoi(buf) + j;
> + topics_parsed[k] = g_ntohs(topics_parsed[k]);
> + k++;
> + }
> +
> + j = 0;
> + } else if (*topics == ',') {
> + topics_parsed[k] = atoi(buf);
> + topics_parsed[k] = g_ntohs(topics_parsed[k]);
> + reset_buf(buf, buf_2, 6);
> + j = 0;
> + k++;
> + }
> +
> + topics++;
> + }
> +}
> +
Have you thought of adapting cbs_extract_topic_ranges function for all
of this somehow?
Regards,
-Denis
next prev parent reply other threads:[~2011-02-16 16:10 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-15 12:30 [PATCH 00/18] wgmodem2.5 support Andreas Westin
2011-02-15 12:30 ` [PATCH 01/18] gisi: pipe and pep for wgmodem2.5 Andreas Westin
2011-02-15 13:23 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2011-02-15 13:30 ` Mika.Liljeberg
2011-02-16 9:27 ` Andreas WESTIN
2011-02-15 12:30 ` [PATCH 02/18] gisi: modem version detection Andreas Westin
2011-02-15 12:30 ` [PATCH 03/18] isimodem: general build updates for wgmodem2.5 Andreas Westin
2011-02-16 11:19 ` Aki Niemi
2011-02-15 12:30 ` [PATCH 04/18] gisi: fix subscription " Andreas Westin
2011-02-16 11:16 ` Aki Niemi
2011-02-16 11:33 ` Andreas WESTIN
2011-02-16 11:37 ` Aki Niemi
2011-02-15 12:30 ` [PATCH 05/18] plugins: add plugin for u8500 Andreas Westin
2011-02-16 14:26 ` Aki Niemi
2011-02-16 15:27 ` Andreas WESTIN
2011-02-17 9:02 ` Aki Niemi
2011-02-15 12:31 ` [PATCH 06/18] plugins: add u8500 to udev Andreas Westin
2011-02-15 12:31 ` [PATCH 07/18] isimodem: add wgmodem2.5 to devinfo Andreas Westin
2011-02-16 14:15 ` Aki Niemi
2011-02-15 12:31 ` [PATCH 08/18] isimodem: UICC sim support for wgmodem2.5 Andreas Westin
2011-02-17 13:55 ` Aki Niemi
2011-02-15 12:31 ` [PATCH 09/18] isimodem: clip colp clir colr wgmodem2.5 Andreas Westin
2011-02-18 8:15 ` Aki Niemi
2011-02-15 12:31 ` [PATCH 10/18] isimodem: wgmodem2.5 added to voicecall Andreas Westin
2011-02-15 12:31 ` [PATCH 11/18] isimodem: gprs-context updates wgmodem2.5 Andreas Westin
2011-02-18 14:17 ` Aki Niemi
2011-02-15 12:31 ` [PATCH 12/18] isimodem: wgmodem2.5 support in USSD Andreas Westin
2011-02-15 12:31 ` [PATCH 13/18] isimodem: SS_GSM_BARRING_INFO added Andreas Westin
2011-02-15 12:31 ` [PATCH 14/18] isimodem: wgmodem2.5 added to call-forwarding Andreas Westin
2011-02-15 12:31 ` [PATCH 15/18] isimodem: wgmodem2.5 added to ssn Andreas Westin
2011-02-15 12:31 ` [PATCH 16/18] isimodem: sms updated with wgmodem2.5 Andreas Westin
2011-02-16 14:22 ` Aki Niemi
2011-02-16 14:47 ` Andreas WESTIN
2011-02-17 10:30 ` Aki Niemi
2011-02-15 12:31 ` [PATCH 17/18] isimodem: CBS for wgmodem2.5 Andreas Westin
2011-02-16 16:10 ` Denis Kenzior [this message]
2011-02-17 12:47 ` Andreas WESTIN
2011-02-15 12:31 ` [PATCH 18/18] isimodem: initial support for UICC phonebook Andreas Westin
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=4D5BF6F8.9080506@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