From: Frederic Danis <frederic.danis@linux.intel.com>
To: ofono@ofono.org
Subject: Re: [PATCH 1/2] emulator: add CMER support
Date: Thu, 24 Feb 2011 11:56:55 +0100 [thread overview]
Message-ID: <4D663977.7020909@linux.intel.com> (raw)
In-Reply-To: <4D656A5C.4010103@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2841 bytes --]
Hi Denis
Le 23/02/2011 21:13, Denis Kenzior a écrit :
> Hi Frédéric,
>
> On 02/23/2011 01:00 PM, Frédéric Danis wrote:
>> ---
>> src/emulator.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>> 1 files changed, 105 insertions(+), 2 deletions(-)
>
> I applied this patch, but one comment below:
>
>>
>> diff --git a/src/emulator.c b/src/emulator.c
>> index f0ca8c8..ca36c0e 100644
>> --- a/src/emulator.c
>> +++ b/src/emulator.c
>> @@ -43,6 +43,8 @@ struct ofono_emulator {
>> GAtServer *server;
>> GAtPPP *ppp;
>> guint source;
>> + int events_mode;
>> + gboolean events_ind;
>> GSList *indicators;
>> };
>>
>> @@ -251,6 +253,103 @@ fail:
>> }
>> }
>>
>> +static void cmer_cb(GAtServer *server, GAtServerRequestType type,
>> + GAtResult *result, gpointer user_data)
>> +{
>> + struct ofono_emulator *em = user_data;
>> + char buf[32];
>> +
>> + switch (type) {
>> + case G_AT_SERVER_REQUEST_TYPE_QUERY:
>> + sprintf(buf, "+CMER: %d,0,0,%d,0", em->events_mode,
>> + em->events_ind);
>> + g_at_server_send_info(em->server, buf, TRUE);
>> + g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
>> + break;
>> +
>> + case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
>> + sprintf(buf, "+CMER: (0,3),(0),(0),(0,1),(0)");
>> + g_at_server_send_info(em->server, buf, TRUE);
>> + g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
>> + break;
>> +
>> + case G_AT_SERVER_REQUEST_TYPE_SET:
>> + {
>> + GAtResultIter iter;
>> + int mode;
>> + int ind = em->events_ind;
>> + int val;
>> +
>> + g_at_result_iter_init(&iter, result);
>> + g_at_result_iter_next(&iter, "");
>> +
>> + /* mode */
>> + if (g_at_result_iter_next_number(&iter,&mode) == FALSE)
>> + goto fail;
>> +
>> + if ((mode != 0)&& (mode != 3))
>> + goto fail;
>> +
>> + /* keyp */
>> + if (g_at_result_iter_next_number(&iter,&val) == FALSE) {
>> + if (g_at_result_iter_skip_next(&iter) == FALSE)
>> + goto done;
>> + goto fail;
>> + }
>
>> From what I understand you're trying to enable something like:
>
> +CMER=3,,1 right?
>
> So this code does accomplish this, but it also allows silliness like this:
>
> +CMER=3,"foobar",,1
>
> You might want to make a special version of next_number that would
> actually check that either the number is given, or the field is empty.
>
The current version check that the parameter is a number or the end
(skip_next returns false) :
AT+CMER=3,0,0,1,0 or AT+CMER=3,0 are supported.
Currently void parameter are not supported (AT+CMER=3,,,1).
I will send a patch to support number or void parameter.
Regards
Fred
--
Frederic Danis Open Source Technology Centre
frederic.danis(a)intel.com Intel Corporation
next prev parent reply other threads:[~2011-02-24 10:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-23 19:00 [PATCH 0/2] bluetooth: add CMER and BRSF support in HFP AG =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-02-23 19:00 ` [PATCH 1/2] emulator: add CMER support =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-02-23 20:13 ` Denis Kenzior
2011-02-24 10:56 ` Frederic Danis [this message]
2011-02-23 19:00 ` [PATCH 2/2] emulator: add BRSF support =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-02-23 20:13 ` 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=4D663977.7020909@linux.intel.com \
--to=frederic.danis@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.