Linux bluetooth development
 help / color / mirror / Atom feed
From: Daniel Gollub <dgollub@suse.de>
To: bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] Input service and multiple adapters
Date: Tue, 27 Mar 2007 17:42:24 +0100	[thread overview]
Message-ID: <200703271842.24684.dgollub@suse.de> (raw)
In-Reply-To: <200703252035.05891.dgollub@suse.de>

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

Hi Marcel,

as discussed in #bluez we should store the address of the adapter.
I renamed GetAddress() to GetPeerAddress() and added a new function 
GetLocalAddress(). Simple patch attachted ... i hope everyone is happy with 
this one...

best regards,
Daniel




[-- Attachment #2: bluez-utils-input_service-localaddress.diff --]
[-- Type: text/x-diff, Size: 2265 bytes --]

Index: input/device.c
===================================================================
RCS file: /cvsroot/bluez/utils/input/device.c,v
retrieving revision 1.37
diff -u -p -r1.37 device.c
--- input/device.c	22 Mar 2007 14:53:22 -0000	1.37
+++ input/device.c	27 Mar 2007 16:40:09 -0000
@@ -889,7 +889,28 @@ static DBusHandlerResult device_is_conne
 	return send_message_and_unref(conn, reply);
 }
 
-static DBusHandlerResult device_get_address(DBusConnection *conn,
+static DBusHandlerResult device_get_local_address(DBusConnection *conn,
+						DBusMessage *msg, void *data)
+{
+	struct device *idev = data;
+	DBusMessage *reply;
+	char addr[18];
+	const char *paddr = addr;
+
+	ba2str(&idev->src, addr);
+
+	reply = dbus_message_new_method_return(msg);
+	if (!reply)
+		return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+	dbus_message_append_args(reply,
+			DBUS_TYPE_STRING, &paddr,
+			DBUS_TYPE_INVALID);
+
+	return send_message_and_unref(conn, reply);
+}
+
+static DBusHandlerResult device_get_peer_address(DBusConnection *conn,
 						DBusMessage *msg, void *data)
 {
 	struct device *idev = data;
@@ -983,8 +1004,11 @@ static DBusHandlerResult device_message(
 	if (strcmp(member, "IsConnected") == 0)
 		return device_is_connected(conn, msg, data);
 
-	if (strcmp(member, "GetAddress") == 0)
-		return device_get_address(conn, msg, data);
+	if (strcmp(member, "GetLocalAddress") == 0)
+		return device_get_local_address(conn, msg, data);
+
+	if (strcmp(member, "GetPeerAddress") == 0)
+		return device_get_peer_address(conn, msg, data);
 
 	if (strcmp(member, "GetName") == 0)
 		return device_get_name(conn, msg, data);
Index: input/input-api.txt
===================================================================
RCS file: /cvsroot/bluez/utils/input/input-api.txt,v
retrieving revision 1.8
diff -u -p -r1.8 input-api.txt
--- input/input-api.txt	22 Mar 2007 14:55:35 -0000	1.8
+++ input/input-api.txt	27 Mar 2007 16:40:09 -0000
@@ -48,7 +48,13 @@ Service		org.bluez.input
 Interface	org.bluez.input.Device
 Object path	/org/bluez/input/{keyboard*|mouse*|...}
 
-Methods		string GetAddress()
+Methods		string GetLocalAddress()
+
+			Returns the adapter address.
+
+			Example: "00:11:22:33:44:55"
+
+		string GetPeerAddress()
 
 			Returns the device address.
 

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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- 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

      parent reply	other threads:[~2007-03-27 16:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-25 18:35 [Bluez-devel] Input service and multiple adapters Daniel Gollub
2007-03-26  7:06 ` Stefan Seyfried
2007-03-27 16:42 ` Daniel Gollub [this message]

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=200703271842.24684.dgollub@suse.de \
    --to=dgollub@suse.de \
    --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