summaryrefslogtreecommitdiffstats
path: root/audio/device.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-08-23 23:37:15 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-08-23 23:37:15 +0000
commit92f94938b981fe6a892e365670d5fa4d58c94283 (patch)
tree23abac947787c454f1955e0e510d17b0c1516711 /audio/device.c
parent0a527f667ae62ac335f22d1d053179b20ff26e94 (diff)
Add support for ALSA parameters
Diffstat (limited to 'audio/device.c')
-rw-r--r--audio/device.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/audio/device.c b/audio/device.c
index 2a6498ee..2c06233e 100644
--- a/audio/device.c
+++ b/audio/device.c
@@ -417,3 +417,26 @@ uint8_t device_get_state(struct device *dev)
return STATE_DISCONNECTED;
}
+
+gboolean device_is_connected(struct device *dev, const char *interface)
+{
+ if (!interface) {
+ if ((dev->sink || dev->source) &&
+ avdtp_is_connected(&dev->src, &dev->dst))
+ return TRUE;
+
+ if (dev->headset && headset_is_active(dev))
+ return TRUE;
+ }
+ else if (!strcmp(interface, AUDIO_SINK_INTERFACE) && dev->sink &&
+ avdtp_is_connected(&dev->src, &dev->dst))
+ return TRUE;
+ else if (!strcmp(interface, AUDIO_SOURCE_INTERFACE) && dev->source &&
+ avdtp_is_connected(&dev->src, &dev->dst))
+ return TRUE;
+ else if (!strcmp(interface, AUDIO_HEADSET_INTERFACE) && dev->headset &&
+ headset_is_active(dev))
+ return TRUE;
+
+ return FALSE;
+}