From: "Geoffrey Doret" <gdoret@gmail.com>
To: "BlueZ development" <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] Patch proposal for serial manager
Date: Fri, 21 Dec 2007 16:35:17 +0100 [thread overview]
Message-ID: <3ad703600712210735oe566022k62f2959629140ab9@mail.gmail.com> (raw)
In-Reply-To: <3ad703600712210117o284990d5mbd3928923845abe7@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 205 bytes --]
The same patch as the previous one but with
"ConnectServiceFromAdapter" naming and the method noted experimental
in the documentation.
Let me know if the patch is accepted or not.
Regards,
Geoffrey Doret
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: connect_service.patch --]
[-- Type: text/x-patch; name=connect_service.patch, Size: 4901 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 21 Dec 2007 15:22:02 -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_from_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,51 @@
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_from_devid(conn, msg, data, devid, bda, pattern);
+}
+
+static DBusHandlerResult connect_service_from_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_from_devid(conn, msg, data, devid, bda, pattern);
+}
+
static DBusHandlerResult disconnect_service(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -2219,15 +2252,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" },
+ { "ConnectServiceFromAdapter", connect_service_from_adapter, "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 21 Dec 2007 15:22:02 -0000
@@ -68,6 +68,21 @@
org.bluez.Error.NotSupported
org.bluez.Error.Failed
+ string ConnectServiceFromAdapter(string adapter, string address,
+ string pattern) [experimental]
+
+ Use the given adapter to connects to a specific RFCOMM
+ based service on a remote device 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)
Cancel a previous ConnectService method call.
[-- Attachment #3: Type: text/plain, Size: 228 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
[-- 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
next prev parent reply other threads:[~2007-12-21 15:35 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
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 [this message]
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=3ad703600712210735oe566022k62f2959629140ab9@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