bluetooth: GetProperties after profile UUID show up
authorMarc-André Lureau <marc-andre.lureau@nokia.com>
Fri, 27 Mar 2009 11:56:26 +0000 (13:56 +0200)
committerMarc-André Lureau <marc-andre.lureau@nokia.com>
Fri, 27 Mar 2009 20:59:56 +0000 (22:59 +0200)
src/modules/bluetooth/bluetooth-util.c
src/modules/bluetooth/bluetooth-util.h

index 3d410c52dc4ff7e96ac6fdc94a764ee2bcdd49cb..dfebf66376aec847ab74ac6c7d16a9d2c5a52674 100644 (file)
@@ -39,6 +39,9 @@ struct pa_bluetooth_discovery {
     pa_hook hook;
 };
 
+static void get_properties_reply(DBusPendingCall *pending, void *userdata);
+static pa_dbus_pending* send_and_add_to_pending(pa_bluetooth_discovery *y, pa_bluetooth_device *d, DBusMessage *m, DBusPendingCallNotifyFunction func);
+
 static pa_bluetooth_uuid *uuid_new(const char *uuid) {
     pa_bluetooth_uuid *u;
 
@@ -213,11 +216,20 @@ static int parse_device_property(pa_bluetooth_discovery *y, pa_bluetooth_device
                 while (dbus_message_iter_get_arg_type(&ai) != DBUS_TYPE_INVALID) {
                     pa_bluetooth_uuid *node;
                     const char *value;
+                    DBusMessage *m;
 
                     dbus_message_iter_get_basic(&ai, &value);
                     node = uuid_new(value);
                     PA_LLIST_PREPEND(pa_bluetooth_uuid, d->uuids, node);
 
+                    if (strcasecmp(HSP_HS_UUID, value) == 0 || strcasecmp(HFP_HS_UUID, value) == 0) {
+                        pa_assert_se(m = dbus_message_new_method_call("org.bluez", d->path, "org.bluez.Headset", "GetProperties"));
+                        send_and_add_to_pending(y, d, m, get_properties_reply);
+                    } else if (strcasecmp(A2DP_SINK_UUID, value) == 0) {
+                        pa_assert_se(m = dbus_message_new_method_call("org.bluez", d->path, "org.bluez.AudioSink", "GetProperties"));
+                        send_and_add_to_pending(y, d, m, get_properties_reply);
+                    }
+
                     if (!dbus_message_iter_next(&ai))
                         break;
                 }
index 1d05e63c05a91b9752420f8d940348c5fddade2e..57f117259eb71156163888990c10e0028fbce338 100644 (file)
 #include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
 
+/* UUID copied from bluez/audio/device.h */
+#define GENERIC_AUDIO_UUID      "00001203-0000-1000-8000-00805F9B34FB"
+
+#define HSP_HS_UUID             "00001108-0000-1000-8000-00805F9B34FB"
+#define HSP_AG_UUID             "00001112-0000-1000-8000-00805F9B34FB"
+
+#define HFP_HS_UUID             "0000111E-0000-1000-8000-00805F9B34FB"
+#define HFP_AG_UUID             "0000111F-0000-1000-8000-00805F9B34FB"
+
+#define ADVANCED_AUDIO_UUID     "0000110D-0000-1000-8000-00805F9B34FB"
+
+#define A2DP_SOURCE_UUID        "0000110A-0000-1000-8000-00805F9B34FB"
+#define A2DP_SINK_UUID          "0000110B-0000-1000-8000-00805F9B34FB"
+
 typedef struct pa_bluetooth_uuid pa_bluetooth_uuid;
 typedef struct pa_bluetooth_device pa_bluetooth_device;
 typedef struct pa_bluetooth_discovery pa_bluetooth_discovery;