All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Forrest Zhao <forrest.zhao@intel.com>
Cc: linux-bluetooth@vger.kernel.org, forrest.zhao@gmail.com
Subject: Re: [PATCH] add support for HFP plugin for oFono(ofono.org)
Date: Wed, 13 May 2009 09:49:40 +0300	[thread overview]
Message-ID: <20090513064940.GA22585@jh-x301> (raw)
In-Reply-To: <1242183319-24470-1-git-send-email-forrest.zhao@intel.com>

Hi Forrest,

In general the patch looks ok'ish (which it should since it seems to be
largely based on the maemo driver), though I do have a couple of comments:

On Wed, May 13, 2009, Forrest Zhao wrote:
> +static int send_method_call(const char *dest, const char *path,
> +                                const char *interface, const char *method,
> +                                DBusPendingCallNotifyFunction cb,
> +                                void *user_data, int type, ...);

I don't think there should be any need for this forward declaration. Just
move the function higher up in the file.

> +static void answer_reply(DBusPendingCall *call, void *user_data)
> +{
> +	DBusMessage *reply;
> +	DBusError err;
> +
> +	reply = dbus_pending_call_steal_reply(call);
> +	dbus_error_init(&err);
> +	if (dbus_set_error_from_message(&err, reply)) {
> +		error("oFono answer incoming call failed: %s, %s",
> +			err.name, err.message);
> +		dbus_error_free(&err);
> +		goto done;
> +	}
> +
> +done:
> +	dbus_message_unref(reply);
> +}
> +
> +void telephony_answer_call_req(void *telephony_device)
> +{
> +	struct voice_call *vc = find_vc_with_status(CALL_STATUS_INCOMING);
> +	int ret;
> +
> +	if (!vc) {
> +		telephony_answer_call_rsp(telephony_device,
> +					CME_ERROR_NOT_ALLOWED);
> +		return;
> +	}
> +
> +	ret = send_method_call(OFONO_BUS_NAME, vc->obj_path,
> +			OFONO_VC_INTERFACE,
> +			"Answer", answer_reply,
> +			NULL, DBUS_TYPE_INVALID);
> +
> +	if (ret < 0) {
> +		telephony_answer_call_rsp(telephony_device,
> +					CME_ERROR_AG_FAILURE);
> +		return;
> +	}
> +
> +	telephony_answer_call_rsp(telephony_device, CME_ERROR_NONE);
> +}

If you're actually going to handle the D-Bus reply to the Answer method
call (which the maemo driver doesn't do -- it relies on the state signals
instead), doesn't it make sense to call telephony_answer_call_rsp in the
reply handler (answer_reply) instead of here?

Johan

  reply	other threads:[~2009-05-13  6:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-13  2:55 [PATCH] add support for HFP plugin for oFono(ofono.org) Forrest Zhao
2009-05-13  6:49 ` Johan Hedberg [this message]
2009-05-13  7:02   ` Zhao Forrest
2009-05-13  7:20 Forrest Zhao
2009-05-13  7:40 ` Marcel Holtmann

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=20090513064940.GA22585@jh-x301 \
    --to=johan.hedberg@gmail.com \
    --cc=forrest.zhao@gmail.com \
    --cc=forrest.zhao@intel.com \
    --cc=linux-bluetooth@vger.kernel.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.