public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] Patch proposal for serial manager
@ 2007-12-11 11:00 Geoffrey Doret
  2007-12-13 16:15 ` Marcel Holtmann
  0 siblings, 1 reply; 8+ messages in thread
From: Geoffrey Doret @ 2007-12-11 11:00 UTC (permalink / raw)
  To: bluez-devel


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

Hello,

I have added a connect service method in the serial service manager that
take the address of an adapter as first parameter to be able to use more
than one adapter. I realy would like to contribute to bluez and see my patch
applied to the CVS. This is a first proposal, if you have any remarks, I
will take them into account.

Geoffrey Doret

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

[-- Attachment #2: patch4 --]
[-- Type: application/octet-stream, Size: 3344 bytes --]

Index: utils/serial/manager.c
===================================================================
RCS file: /cvsroot/bluez/utils/serial/manager.c,v
retrieving revision 1.99
diff -u -r1.99 manager.c
--- utils/serial/manager.c	26 Nov 2007 13:43:57 -0000	1.99
+++ utils/serial/manager.c	11 Dec 2007 10:14:20 -0000
@@ -1917,26 +1917,43 @@
 	struct pending_connect *pending, *pc;
 	DBusError derr;
 	bdaddr_t src;
-	const char *bda, *pattern;
+	const char *adapter, *bda, *pattern;
 	long val;
 	int dev_id, err;
 	char uuid[MAX_LEN_UUID_STR];
 
 	dbus_error_init(&derr);
-	if (!dbus_message_get_args(msg, &derr,
-				DBUS_TYPE_STRING, &bda,
-				DBUS_TYPE_STRING, &pattern,
-				DBUS_TYPE_INVALID)) {
-		error_invalid_arguments(conn, msg, derr.message);
-		dbus_error_free(&derr);
-		return DBUS_HANDLER_RESULT_HANDLED;
+	if(dbus_message_has_signature(msg, "sss")) {
+		if (!dbus_message_get_args(msg, &derr,
+					DBUS_TYPE_STRING, &adapter,
+					DBUS_TYPE_STRING, &bda,
+					DBUS_TYPE_STRING, &pattern,
+					DBUS_TYPE_INVALID)) {
+			error_invalid_arguments(conn, msg, derr.message);
+			dbus_error_free(&derr);
+			return DBUS_HANDLER_RESULT_HANDLED;
+		}
+		/* Handle empty adapter as the default */
+		if(!adapter[0])
+			adapter = NULL;
+	} else {
+		if (!dbus_message_get_args(msg, &derr,
+					DBUS_TYPE_STRING, &bda,
+					DBUS_TYPE_STRING, &pattern,
+					DBUS_TYPE_INVALID)) {
+			error_invalid_arguments(conn, msg, derr.message);
+			dbus_error_free(&derr);
+			return DBUS_HANDLER_RESULT_HANDLED;
+		}
+		/* Use the default adapter */
+		adapter = NULL;
 	}
 
 	pending = find_pending_connect_by_pattern(bda, pattern);
 	if (pending)
 		return error_in_progress(conn, msg, "Connection in progress");
 
-	dev_id = hci_get_route(NULL);
+	dev_id = adapter ? hci_devid(adapter) : hci_get_route(NULL);
 	if ((dev_id < 0) || (hci_devba(dev_id, &src) < 0))
 		return error_failed(conn, msg, "Adapter not available");
 
@@ -2146,6 +2163,7 @@
 	{ "ListProxies",		list_proxies,		"",	"as"	},
 	{ "RemoveProxy",		remove_proxy,		"s",	""	},
 	{ "ConnectService",		connect_service,	"ss",	"s"	},
+	{ "ConnectServiceToAdapter",	connect_service,	"sss",	"s"	},
 	{ "DisconnectService",		disconnect_service,	"s",	""	},
 	{ "CancelConnectService",	cancel_connect_service,	"ss",	""	},
 	{ NULL, NULL, NULL, NULL },
Index: utils/serial/serial-api.txt
===================================================================
RCS file: /cvsroot/bluez/utils/serial/serial-api.txt,v
retrieving revision 1.21
diff -u -r1.21 serial-api.txt
--- utils/serial/serial-api.txt	26 Nov 2007 13:41:39 -0000	1.21
+++ utils/serial/serial-api.txt	11 Dec 2007 10:14:20 -0000
@@ -67,6 +67,21 @@
 					org.bluez.Error.ConnectionAttemptFailed
 					org.bluez.Error.NotSupported
 					org.bluez.Error.Failed
+		
+		string ConnectServiceToAdapter(string adapter, string address,
+				string pattern)
+
+			Connects to a specific RFCOMM based service on a
+			remote device using the specified adapter and then
+			creates a RFCOMM TTY device for it. The RFCOMM TTY
+			device is returned.
+
+			Possible errors:org.bluez.Error.InvalidArguments
+					org.bluez.Error.Canceled
+					org.bluez.Error.InProgress
+					org.bluez.Error.ConnectionAttemptFailed
+					org.bluez.Error.NotSupported
+					org.bluez.Error.Failed
 
 		void CancelConnectService(string address, string pattern)
 

[-- Attachment #3: Type: text/plain, Size: 277 bytes --]

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

[-- 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] 8+ messages in thread

end of thread, other threads:[~2007-12-21 21:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-11 11:00 [Bluez-devel] Patch proposal for serial manager Geoffrey Doret
2007-12-13 16:15 ` Marcel Holtmann
2007-12-20 14:15   ` Geoffrey Doret
2007-12-20 15:17     ` Marcel Holtmann
2007-12-21  9:16       ` Geoffrey Doret
2007-12-21  9:17       ` Geoffrey Doret
2007-12-21 15:35         ` Geoffrey Doret
2007-12-21 21:20           ` Claudio Takahasi

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