aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikel Astiz <mikel.astiz@bmw-carit.de>2012-05-04 15:14:36 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2012-05-07 07:05:39 -0700
commitee14d62aba5dccd6d9108f7e4f944188c43fb1a3 (patch)
treee503d5dd5573c6b99da3fe3a8c5d55b1ecd13862
parent4523901db271776f1e5972dea6e982903ed4db5c (diff)
downloadbluez-ee14d62aba5dccd6d9108f7e4f944188c43fb1a3.tar.gz
bluez-ee14d62aba5dccd6d9108f7e4f944188c43fb1a3.tar.xz
bluez-ee14d62aba5dccd6d9108f7e4f944188c43fb1a3.zip
audio: Add multiple device search to manager
This method is useful to search for more than one device fulfulling certain criteria.
-rw-r--r--audio/manager.c25
-rw-r--r--audio/manager.h6
2 files changed, 28 insertions, 3 deletions
diff --git a/audio/manager.c b/audio/manager.c
index 20453e65..9c7d0d39 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -1300,12 +1300,13 @@ void audio_manager_exit(void)
btd_unregister_device_driver(&audio_driver);
}
-struct audio_device *manager_find_device(const char *path,
+GSList *manager_find_devices(const char *path,
const bdaddr_t *src,
const bdaddr_t *dst,
const char *interface,
gboolean connected)
{
+ GSList *result = NULL;
GSList *l;
for (l = devices; l != NULL; l = l->next) {
@@ -1343,10 +1344,28 @@ struct audio_device *manager_find_device(const char *path,
if (connected && !audio_device_is_active(dev, interface))
continue;
- return dev;
+ result = g_slist_append(result, dev);
}
- return NULL;
+ return result;
+}
+
+struct audio_device *manager_find_device(const char *path,
+ const bdaddr_t *src,
+ const bdaddr_t *dst,
+ const char *interface,
+ gboolean connected)
+{
+ struct audio_device *result;
+ GSList *l;
+
+ l = manager_find_devices(path, src, dst, interface, connected);
+ if (l == NULL)
+ return NULL;
+
+ result = l->data;
+ g_slist_free(l);
+ return result;
}
struct audio_device *manager_get_device(const bdaddr_t *src,
diff --git a/audio/manager.h b/audio/manager.h
index cfc646ce..f1d30214 100644
--- a/audio/manager.h
+++ b/audio/manager.h
@@ -46,6 +46,12 @@ struct audio_device *manager_find_device(const char *path,
const char *interface,
gboolean connected);
+GSList *manager_find_devices(const char *path,
+ const bdaddr_t *src,
+ const bdaddr_t *dst,
+ const char *interface,
+ gboolean connected);
+
struct audio_device *manager_get_device(const bdaddr_t *src,
const bdaddr_t *dst,
gboolean create);