public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] BlueZ as an Haedset ...
@ 2008-01-08 11:20 Pierre Savary
  2008-01-08 11:31 ` Simon Vogl
  2008-01-08 14:03 ` [Bluez-devel] [PATCH] more headset.c fixes Alok
  0 siblings, 2 replies; 3+ messages in thread
From: Pierre Savary @ 2008-01-08 11:20 UTC (permalink / raw)
  To: BlueZ-Dev


[-- Attachment #1.1: Type: text/plain, Size: 373 bytes --]

Hi,

I develop a custom board with Linux-2.6.23 and the BlueZ. I want that this
board is a headset but I see that in the sources of Bluez-utils-3.24, the
gateway.c file is empty.

Did somebody already do that?

Did somebody already begin this development?

I'm very interested by this function, so all yours helps are welcome .

 

Thanks in advance,

Regards,

 

Pierre


[-- Attachment #1.2: Type: text/html, Size: 2579 bytes --]

[-- Attachment #2: 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 #3: Type: text/plain, Size: 164 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Bluez-devel] BlueZ as an Haedset ...
  2008-01-08 11:20 [Bluez-devel] BlueZ as an Haedset Pierre Savary
@ 2008-01-08 11:31 ` Simon Vogl
  2008-01-08 14:03 ` [Bluez-devel] [PATCH] more headset.c fixes Alok
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Vogl @ 2008-01-08 11:31 UTC (permalink / raw)
  To: BlueZ development

UGllcnJlLApJIG9uY2Ugd3JvdGUgYSBzbWFsbCB1dGlsaXR5IHRoYXQgaW1wbGVtZW50cyB0aGUg
aGZwCnByb3RvY29sIGZvciBibHVleiwgbWF5YmUgdGhpcyBjb3VsZCBiZSBhIHN0YXJ0OgpodHRw
Oi8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VjayBvdXQg
dGhlIG5ldyBTb3VyY2VGb3JnZS5uZXQgTWFya2V0cGxhY2UuCkl0J3MgdGhlIGJlc3QgcGxhY2Ug
dG8gYnV5IG9yIHNlbGwgc2VydmljZXMgZm9yCmp1c3QgYWJvdXQgYW55dGhpbmcgT3BlbiBTb3Vy
Y2UuCmh0dHA6Ly9hZC5kb3VibGVjbGljay5uZXQvY2xrOzE2NDIxNjIzOTsxMzUwMzAzODt3P2h0
dHA6Ly9zZi5uZXQvbWFya2V0cGxhY2UKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX18KQmx1ZXotZGV2ZWwgbWFpbGluZyBsaXN0CkJsdWV6LWRldmVsQGxpc3Rz
LnNvdXJjZWZvcmdlLm5ldApodHRwczovL2xpc3RzLnNvdXJjZWZvcmdlLm5ldC9saXN0cy9saXN0
aW5mby9ibHVlei1kZXZlbAo=

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bluez-devel] [PATCH] more headset.c fixes
  2008-01-08 11:20 [Bluez-devel] BlueZ as an Haedset Pierre Savary
  2008-01-08 11:31 ` Simon Vogl
@ 2008-01-08 14:03 ` Alok
  1 sibling, 0 replies; 3+ messages in thread
From: Alok @ 2008-01-08 14:03 UTC (permalink / raw)
  To: BlueZ development

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

Hi Johan/Fredric,

Here is a patch which fixes the following :

1. Consistency with headset_send args. 
2. error checks for headset_send. 
3. Populating answer_call and terminate_call methods.
4. Adding "TerminateCall" signal.

let me know if anything needs to be changed.

-Alok.

[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 5610 bytes --]

Index: audio/headset.c
===================================================================
RCS file: /cvsroot/bluez/utils/audio/headset.c,v
retrieving revision 1.152
diff -u -5 -p -r1.152 headset.c
--- audio/headset.c	8 Jan 2008 08:58:14 -0000	1.152
+++ audio/headset.c	8 Jan 2008 14:02:41 -0000
@@ -173,11 +173,11 @@ static int supported_features(struct dev
 	hs->hfp_features = strtoul(&buf[8], NULL, 10);
 	err = headset_send(hs, "\r\n+BRSF=%u\r\n", ag_features);
 	if (err < 0)
 		return err;
 
-	return headset_send(device->headset, "\r\nOK\r\n");
+	return headset_send(hs, "\r\nOK\r\n");
 }
 
 static int report_indicators(struct device *device, const char *buf)
 {
 	struct headset *hs = device->headset;
@@ -190,16 +190,17 @@ static int report_indicators(struct devi
 		err = headset_send(hs, "\r\n+CIND:1, 0, 0\r\n");
 
 	if (err < 0)
 		return err;
 
-	return headset_send(device->headset, "\r\nOK\r\n");
+	return headset_send(hs, "\r\nOK\r\n");
 }
 
 static int event_reporting(struct device *device, const char *buf)
 {
-	return headset_send(device->headset, "\r\nOK\r\n");
+	struct headset *hs = device->headset;
+	return headset_send(hs, "\r\nOK\r\n");
 }
 
 static int call_hold(struct device *device, const char *buf)
 {
 	struct headset *hs = device->headset;
@@ -207,29 +208,68 @@ static int call_hold(struct device *devi
 
 	err = headset_send(hs, "\r\n+CHLD:(0,1,1x,2,2x,3,4)\r\n");
 	if (err < 0)
 		return err;
 
-	return headset_send(device->headset, "\r\nOK\r\n");
+	return headset_send(hs, "\r\nOK\r\n");
 }
 
 static int answer_call(struct device *device, const char *buf)
 {
+	struct headset *hs = device->headset;
+	int err;
+
 	dbus_connection_emit_signal(device->conn, device->path,
 			AUDIO_HEADSET_INTERFACE, "AnswerRequested",
 			DBUS_TYPE_INVALID);
 
-	return headset_send(device->headset, "\r\nOK\r\n");
+	if (hs->ring_timer) {
+		g_source_remove(hs->ring_timer);
+		hs->ring_timer = 0;
+	}
+
+	if (!hs->hfp_active)
+		return headset_send(hs, "\r\nOK\r\n");
+
+	err = headset_send(hs, "\r\nOK\r\n");
+	if (err < 0)
+		return err;
+
+	/*+CIEV: (call = 1)*/
+	err = headset_send(hs, "\r\n+CIEV:2, 1\r\n");
+	if (err < 0)
+		return err;
+
+	/*+CIEV: (callsetup = 0)*/
+	return headset_send(hs, "\r\n+CIEV:3, 0\r\n");
 }
 
 static int terminate_call(struct device *device, const char *buf)
 {
-	return headset_send(device->headset, "\r\nOK\r\n");
+	struct headset *hs = device->headset;
+	int err;
+
+	dbus_connection_emit_signal(device->conn, device->path,
+			AUDIO_HEADSET_INTERFACE, "TerminateCall",
+			DBUS_TYPE_INVALID);
+
+	if (hs->ring_timer) {
+		g_source_remove(hs->ring_timer);
+		hs->ring_timer = 0;
+	}
+
+	err = headset_send(hs, "\r\nOK\r\n");
+	if (err < 0)
+		return err;
+
+	/*+CIEV: (call = 0)*/
+	return headset_send(hs, "\r\n+CIEV:2, 0\r\n");
 }
 
 static int signal_gain_setting(struct device *device, const char *buf)
 {
+	struct headset *hs = device->headset;
 	const char *name;
 	dbus_uint16_t gain;
 
 	if (strlen(buf) < 8) {
 		error("Too short string for Gain setting");
@@ -243,20 +283,20 @@ static int signal_gain_setting(struct de
 		return -1;
 	}
 
 	switch (buf[5]) {
 	case HEADSET_GAIN_SPEAKER:
-		if (device->headset->sp_gain == gain)
+		if (hs->sp_gain == gain)
 			goto ok;
 		name = "SpeakerGainChanged";
-		device->headset->sp_gain = gain;
+		hs->sp_gain = gain;
 		break;
 	case HEADSET_GAIN_MICROPHONE:
-		if (device->headset->mic_gain == gain)
+		if (hs->mic_gain == gain)
 			goto ok;
 		name = "MicrophoneGainChanged";
-		device->headset->mic_gain = gain;
+		hs->mic_gain = gain;
 		break;
 	default:
 		error("Unknown gain setting");
 		return G_IO_ERROR_INVAL;
 	}
@@ -265,11 +305,11 @@ static int signal_gain_setting(struct de
 				    AUDIO_HEADSET_INTERFACE, name,
 				    DBUS_TYPE_UINT16, &gain,
 				    DBUS_TYPE_INVALID);
 
 ok:
-	return headset_send(device->headset, "\r\nOK\r\n");
+	return headset_send(hs, "\r\nOK\r\n");
 }
 
 static struct event event_callbacks[] = {
 	{"ATA", answer_call},
 	{"AT+VG", signal_gain_setting},
@@ -1123,15 +1163,16 @@ error:
 }
 
 static gboolean ring_timer_cb(gpointer data)
 {
 	struct device *device = data;
+	struct headset *hs = device->headset;
 	int err;
 
-	err = headset_send(device->headset, "\r\nRING\r\n");
+	err = headset_send(hs, "\r\nRING\r\n");
 
-	if (err)
+	if (err < 0)
 		error("Sending RING failed");
 
 	return TRUE;
 }
 
@@ -1153,12 +1194,12 @@ static DBusHandlerResult hs_ring(DBusCon
 	if (hs->ring_timer) {
 		debug("IndicateCall received when already indicating");
 		goto done;
 	}
 
-	err = headset_send(device->headset, "\r\nRING\r\n");
-	if (err) {
+	err = headset_send(hs, "\r\nRING\r\n");
+	if (err < 0) {
 		dbus_message_unref(reply);
 		return error_failed(conn, msg, "Failed");
 	}
 
 	hs->ring_timer = g_timeout_add(RING_INTERVAL, ring_timer_cb, device);
@@ -1311,12 +1352,12 @@ static DBusHandlerResult hs_set_gain(DBu
 	if (!reply)
 		return DBUS_HANDLER_RESULT_NEED_MEMORY;
 
 	if (hs->state != HEADSET_STATE_PLAYING)
 		goto done;
-	err = headset_send(device->headset, "\r\n+VG%c=%u\r\n", type, gain);
-	if (err) {
+	err = headset_send(hs, "\r\n+VG%c=%u\r\n", type, gain);
+	if (err < 0) {
 		dbus_message_unref(reply);
 		return error_failed(conn, msg, "Unable to send to headset");
 	}
 
 done:
@@ -1377,10 +1418,11 @@ static DBusSignalVTable headset_signals[
 	{ "AnswerRequested",		""	},
 	{ "Stopped",			""	},
 	{ "Playing",			""	},
 	{ "SpeakerGainChanged",		"q"	},
 	{ "MicrophoneGainChanged",	"q"	},
+	{ "TerminateCall",		""	},
 	{ NULL, NULL }
 };
 
 static void headset_set_channel(struct headset *headset, sdp_record_t *record)
 {

[-- Attachment #3: 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 #4: Type: text/plain, Size: 164 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-08 14:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-08 11:20 [Bluez-devel] BlueZ as an Haedset Pierre Savary
2008-01-08 11:31 ` Simon Vogl
2008-01-08 14:03 ` [Bluez-devel] [PATCH] more headset.c fixes Alok

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox