From: Arik Nemtsov <arik@wizery.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Arik Nemtsov <arik@wizery.com>
Subject: [PATCH 3/8] adapter: add DeviceAdded signal when existing device is added
Date: Thu, 8 Mar 2012 15:57:07 +0200 [thread overview]
Message-ID: <1331215032-27695-4-git-send-email-arik@wizery.com> (raw)
In-Reply-To: <1331215032-27695-1-git-send-email-arik@wizery.com>
Emit a signal when an existing device is added to the device list of the
adapter. These are devices which are added on adapter startup, from
stored link-keys, long-term-keys, etc. These devices will appear in the
"Devices" property of the adapter.
---
doc/adapter-api.txt | 5 +++++
src/adapter.c | 17 +++++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt
index 20cef03..99b5524 100644
--- a/doc/adapter-api.txt
+++ b/doc/adapter-api.txt
@@ -212,6 +212,11 @@ Signals PropertyChanged(string name, variant value)
Parameter is object path of removed device.
+ DeviceAdded(object device)
+
+ Parameter is object path of existing device added
+ to the device list.
+
Properties string Address [readonly]
The Bluetooth device address.
diff --git a/src/adapter.c b/src/adapter.c
index f817975..5054450 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1688,12 +1688,24 @@ static GDBusMethodTable adapter_methods[] = {
static GDBusSignalTable adapter_signals[] = {
{ "PropertyChanged", "sv" },
{ "DeviceCreated", "o" },
+ { "DeviceAdded", "o" },
{ "DeviceRemoved", "o" },
{ "DeviceFound", "sa{sv}" },
{ "DeviceDisappeared", "s" },
{ }
};
+static void emit_device_added(struct btd_adapter *adapter,
+ struct btd_device *device)
+{
+ const char *path = device_get_path(device);
+
+ g_dbus_emit_signal(connection, adapter->path,
+ ADAPTER_INTERFACE, "DeviceAdded",
+ DBUS_TYPE_OBJECT_PATH, &path,
+ DBUS_TYPE_INVALID);
+}
+
static void create_stored_device_from_profiles(char *key, char *value,
void *user_data)
{
@@ -1719,6 +1731,7 @@ static void create_stored_device_from_profiles(char *key, char *value,
device_probe_drivers(device, uuids);
g_slist_free_full(uuids, g_free);
+ emit_device_added(adapter, device);
}
struct adapter_keys {
@@ -1826,6 +1839,7 @@ static void create_stored_device_from_linkkeys(char *key, char *value,
if (device) {
device_set_temporary(device, FALSE);
adapter->devices = g_slist_append(adapter->devices, device);
+ emit_device_added(adapter, device);
}
}
@@ -1859,6 +1873,7 @@ static void create_stored_device_from_ltks(char *key, char *value,
if (device) {
device_set_temporary(device, FALSE);
adapter->devices = g_slist_append(adapter->devices, device);
+ emit_device_added(adapter, device);
}
}
@@ -1876,6 +1891,7 @@ static void create_stored_device_from_blocked(char *key, char *value,
if (device) {
device_set_temporary(device, FALSE);
adapter->devices = g_slist_append(adapter->devices, device);
+ emit_device_added(adapter, device);
}
}
@@ -1947,6 +1963,7 @@ static void create_stored_device_from_primary(char *key, char *value,
device_probe_drivers(device, uuids);
g_slist_free(uuids);
+ emit_device_added(adapter, device);
}
static void smp_key_free(void *data)
--
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 ` [PATCH 2/8] adapter: add API to find an existing device by D-Bus path Arik Nemtsov
2012-03-08 13:57 ` Arik Nemtsov [this message]
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-4-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).