Linux bluetooth development
 help / color / mirror / Atom feed
From: Mikel Astiz <mikel.astiz.oss@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: [RFC v2 13/15] adapter: Remove FindDevice method from D-Bus API
Date: Thu, 29 Nov 2012 13:47:34 +0100	[thread overview]
Message-ID: <1354193256-30610-14-git-send-email-mikel.astiz.oss@gmail.com> (raw)
In-Reply-To: <1354193256-30610-1-git-send-email-mikel.astiz.oss@gmail.com>

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

ObjectManager.GetManagedObjects() returns all devices and their
corresponding properties to any interested client. The device address is
included in the property dictionary and therefore having such a
FindDevice method is an unnecessary duplication.
---
 doc/adapter-api.txt |  7 -------
 src/adapter.c       | 38 --------------------------------------
 2 files changed, 45 deletions(-)

diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt
index 3582793..983a20d 100644
--- a/doc/adapter-api.txt
+++ b/doc/adapter-api.txt
@@ -64,13 +64,6 @@ Methods		void RequestSession()
 					 org.bluez.Error.Failed
 					 org.bluez.Error.NotAuthorized
 
-		object FindDevice(string address)
-
-			Returns the object path of device for given address.
-
-			Possible Errors: org.bluez.Error.DoesNotExist
-					 org.bluez.Error.InvalidArguments
-
 		void RemoveDevice(object device)
 
 			This removes the remote device object at the given
diff --git a/src/adapter.c b/src/adapter.c
index 1516a1d..41bdfb9 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1519,40 +1519,6 @@ static DBusMessage *remove_device(DBusConnection *conn, DBusMessage *msg,
 	return NULL;
 }
 
-static DBusMessage *find_device(DBusConnection *conn, DBusMessage *msg,
-								void *data)
-{
-	struct btd_adapter *adapter = data;
-	struct btd_device *device;
-	DBusMessage *reply;
-	const gchar *address;
-	GSList *l;
-	const gchar *dev_path;
-
-	if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &address,
-						DBUS_TYPE_INVALID))
-		return btd_error_invalid_args(msg);
-
-	l = g_slist_find_custom(adapter->devices,
-			address, (GCompareFunc) device_address_cmp);
-	if (!l)
-		return btd_error_does_not_exist(msg);
-
-	device = l->data;
-
-	reply = dbus_message_new_method_return(msg);
-	if (!reply)
-		return NULL;
-
-	dev_path = device_get_path(device);
-
-	dbus_message_append_args(reply,
-				DBUS_TYPE_OBJECT_PATH, &dev_path,
-				DBUS_TYPE_INVALID);
-
-	return reply;
-}
-
 static void agent_removed(struct agent *agent, struct btd_adapter *adapter)
 {
 	mgmt_set_io_capability(adapter->dev_id, IO_CAPABILITY_NOINPUTNOOUTPUT);
@@ -1624,10 +1590,6 @@ static const GDBusMethodTable adapter_methods[] = {
 	{ GDBUS_ASYNC_METHOD("RemoveDevice",
 			GDBUS_ARGS({ "device", "o" }), NULL,
 			remove_device) },
-	{ GDBUS_METHOD("FindDevice",
-			GDBUS_ARGS({ "address", "s" }),
-			GDBUS_ARGS({ "device", "o" }),
-			find_device) },
 	{ GDBUS_METHOD("RegisterAgent",
 			GDBUS_ARGS({ "agent", "o" },
 					{ "capability", "s" }), NULL,
-- 
1.7.11.7


  parent reply	other threads:[~2012-11-29 12:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29 12:47 [RFC v2 00/15] Manager/Adapter transition to ObjectManager Mikel Astiz
2012-11-29 12:47 ` [RFC v2 01/15] cups: Remove unnecessary code Mikel Astiz
2012-11-29 12:47 ` [RFC v2 02/15] test: Add utility library for python scripts Mikel Astiz
2012-11-30 12:28   ` Anderson Lizardo
2012-11-29 12:47 ` [RFC v2 03/15] test: Avoid using DefaultAdapter() Mikel Astiz
2012-11-29 12:47 ` [RFC v2 04/15] test: Update monitor script to ObjectManager Mikel Astiz
2012-11-29 12:47 ` [RFC v2 05/15] test: Update test-manager " Mikel Astiz
2012-11-29 12:47 ` [RFC v2 06/15] test: Use ObjectManager instead of Adapters property Mikel Astiz
2012-11-29 12:47 ` [RFC v2 07/15] dbus: Remove org.bluez.Manager Mikel Astiz
2012-11-29 12:47 ` [RFC v2 08/15] test: Use ObjectManager instead of Devices property Mikel Astiz
2012-11-29 12:47 ` [RFC v2 09/15] test: Add helper function to find devices Mikel Astiz
2012-11-29 12:47 ` [RFC v2 10/15] adapter: Remove DeviceCreated/DeviceRemoved signals Mikel Astiz
2012-11-29 12:47 ` [RFC v2 11/15] adapter: Remove redundant Devices property Mikel Astiz
2012-11-29 12:47 ` [RFC v2 12/15] test: Avoid using Adapter.FindDevice() Mikel Astiz
2012-11-29 12:47 ` Mikel Astiz [this message]
2012-11-29 12:47 ` [RFC v2 14/15] dbus: Rename to org.bluez.Device1 Mikel Astiz
2012-11-29 12:47 ` [RFC v2 15/15] dbus: Rename to org.bluez.Adapter1 Mikel Astiz
2012-11-29 18:12 ` [RFC v2 00/15] Manager/Adapter transition to ObjectManager Lucas De Marchi
2012-11-30 11:38   ` Mikel Astiz

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=1354193256-30610-14-git-send-email-mikel.astiz.oss@gmail.com \
    --to=mikel.astiz.oss@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mikel.astiz@bmw-carit.de \
    /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