From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH v2 4/4] ifxmodem: emergency number list support
Date: Tue, 29 Mar 2011 22:17:45 -0500 [thread overview]
Message-ID: <4D92A0D9.2000107@gmail.com> (raw)
In-Reply-To: <1301320689-25201-5-git-send-email-jeevaka.badrappan@elektrobit.com>
[-- Attachment #1: Type: text/plain, Size: 4499 bytes --]
Hi Jeevaka,
On 03/28/2011 08:58 AM, Jeevaka Badrappan wrote:
> ---
> drivers/ifxmodem/voicecall.c | 98 ++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 98 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/ifxmodem/voicecall.c b/drivers/ifxmodem/voicecall.c
> index 87a48e6..a92ac11 100644
> --- a/drivers/ifxmodem/voicecall.c
> +++ b/drivers/ifxmodem/voicecall.c
> @@ -42,11 +42,13 @@
> #include "ifxmodem.h"
>
> static const char *none_prefix[] = { NULL };
> +static const char *xlema_prefix[] = { "+XLEMA:", NULL };
>
> struct voicecall_data {
> GSList *calls;
> unsigned int local_release;
> GAtChat *chat;
> + GSList *en_list;
> };
>
> struct release_id_req {
> @@ -786,6 +788,95 @@ static void xcolp_notify(GAtResult *result, gpointer user_data)
> ofono_voicecall_notify(vc, call);
> }
>
> +static gint number_compare(gconstpointer a, gconstpointer b)
> +{
> + const char *s1 = a, *s2 = b;
> + return strcmp(s1, s2);
> +}
> +
> +static void xlema_notify(GAtResult *result, gpointer user_data)
> +{
> + struct ofono_voicecall *vc = user_data;
> + struct voicecall_data *vd = ofono_voicecall_get_data(vc);
> + GAtResultIter iter;
> + int index, total_cnt;
> + const char *number;
> +
> + g_at_result_iter_init(&iter, result);
> +
> + if (!g_at_result_iter_next(&iter, "+XLEMA:"))
> + return;
> +
> + if (!g_at_result_iter_next_number(&iter, &index))
> + return;
> +
> + if (!g_at_result_iter_next_number(&iter, &total_cnt))
> + return;
> +
> + if (!g_at_result_iter_next_string(&iter, &number))
> + return;
> +
> + // Skip the category, EN valid with simpresence and mcc fields
Just a nitpick, but can you please use C-style comments ;)
> +
> + if (!g_slist_find_custom(vd->en_list, number, number_compare))
> + vd->en_list = g_slist_prepend(vd->en_list, g_strdup(number));
> +
Does this duplicate detection belong in the core? It might be more
efficient to bite the bullet and use something like a GHashtable to
build the final list of ECCs.
> + if (index != total_cnt)
> + return;
> +
> + vd->en_list = g_slist_reverse(vd->en_list);
> +
> + ofono_voicecall_en_list_notify(vc, vd->en_list);
> +
> + g_slist_foreach(vd->en_list, (GFunc) g_free, NULL);
> + g_slist_free(vd->en_list);
> + vd->en_list = NULL;
> +}
> +
> +static void xlema_read(gboolean ok, GAtResult *result, gpointer user_data)
> +{
> + struct ofono_voicecall *vc = user_data;
> + struct voicecall_data *vd = ofono_voicecall_get_data(vc);
> + GAtResultIter iter;
> + int index, total_cnt;
> + const char *number;
> +
> + if (!ok) {
> + DBG("Emergency number list read failed");
> + return;
> + }
> +
> + g_at_result_iter_init(&iter, result);
> +
> + while (g_at_result_iter_next(&iter, "+XLEMA:")) {
> + if (!g_at_result_iter_next_number(&iter, &index))
> + continue;
> +
> + if (!g_at_result_iter_next_number(&iter, &total_cnt))
> + continue;
> +
> + if (!g_at_result_iter_next_string(&iter, &number))
> + continue;
> +
> + // Skip the category, EN valid with simpresence and mcc fields
Again about c-style comments
> + g_at_result_iter_skip_next(&iter);
> + g_at_result_iter_skip_next(&iter);
> + g_at_result_iter_skip_next(&iter);
> +
> + if (!g_slist_find_custom(vd->en_list, number, number_compare))
> + vd->en_list = g_slist_prepend(vd->en_list,
> + g_strdup(number));
> + }
> +
> + vd->en_list = g_slist_reverse(vd->en_list);
> +
> + ofono_voicecall_en_list_notify(vc, vd->en_list);
> +
> + g_slist_foreach(vd->en_list, (GFunc) g_free, NULL);
> + g_slist_free(vd->en_list);
> + vd->en_list = NULL;
> +}
> +
> static void ifx_voicecall_initialized(gboolean ok, GAtResult *result,
> gpointer user_data)
> {
> @@ -803,7 +894,14 @@ static void ifx_voicecall_initialized(gboolean ok, GAtResult *result,
> FALSE, vc, NULL);
> g_at_chat_register(vd->chat, "+XCOLP:", xcolp_notify, FALSE, vc, NULL);
>
> + g_at_chat_register(vd->chat, "+XLEMA:", xlema_notify, FALSE, vc, NULL);
An empty line here please
> + /* Enable emergency number list notification */
> + g_at_chat_send(vd->chat, "AT+XLEMA=1", none_prefix, NULL, NULL, NULL);
> +
> ofono_voicecall_register(vc);
> +
> + g_at_chat_send(vd->chat, "AT+XLEMA?", xlema_prefix, xlema_read, vc,
> + NULL);
> }
>
> static int ifx_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
Regards,
-Denis
prev parent reply other threads:[~2011-03-30 3:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-28 13:58 [PATCH v2 0/4] Support for emergency number list from network/modem Jeevaka Badrappan
2011-03-28 13:58 ` [PATCH v2 1/4] include: Add ofono_voicecall_en_list_notify api Jeevaka Badrappan
2011-03-30 3:03 ` Denis Kenzior
2011-03-28 13:58 ` [PATCH v2 2/4] voicecall: refactor emergency number list handling Jeevaka Badrappan
2011-03-30 3:06 ` Denis Kenzior
2011-03-30 13:33 ` Jeevaka.Badrappan
2011-03-30 15:41 ` Denis Kenzior
2011-03-28 13:58 ` [PATCH v2 3/4] voicecall: network emergency number list support Jeevaka Badrappan
2011-03-28 13:58 ` [PATCH v2 4/4] ifxmodem: " Jeevaka Badrappan
2011-03-30 3:17 ` Denis Kenzior [this message]
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=4D92A0D9.2000107@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