From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH V2 1/4] voicecall: create generic dial function
Date: Wed, 25 May 2011 05:59:43 -0500 [thread overview]
Message-ID: <4DDCE11F.1070001@gmail.com> (raw)
In-Reply-To: <1305884461-4476-2-git-send-email-frederic.danis@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2065 bytes --]
Hi Frédéric,
On 05/20/2011 04:40 AM, Frédéric Danis wrote:
> split manager_dial between generic and dbus parts
> ---
> src/voicecall.c | 91 ++++++++++++++++++++++++++++++++++++++----------------
> 1 files changed, 64 insertions(+), 27 deletions(-)
>
<snip>
> +
> +static DBusMessage *manager_dial(DBusConnection *conn,
> + DBusMessage *msg, void *data)
> +{
> + struct ofono_voicecall *vc = data;
> + const char *number;
> + const char *clirstr;
> + enum ofono_clir_option clir;
> + int err;
> + DBusMessage *reply = NULL;
> +
> + if (vc->pending)
> + return __ofono_error_busy(msg);
> +
> + if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &number,
> + DBUS_TYPE_STRING, &clirstr,
> + DBUS_TYPE_INVALID) == FALSE)
> + return __ofono_error_invalid_args(msg);
> +
> + if (clir_string_to_clir(clirstr, &clir) == FALSE)
> + return __ofono_error_invalid_format(msg);
> +
> vc->pending = dbus_message_ref(msg);
>
> - string_to_phone_number(number, &ph);
> + err = voicecall_dial(vc, number, clir, manager_dial_callback, vc);
> + switch (err) {
> + case 0:
> + break;
Maybe I'm missing something, but why don't you do something like:
if (err >= 0)
return NULL;
vc->pending = NULL;
dbus_message_unref(msg);
> +
> + case -EINVAL:
> + reply = __ofono_error_invalid_format(msg);
> + break;
And then simply use return __ofono_error... here?
>
> - vc->driver->dial(vc, &ph, clir, manager_dial_callback, vc);
> + case -ENETDOWN:
> + reply = __ofono_error_not_available(msg);
> + break;
>
And here
> - return NULL;
> + case -ENOTSUP:
> + reply = __ofono_error_not_implemented(msg);
> + break;
> +
And here
> + default:
> + reply = __ofono_error_failed(msg);
> + break;
> + }
> +
And here
> + if (reply != NULL) {
> + dbus_message_unref(msg);
> + vc->pending = NULL;
> + }
> +
> + return reply;
And then this part is not needed.
> }
>
> static DBusMessage *manager_transfer(DBusConnection *conn,
Regards,
-Denis
next prev parent reply other threads:[~2011-05-25 10:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-20 9:40 [PATCH V2 0/4] Add dial support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-05-20 9:40 ` [PATCH V2 1/4] voicecall: create generic dial function =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-05-25 10:59 ` Denis Kenzior [this message]
2011-05-20 9:40 ` [PATCH V2 2/4] voicecall: add ATD support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-05-25 11:16 ` Denis Kenzior
2011-05-20 9:41 ` [PATCH V2 3/4] voicecall: save last dialed number =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-05-25 11:19 ` Denis Kenzior
2011-05-20 9:41 ` [PATCH V2 4/4] voicecall: add +BLDN support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
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=4DDCE11F.1070001@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 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.