public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "Geoffrey Doret" <gdoret@gmail.com>
To: "BlueZ development" <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] Patch proposal for serial manager
Date: Thu, 20 Dec 2007 15:15:51 +0100	[thread overview]
Message-ID: <3ad703600712200615i1c039fbep5076ac119bddef61@mail.gmail.com> (raw)
In-Reply-To: <1197562554.5644.95.camel@aeonflux>


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

Hi,

I tied to speak on the channel two times but it seems we are not present at
the same time. So I noted your remarks and reformulated my patch.
First, I opted for "ConnectServiceByAdapter" but changing the naming is
quite simple.
Second, the format of the new adapter parameter is a string "hciX" or a
string representing the adapter address.

Regards,
Geoffrey Doret

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: connect_service.patch --]
[-- Type: text/x-patch; name=connect_service.patch, Size: 3830 bytes --]

Index: utils/serial/manager.c
===================================================================
RCS file: /cvsroot/bluez/utils/serial/manager.c,v
retrieving revision 1.100
diff -u -r1.100 manager.c
--- utils/serial/manager.c	13 Dec 2007 19:07:37 -0000	1.100
+++ utils/serial/manager.c	20 Dec 2007 13:18:19 -0000
@@ -1991,32 +1991,20 @@
 			dbus_message_new_method_return(msg));
 }
 
-static DBusHandlerResult connect_service(DBusConnection *conn,
-					DBusMessage *msg, void *data)
+static DBusHandlerResult connect_service_by_devid(DBusConnection *conn,
+				DBusMessage *msg, void *data, int dev_id,
+				const char *bda, const char *pattern)
 {
 	struct pending_connect *pending, *pc;
-	DBusError derr;
 	bdaddr_t src;
-	const char *bda, *pattern;
 	long val;
-	int dev_id, err;
+	int 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;
-	}
-
 	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);
 	if ((dev_id < 0) || (hci_devba(dev_id, &src) < 0))
 		return error_failed(conn, msg, "Adapter not available");
 
@@ -2091,6 +2079,49 @@
 	return DBUS_HANDLER_RESULT_HANDLED;
 }
 
+static DBusHandlerResult connect_service(DBusConnection *conn,
+					DBusMessage *msg, void *data)
+{
+	DBusError derr;
+	const char *bda, *pattern;
+	int devid;
+
+	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;
+	}
+	devid = hci_get_route(NULL);
+
+	return connect_service_by_devid(conn, msg, data, devid, bda, pattern);
+}
+
+static DBusHandlerResult connect_service_by_adapter(DBusConnection *conn,
+					DBusMessage *msg, void *data)
+{
+	DBusError derr;
+	const char *adapter, *bda, *pattern;
+	int devid;
+
+	dbus_error_init(&derr);
+	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;
+	}
+	devid = hci_devid(adapter);
+
+	return connect_service_by_devid(conn, msg, data, devid, bda, pattern);
+}
+
 static DBusHandlerResult disconnect_service(DBusConnection *conn,
 					DBusMessage *msg, void *data)
 {
@@ -2219,15 +2250,16 @@
 }
 
 static DBusMethodVTable manager_methods[] = {
-	{ "CreatePort",			create_port,		"ss",	"s"	},
-	{ "ListPorts",			list_ports,		"",	"as"	},
-	{ "RemovePort",			remove_port,		"s",	""	},
-	{ "CreateProxy",		create_proxy,		"ss",	"s"	},
-	{ "ListProxies",		list_proxies,		"",	"as"	},
-	{ "RemoveProxy",		remove_proxy,		"s",	""	},
-	{ "ConnectService",		connect_service,	"ss",	"s"	},
-	{ "DisconnectService",		disconnect_service,	"s",	""	},
-	{ "CancelConnectService",	cancel_connect_service,	"ss",	""	},
+	{ "CreatePort",			create_port,			"ss",	"s"	},
+	{ "ListPorts",			list_ports,			"",	"as"	},
+	{ "RemovePort",			remove_port,			"s",	""	},
+	{ "CreateProxy",		create_proxy,			"ss",	"s"	},
+	{ "ListProxies",		list_proxies,			"",	"as"	},
+	{ "RemoveProxy",		remove_proxy,			"s",	""	},
+	{ "ConnectService",		connect_service,		"ss",	"s"	},
+	{ "ConnectServiceByAdapter",	connect_service_by_adapter,	"sss",	"s"	},
+	{ "DisconnectService",		disconnect_service,		"s",	""	},
+	{ "CancelConnectService",	cancel_connect_service,		"ss",	""	},
 	{ NULL, NULL, NULL, NULL },
 };
 

[-- Attachment #3: Type: text/plain, Size: 308 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://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

  reply	other threads:[~2007-12-20 14:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=3ad703600712200615i1c039fbep5076ac119bddef61@mail.gmail.com \
    --to=gdoret@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