From: Arik Nemtsov <arik@wizery.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Arik Nemtsov <arik@wizery.com>
Subject: [PATCH 2/8] adapter: add API to find an existing device by D-Bus path
Date: Thu, 8 Mar 2012 15:57:06 +0200 [thread overview]
Message-ID: <1331215032-27695-3-git-send-email-arik@wizery.com> (raw)
In-Reply-To: <1331215032-27695-1-git-send-email-arik@wizery.com>
This allows us to get a btd_device from information passed in D-Bus
method calls or signals.
---
src/adapter.c | 15 +++++++++++++++
src/adapter.h | 2 ++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index acb845e..f817975 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3531,3 +3531,18 @@ int btd_adapter_remove_remote_oob_data(struct btd_adapter *adapter,
{
return adapter_ops->remove_remote_oob_data(adapter->dev_id, bdaddr);
}
+
+struct btd_device *adapter_get_device_by_path(struct btd_adapter *adapter,
+ const char *path)
+{
+ GSList *l;
+
+ for (l = adapter->devices; l != NULL; l = g_slist_next(l))
+ if (g_strcmp0(device_get_path(l->data), path) == 0)
+ break;
+
+ if (!l)
+ return NULL;
+
+ return l->data;
+}
diff --git a/src/adapter.h b/src/adapter.h
index ceebb97..4933baf 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -294,3 +294,5 @@ int btd_adapter_remove_remote_oob_data(struct btd_adapter *adapter,
int btd_adapter_gatt_server_start(struct btd_adapter *adapter);
void btd_adapter_gatt_server_stop(struct btd_adapter *adapter);
+struct btd_device *adapter_get_device_by_path(struct btd_adapter *adapter,
+ const char *path);
--
1.7.5.4
next prev parent reply other threads:[~2012-03-08 13:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-08 13:57 [PATCH 0/8] Implement ProximityReporter profiles Arik Nemtsov
2012-03-08 13:57 ` [PATCH 1/8] att: add remote btd_device to ATT read/write callbacks Arik Nemtsov
2012-03-08 13:57 ` Arik Nemtsov [this message]
2012-03-08 13:57 ` [PATCH 3/8] adapter: add DeviceAdded signal when existing device is added Arik Nemtsov
2012-03-08 13:57 ` [PATCH 4/8] proximity: reporter: save global D-Bus connection Arik Nemtsov
2012-03-08 13:57 ` [PATCH 5/8] proximity: reporter: move definitions to .h and add util function Arik Nemtsov
2012-03-08 13:57 ` [PATCH 6/8] proximity: link loss: implement link loss server Arik Nemtsov
2012-03-14 13:09 ` Anderson Lizardo
2012-03-14 20:54 ` Arik Nemtsov
2012-03-08 13:57 ` [PATCH 7/8] proximity: immediate alert: implement immediate alert server Arik Nemtsov
2012-03-08 13:57 ` [PATCH 8/8] proximity: reporter: implement D-Bus API Arik Nemtsov
2012-03-14 13:19 ` Anderson Lizardo
2012-03-14 20:56 ` Arik Nemtsov
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=1331215032-27695-3-git-send-email-arik@wizery.com \
--to=arik@wizery.com \
--cc=linux-bluetooth@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).