public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Alok <develnewbie@gmail.com>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] [PATCH] HFP method "SetupCall" + audio-api.txt update
Date: Tue, 08 Jan 2008 20:53:27 +0530	[thread overview]
Message-ID: <1199805807.20835.10.camel@greatbear> (raw)
In-Reply-To: <d89ddf300801071547k792a5b9fqe6e7e72e597b0e5f@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 221 bytes --]

Hi Johan/Fredric, 

Here is a patch for adding the SetupCall method , used for call setup on
hfp. Also adding a patch to update the audio-api.txt file for the same. 

Let me know if anything needs to be changed. 

-Alok.

[-- Attachment #2: audio-api.patch --]
[-- Type: text/x-patch, Size: 1306 bytes --]

Index: audio/audio-api.txt
===================================================================
RCS file: /cvsroot/bluez/utils/audio/audio-api.txt,v
retrieving revision 1.25
diff -u -5 -p -r1.25 audio-api.txt
--- audio/audio-api.txt	29 Aug 2007 11:41:15 -0000	1.25
+++ audio/audio-api.txt	8 Jan 2008 15:01:51 -0000
@@ -181,10 +181,17 @@ Methods		void Connect()
 
 		void SetMicrophoneGain(uint16 gain)
 
 			Changes the current speaker gain if possible.
 
+                void SetupCall(string value)
+
+                        Sets up an call with the connected HFP.
+                        value can be incoming, outgoing
+                        or remote to indicate incoming call, outgoing
+                        call and remote party alerted respectively.                                                                   
+
 Signals		void AnswerRequested()
 
 			Sent when the answer button is pressed on the headset
 
 		void Connected()
@@ -209,10 +216,14 @@ Signals		void AnswerRequested()
 
 		void MicrophoneGainChanged(uint16 gain)
 
 			The microphone gain changed.
 
+                void TerminateCall()
+
+                        Sent when an ongoing call is terminated.                
+
 
 org.bluez.audio.Gateway interface
 =================================
 
 [not yet implemented]

[-- Attachment #3: setupCall.patch --]
[-- Type: text/x-patch, Size: 2423 bytes --]

Index: audio/headset.c
===================================================================
RCS file: /cvsroot/bluez/utils/audio/headset.c,v
retrieving revision 1.153
diff -u -5 -p -r1.153 headset.c
--- audio/headset.c	8 Jan 2008 14:45:32 -0000	1.153
+++ audio/headset.c	8 Jan 2008 14:52:49 -0000
@@ -1395,10 +1395,60 @@ static DBusHandlerResult hs_set_mic_gain
 						void *data)
 {
 	return hs_set_gain(conn, msg, data, HEADSET_GAIN_MICROPHONE);
 }
 
+static DBusHandlerResult hf_setup_call(DBusConnection *conn,
+						DBusMessage *msg,
+						void *data)
+{
+	struct device *device = data;
+	struct headset *hs = device->headset;
+	DBusMessage *reply;
+	DBusError derr;
+	const char *value;
+	int err;
+
+	if (!hs->hfp_active)
+		return error_not_supported(device->conn, msg);
+
+	if (hs->state < HEADSET_STATE_CONNECTED)
+		return error_not_connected(conn, msg);
+
+	dbus_error_init(&derr);
+	dbus_message_get_args(msg, &derr, DBUS_TYPE_STRING, &value,
+				DBUS_TYPE_INVALID);
+
+	if (dbus_error_is_set(&derr)) {
+		error_invalid_arguments(conn, msg, derr.message);
+		dbus_error_free(&derr);
+		return DBUS_HANDLER_RESULT_HANDLED;
+	}
+
+	reply = dbus_message_new_method_return(msg);
+	if (!reply)
+		return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+	if (!strncmp(value, "incoming", 8))
+		err = headset_send(hs, "\r\n+CIEV:3, 1\r\n");
+	else if (!strncmp(value, "outgoing", 8))
+		err = headset_send(hs, "\r\n+CIEV:3, 2\r\n");
+	else if (!strncmp(value, "remote", 6))
+		err = headset_send(hs, "\r\n+CIEV:3, 3\r\n");
+	else
+		err = -EINVAL;
+
+	if (err < 0) {
+		dbus_message_unref(reply);
+		return error_failed_errno(conn, msg, -err);
+	}
+
+	send_message_and_unref(conn, reply);
+
+	return DBUS_HANDLER_RESULT_HANDLED;
+}
+
 static DBusMethodVTable headset_methods[] = {
 	{ "Connect",		hs_connect,		"",	""	},
 	{ "Disconnect",		hs_disconnect,		"",	""	},
 	{ "IsConnected",	hs_is_connected,	"",	"b"	},
 	{ "IndicateCall",	hs_ring,		"",	""	},
@@ -1408,10 +1458,11 @@ static DBusMethodVTable headset_methods[
 	{ "IsPlaying",		hs_is_playing,		"",	"b"	},
 	{ "GetSpeakerGain",	hs_get_speaker_gain,	"",	"q"	},
 	{ "GetMicrophoneGain",	hs_get_mic_gain,	"",	"q"	},
 	{ "SetSpeakerGain",	hs_set_speaker_gain,	"q",	""	},
 	{ "SetMicrophoneGain",	hs_set_mic_gain,	"q",	""	},
+	{ "SetupCall",		hf_setup_call,		"s",	""	},
 	{ NULL, NULL, NULL, NULL }
 };
 
 static DBusSignalVTable headset_signals[] = {
 	{ "Connected",			""	},

[-- Attachment #4: Type: text/plain, Size: 278 bytes --]

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

[-- Attachment #5: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2008-01-08 15:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-07 23:09 [Bluez-devel] patch removing one extra memset Pavel Semerad
2008-01-07 23:47 ` Brad Midgley
2008-01-08 15:23   ` Alok [this message]
2008-01-08 18:28     ` [Bluez-devel] [PATCH] HFP method "SetupCall" + audio-api.txt update Marcel Holtmann
2008-01-09  3:06       ` Johan Hedberg

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=1199805807.20835.10.camel@greatbear \
    --to=develnewbie@gmail.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /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