[pulseaudio-discuss] [PATCHv2 16/60] bluetooth: Name BlueZ 4 symbols accordingly

jprvita at gmail.com jprvita at gmail.com
Mon Aug 12 21:53:54 PDT 2013


From: João Paulo Rechi Vita <jprvita at openbossa.org>

We need diferent symbol prefixing for the current BlueZ 4 support and
the new BlueZ 5 support which is about to enter the codebase, to avoid
symbol clashing and crashing the daemon in the case both modules are
loaded at the same time.

This commit replaces all pa_bluetooth_ and pa_bt_ (for consistency)
prefixes with pa_bluez4_, for both lower-case and upper-case, what was
done with the following sed commands:

 $ sed -i s/pa_bluetooth_/pa_bluez4_/g src/modules/bluetooth/*bluez4*
 $ sed -i s/PA_BLUETOOTH_/PA_BLUEZ4_/g src/modules/bluetooth/*bluez4*
 $ sed -i s/pa_bt_/pa_bluez4_/g src/modules/bluetooth/*bluez4*
 $ sed -i s/PA_BT_/PA_BLUEZ4_/g src/modules/bluetooth/*bluez4*
---
 src/modules/bluetooth/bluez4-util.c            | 312 ++++++++++++-------------
 src/modules/bluetooth/bluez4-util.h            | 144 ++++++------
 src/modules/bluetooth/module-bluez4-device.c   | 140 +++++------
 src/modules/bluetooth/module-bluez4-discover.c |  12 +-
 4 files changed, 304 insertions(+), 304 deletions(-)

diff --git a/src/modules/bluetooth/bluez4-util.c b/src/modules/bluetooth/bluez4-util.c
index 4179783..79e2dc8 100644
--- a/src/modules/bluetooth/bluez4-util.c
+++ b/src/modules/bluetooth/bluez4-util.c
@@ -61,7 +61,7 @@
     " </interface>"                                                     \
     "</node>"
 
-struct pa_bluetooth_discovery {
+struct pa_bluez4_discovery {
     PA_REFCNT_DECLARE;
 
     pa_core *core;
@@ -70,32 +70,32 @@ struct pa_bluetooth_discovery {
     bool adapters_listed;
     pa_hashmap *devices;
     pa_hashmap *transports;
-    pa_hook hooks[PA_BLUETOOTH_HOOK_MAX];
+    pa_hook hooks[PA_BLUEZ4_HOOK_MAX];
     bool filter_added;
 };
 
 static void get_properties_reply(DBusPendingCall *pending, void *userdata);
-static pa_dbus_pending* send_and_add_to_pending(pa_bluetooth_discovery *y, DBusMessage *m, DBusPendingCallNotifyFunction func,
+static pa_dbus_pending* send_and_add_to_pending(pa_bluez4_discovery *y, DBusMessage *m, DBusPendingCallNotifyFunction func,
                                                 void *call_data);
-static void found_adapter(pa_bluetooth_discovery *y, const char *path);
-static pa_bluetooth_device *found_device(pa_bluetooth_discovery *y, const char* path);
+static void found_adapter(pa_bluez4_discovery *y, const char *path);
+static pa_bluez4_device *found_device(pa_bluez4_discovery *y, const char* path);
 
-static pa_bt_audio_state_t audio_state_from_string(const char* value) {
+static pa_bluez4_audio_state_t audio_state_from_string(const char* value) {
     pa_assert(value);
 
     if (pa_streq(value, "disconnected"))
-        return PA_BT_AUDIO_STATE_DISCONNECTED;
+        return PA_BLUEZ4_AUDIO_STATE_DISCONNECTED;
     else if (pa_streq(value, "connecting"))
-        return PA_BT_AUDIO_STATE_CONNECTING;
+        return PA_BLUEZ4_AUDIO_STATE_CONNECTING;
     else if (pa_streq(value, "connected"))
-        return PA_BT_AUDIO_STATE_CONNECTED;
+        return PA_BLUEZ4_AUDIO_STATE_CONNECTED;
     else if (pa_streq(value, "playing"))
-        return PA_BT_AUDIO_STATE_PLAYING;
+        return PA_BLUEZ4_AUDIO_STATE_PLAYING;
 
-    return PA_BT_AUDIO_STATE_INVALID;
+    return PA_BLUEZ4_AUDIO_STATE_INVALID;
 }
 
-const char *pa_bt_profile_to_string(enum profile profile) {
+const char *pa_bluez4_profile_to_string(enum profile profile) {
     switch(profile) {
         case PROFILE_A2DP:
             return "a2dp";
@@ -133,46 +133,46 @@ static int profile_from_interface(const char *interface, enum profile *p) {
     return -1;
 }
 
-static pa_bluetooth_transport_state_t audio_state_to_transport_state(pa_bt_audio_state_t state) {
+static pa_bluez4_transport_state_t audio_state_to_transport_state(pa_bluez4_audio_state_t state) {
     switch (state) {
-        case PA_BT_AUDIO_STATE_INVALID: /* Typically if state hasn't been received yet */
-        case PA_BT_AUDIO_STATE_DISCONNECTED:
-        case PA_BT_AUDIO_STATE_CONNECTING:
-            return PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED;
-        case PA_BT_AUDIO_STATE_CONNECTED:
-            return PA_BLUETOOTH_TRANSPORT_STATE_IDLE;
-        case PA_BT_AUDIO_STATE_PLAYING:
-            return PA_BLUETOOTH_TRANSPORT_STATE_PLAYING;
+        case PA_BLUEZ4_AUDIO_STATE_INVALID: /* Typically if state hasn't been received yet */
+        case PA_BLUEZ4_AUDIO_STATE_DISCONNECTED:
+        case PA_BLUEZ4_AUDIO_STATE_CONNECTING:
+            return PA_BLUEZ4_TRANSPORT_STATE_DISCONNECTED;
+        case PA_BLUEZ4_AUDIO_STATE_CONNECTED:
+            return PA_BLUEZ4_TRANSPORT_STATE_IDLE;
+        case PA_BLUEZ4_AUDIO_STATE_PLAYING:
+            return PA_BLUEZ4_TRANSPORT_STATE_PLAYING;
     }
 
     pa_assert_not_reached();
 }
 
-static pa_bluetooth_uuid *uuid_new(const char *uuid) {
-    pa_bluetooth_uuid *u;
+static pa_bluez4_uuid *uuid_new(const char *uuid) {
+    pa_bluez4_uuid *u;
 
-    u = pa_xnew(pa_bluetooth_uuid, 1);
+    u = pa_xnew(pa_bluez4_uuid, 1);
     u->uuid = pa_xstrdup(uuid);
-    PA_LLIST_INIT(pa_bluetooth_uuid, u);
+    PA_LLIST_INIT(pa_bluez4_uuid, u);
 
     return u;
 }
 
-static void uuid_free(pa_bluetooth_uuid *u) {
+static void uuid_free(pa_bluez4_uuid *u) {
     pa_assert(u);
 
     pa_xfree(u->uuid);
     pa_xfree(u);
 }
 
-static pa_bluetooth_device* device_new(pa_bluetooth_discovery *discovery, const char *path) {
-    pa_bluetooth_device *d;
+static pa_bluez4_device* device_new(pa_bluez4_discovery *discovery, const char *path) {
+    pa_bluez4_device *d;
     unsigned i;
 
     pa_assert(discovery);
     pa_assert(path);
 
-    d = pa_xnew0(pa_bluetooth_device, 1);
+    d = pa_xnew0(pa_bluez4_device, 1);
 
     d->discovery = discovery;
     d->dead = false;
@@ -183,20 +183,20 @@ static pa_bluetooth_device* device_new(pa_bluetooth_discovery *discovery, const
     d->path = pa_xstrdup(path);
     d->paired = -1;
     d->alias = NULL;
-    PA_LLIST_HEAD_INIT(pa_bluetooth_uuid, d->uuids);
+    PA_LLIST_HEAD_INIT(pa_bluez4_uuid, d->uuids);
     d->address = NULL;
     d->class = -1;
     d->trusted = -1;
 
-    d->audio_state = PA_BT_AUDIO_STATE_INVALID;
+    d->audio_state = PA_BLUEZ4_AUDIO_STATE_INVALID;
 
-    for (i = 0; i < PA_BLUETOOTH_PROFILE_COUNT; i++)
-        d->profile_state[i] = PA_BT_AUDIO_STATE_INVALID;
+    for (i = 0; i < PA_BLUEZ4_PROFILE_COUNT; i++)
+        d->profile_state[i] = PA_BLUEZ4_AUDIO_STATE_INVALID;
 
     return d;
 }
 
-static void transport_free(pa_bluetooth_transport *t) {
+static void transport_free(pa_bluez4_transport *t) {
     pa_assert(t);
 
     pa_xfree(t->owner);
@@ -205,26 +205,26 @@ static void transport_free(pa_bluetooth_transport *t) {
     pa_xfree(t);
 }
 
-static void device_free(pa_bluetooth_device *d) {
-    pa_bluetooth_uuid *u;
-    pa_bluetooth_transport *t;
+static void device_free(pa_bluez4_device *d) {
+    pa_bluez4_uuid *u;
+    pa_bluez4_transport *t;
     unsigned i;
 
     pa_assert(d);
 
-    for (i = 0; i < PA_BLUETOOTH_PROFILE_COUNT; i++) {
+    for (i = 0; i < PA_BLUEZ4_PROFILE_COUNT; i++) {
         if (!(t = d->transports[i]))
             continue;
 
         d->transports[i] = NULL;
         pa_hashmap_remove(d->discovery->transports, t->path);
-        t->state = PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED;
-        pa_hook_fire(&d->discovery->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED], t);
+        t->state = PA_BLUEZ4_TRANSPORT_STATE_DISCONNECTED;
+        pa_hook_fire(&d->discovery->hooks[PA_BLUEZ4_HOOK_TRANSPORT_STATE_CHANGED], t);
         transport_free(t);
     }
 
     while ((u = d->uuids)) {
-        PA_LLIST_REMOVE(pa_bluetooth_uuid, d->uuids, u);
+        PA_LLIST_REMOVE(pa_bluez4_uuid, d->uuids, u);
         uuid_free(u);
     }
 
@@ -260,7 +260,7 @@ static const char *check_variant_property(DBusMessageIter *i) {
     return key;
 }
 
-static int parse_manager_property(pa_bluetooth_discovery *y, DBusMessageIter *i, bool is_property_change) {
+static int parse_manager_property(pa_bluez4_discovery *y, DBusMessageIter *i, bool is_property_change) {
     const char *key;
     DBusMessageIter variant_i;
 
@@ -303,7 +303,7 @@ static int parse_manager_property(pa_bluetooth_discovery *y, DBusMessageIter *i,
     return 0;
 }
 
-static int parse_adapter_property(pa_bluetooth_discovery *y, DBusMessageIter *i, bool is_property_change) {
+static int parse_adapter_property(pa_bluez4_discovery *y, DBusMessageIter *i, bool is_property_change) {
     const char *key;
     DBusMessageIter variant_i;
 
@@ -343,7 +343,7 @@ static int parse_adapter_property(pa_bluetooth_discovery *y, DBusMessageIter *i,
     return 0;
 }
 
-static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i, bool is_property_change) {
+static int parse_device_property(pa_bluez4_device *d, DBusMessageIter *i, bool is_property_change) {
     const char *key;
     DBusMessageIter variant_i;
 
@@ -427,23 +427,23 @@ static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i, boo
                 bool has_audio = false;
 
                 while (dbus_message_iter_get_arg_type(&ai) != DBUS_TYPE_INVALID) {
-                    pa_bluetooth_uuid *node;
+                    pa_bluez4_uuid *node;
                     const char *value;
-                    struct pa_bluetooth_hook_uuid_data uuiddata;
+                    struct pa_bluez4_hook_uuid_data uuiddata;
 
                     dbus_message_iter_get_basic(&ai, &value);
 
-                    if (pa_bluetooth_uuid_has(d->uuids, value)) {
+                    if (pa_bluez4_uuid_has(d->uuids, value)) {
                         dbus_message_iter_next(&ai);
                         continue;
                     }
 
                     node = uuid_new(value);
-                    PA_LLIST_PREPEND(pa_bluetooth_uuid, d->uuids, node);
+                    PA_LLIST_PREPEND(pa_bluez4_uuid, d->uuids, node);
 
                     uuiddata.device = d;
                     uuiddata.uuid = value;
-                    pa_hook_fire(&d->discovery->hooks[PA_BLUETOOTH_HOOK_DEVICE_UUID_ADDED], &uuiddata);
+                    pa_hook_fire(&d->discovery->hooks[PA_BLUEZ4_HOOK_DEVICE_UUID_ADDED], &uuiddata);
 
                     /* Vudentz said the interfaces are here when the UUIDs are announced */
                     if (strcasecmp(HSP_AG_UUID, value) == 0 || strcasecmp(HFP_AG_UUID, value) == 0) {
@@ -487,21 +487,21 @@ static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i, boo
     return 0;
 }
 
-static const char *transport_state_to_string(pa_bluetooth_transport_state_t state) {
+static const char *transport_state_to_string(pa_bluez4_transport_state_t state) {
     switch (state) {
-        case PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED:
+        case PA_BLUEZ4_TRANSPORT_STATE_DISCONNECTED:
             return "disconnected";
-        case PA_BLUETOOTH_TRANSPORT_STATE_IDLE:
+        case PA_BLUEZ4_TRANSPORT_STATE_IDLE:
             return "idle";
-        case PA_BLUETOOTH_TRANSPORT_STATE_PLAYING:
+        case PA_BLUEZ4_TRANSPORT_STATE_PLAYING:
             return "playing";
     }
 
     pa_assert_not_reached();
 }
 
-static int parse_audio_property(pa_bluetooth_device *d, const char *interface, DBusMessageIter *i, bool is_property_change) {
-    pa_bluetooth_transport *transport;
+static int parse_audio_property(pa_bluez4_device *d, const char *interface, DBusMessageIter *i, bool is_property_change) {
+    pa_bluez4_transport *transport;
     const char *key;
     DBusMessageIter variant_i;
     bool is_audio_interface;
@@ -533,12 +533,12 @@ static int parse_audio_property(pa_bluetooth_device *d, const char *interface, D
             dbus_message_iter_get_basic(&variant_i, &value);
 
             if (pa_streq(key, "State")) {
-                pa_bt_audio_state_t state = audio_state_from_string(value);
-                pa_bluetooth_transport_state_t old_state;
+                pa_bluez4_audio_state_t state = audio_state_from_string(value);
+                pa_bluez4_transport_state_t old_state;
 
                 pa_log_debug("Device %s interface %s property 'State' changed to value '%s'", d->path, interface, value);
 
-                if (state == PA_BT_AUDIO_STATE_INVALID)
+                if (state == PA_BLUEZ4_AUDIO_STATE_INVALID)
                     return -1;
 
                 if (is_audio_interface) {
@@ -558,10 +558,10 @@ static int parse_audio_property(pa_bluetooth_device *d, const char *interface, D
 
                 if (transport->state != old_state) {
                     pa_log_debug("Transport %s (profile %s) changed state from %s to %s.", transport->path,
-                                 pa_bt_profile_to_string(transport->profile), transport_state_to_string(old_state),
+                                 pa_bluez4_profile_to_string(transport->profile), transport_state_to_string(old_state),
                                  transport_state_to_string(transport->state));
 
-                    pa_hook_fire(&d->discovery->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED], transport);
+                    pa_hook_fire(&d->discovery->hooks[PA_BLUEZ4_HOOK_TRANSPORT_STATE_CHANGED], transport);
                 }
             }
 
@@ -587,7 +587,7 @@ static int parse_audio_property(pa_bluetooth_device *d, const char *interface, D
                     break;
 
                 transport->microphone_gain = gain;
-                pa_hook_fire(&d->discovery->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_MICROPHONE_GAIN_CHANGED], transport);
+                pa_hook_fire(&d->discovery->hooks[PA_BLUEZ4_HOOK_TRANSPORT_MICROPHONE_GAIN_CHANGED], transport);
             } else if (pa_streq(key, "SpeakerGain")) {
                 uint16_t gain;
 
@@ -602,7 +602,7 @@ static int parse_audio_property(pa_bluetooth_device *d, const char *interface, D
                     break;
 
                 transport->speaker_gain = gain;
-                pa_hook_fire(&d->discovery->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_SPEAKER_GAIN_CHANGED], transport);
+                pa_hook_fire(&d->discovery->hooks[PA_BLUEZ4_HOOK_TRANSPORT_SPEAKER_GAIN_CHANGED], transport);
             }
 
             break;
@@ -612,18 +612,18 @@ static int parse_audio_property(pa_bluetooth_device *d, const char *interface, D
     return 0;
 }
 
-static void run_callback(pa_bluetooth_device *d, bool dead) {
+static void run_callback(pa_bluez4_device *d, bool dead) {
     pa_assert(d);
 
     if (d->device_info_valid != 1)
         return;
 
     d->dead = dead;
-    pa_hook_fire(&d->discovery->hooks[PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED], d);
+    pa_hook_fire(&d->discovery->hooks[PA_BLUEZ4_HOOK_DEVICE_CONNECTION_CHANGED], d);
 }
 
-static void remove_all_devices(pa_bluetooth_discovery *y) {
-    pa_bluetooth_device *d;
+static void remove_all_devices(pa_bluez4_discovery *y) {
+    pa_bluez4_device *d;
 
     pa_assert(y);
 
@@ -633,9 +633,9 @@ static void remove_all_devices(pa_bluetooth_discovery *y) {
     }
 }
 
-static pa_bluetooth_device *found_device(pa_bluetooth_discovery *y, const char* path) {
+static pa_bluez4_device *found_device(pa_bluez4_discovery *y, const char* path) {
     DBusMessage *m;
-    pa_bluetooth_device *d;
+    pa_bluez4_device *d;
 
     pa_assert(y);
     pa_assert(path);
@@ -660,8 +660,8 @@ static void get_properties_reply(DBusPendingCall *pending, void *userdata) {
     DBusMessage *r;
     DBusMessageIter arg_i, element_i;
     pa_dbus_pending *p;
-    pa_bluetooth_device *d;
-    pa_bluetooth_discovery *y;
+    pa_bluez4_device *d;
+    pa_bluez4_discovery *y;
     int valid;
     bool old_any_connected;
 
@@ -687,7 +687,7 @@ static void get_properties_reply(DBusPendingCall *pending, void *userdata) {
     pa_assert(p->call_data == d);
 
     if (d != NULL)
-        old_any_connected = pa_bluetooth_device_any_audio_connected(d);
+        old_any_connected = pa_bluez4_device_any_audio_connected(d);
 
     valid = dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_ERROR ? -1 : 1;
 
@@ -745,7 +745,7 @@ static void get_properties_reply(DBusPendingCall *pending, void *userdata) {
     }
 
 finish:
-    if (d != NULL && old_any_connected != pa_bluetooth_device_any_audio_connected(d))
+    if (d != NULL && old_any_connected != pa_bluez4_device_any_audio_connected(d))
         run_callback(d, false);
 
 finish2:
@@ -755,7 +755,7 @@ finish2:
     pa_dbus_pending_free(p);
 }
 
-static pa_dbus_pending* send_and_add_to_pending(pa_bluetooth_discovery *y, DBusMessage *m, DBusPendingCallNotifyFunction func,
+static pa_dbus_pending* send_and_add_to_pending(pa_bluez4_discovery *y, DBusMessage *m, DBusPendingCallNotifyFunction func,
                                                 void *call_data) {
     pa_dbus_pending *p;
     DBusPendingCall *call;
@@ -775,7 +775,7 @@ static pa_dbus_pending* send_and_add_to_pending(pa_bluetooth_discovery *y, DBusM
 static void register_endpoint_reply(DBusPendingCall *pending, void *userdata) {
     DBusMessage *r;
     pa_dbus_pending *p;
-    pa_bluetooth_discovery *y;
+    pa_bluez4_discovery *y;
     char *endpoint;
 
     pa_assert(pending);
@@ -790,7 +790,7 @@ static void register_endpoint_reply(DBusPendingCall *pending, void *userdata) {
         goto finish;
     }
 
-    if (dbus_message_is_error(r, PA_BLUETOOTH_ERROR_NOT_SUPPORTED)) {
+    if (dbus_message_is_error(r, PA_BLUEZ4_ERROR_NOT_SUPPORTED)) {
         pa_log_info("Couldn't register endpoint %s, because BlueZ is configured to disable the endpoint type.", endpoint);
         goto finish;
     }
@@ -810,7 +810,7 @@ finish:
     pa_xfree(endpoint);
 }
 
-static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const char *endpoint, const char *uuid) {
+static void register_endpoint(pa_bluez4_discovery *y, const char *path, const char *endpoint, const char *uuid) {
     DBusMessage *m;
     DBusMessageIter i, d;
     uint8_t codec = 0;
@@ -856,7 +856,7 @@ static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const
     send_and_add_to_pending(y, m, register_endpoint_reply, pa_xstrdup(endpoint));
 }
 
-static void found_adapter(pa_bluetooth_discovery *y, const char *path) {
+static void found_adapter(pa_bluez4_discovery *y, const char *path) {
     DBusMessage *m;
 
     pa_assert_se(m = dbus_message_new_method_call("org.bluez", path, "org.bluez.Adapter", "GetProperties"));
@@ -868,7 +868,7 @@ static void found_adapter(pa_bluetooth_discovery *y, const char *path) {
     register_endpoint(y, path, A2DP_SINK_ENDPOINT, A2DP_SINK_UUID);
 }
 
-static void list_adapters(pa_bluetooth_discovery *y) {
+static void list_adapters(pa_bluez4_discovery *y) {
     DBusMessage *m;
     pa_assert(y);
 
@@ -876,7 +876,7 @@ static void list_adapters(pa_bluetooth_discovery *y) {
     send_and_add_to_pending(y, m, get_properties_reply, NULL);
 }
 
-static int transport_parse_property(pa_bluetooth_transport *t, DBusMessageIter *i) {
+static int transport_parse_property(pa_bluez4_transport *t, DBusMessageIter *i) {
     const char *key;
     DBusMessageIter variant_i;
 
@@ -896,7 +896,7 @@ static int transport_parse_property(pa_bluetooth_transport *t, DBusMessageIter *
             if (pa_streq(key, "NREC") && t->nrec != value) {
                 t->nrec = value;
                 pa_log_debug("Transport %s: Property 'NREC' changed to %s.", t->path, t->nrec ? "True" : "False");
-                pa_hook_fire(&t->device->discovery->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_NREC_CHANGED], t);
+                pa_hook_fire(&t->device->discovery->hooks[PA_BLUEZ4_HOOK_TRANSPORT_NREC_CHANGED], t);
             }
 
             break;
@@ -908,7 +908,7 @@ static int transport_parse_property(pa_bluetooth_transport *t, DBusMessageIter *
 
 static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *userdata) {
     DBusError err;
-    pa_bluetooth_discovery *y;
+    pa_bluez4_discovery *y;
 
     pa_assert(bus);
     pa_assert(m);
@@ -924,7 +924,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
 
     if (dbus_message_is_signal(m, "org.bluez.Adapter", "DeviceRemoved")) {
         const char *path;
-        pa_bluetooth_device *d;
+        pa_bluez4_device *d;
 
         if (!dbus_message_get_args(m, &err, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) {
             pa_log("Failed to parse org.bluez.Adapter.DeviceRemoved: %s", err.message);
@@ -978,11 +978,11 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
                dbus_message_is_signal(m, "org.bluez.HandsfreeGateway", "PropertyChanged") ||
                dbus_message_is_signal(m, "org.bluez.Device", "PropertyChanged")) {
 
-        pa_bluetooth_device *d;
+        pa_bluez4_device *d;
 
         if ((d = pa_hashmap_get(y->devices, dbus_message_get_path(m)))) {
             DBusMessageIter arg_i;
-            bool old_any_connected = pa_bluetooth_device_any_audio_connected(d);
+            bool old_any_connected = pa_bluez4_device_any_audio_connected(d);
 
             if (!dbus_message_iter_init(m, &arg_i)) {
                 pa_log("Failed to parse PropertyChanged for device %s", d->path);
@@ -996,7 +996,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
             } else if (parse_audio_property(d, dbus_message_get_interface(m), &arg_i, true) < 0)
                 goto fail;
 
-            if (old_any_connected != pa_bluetooth_device_any_audio_connected(d))
+            if (old_any_connected != pa_bluez4_device_any_audio_connected(d))
                 run_callback(d, false);
         }
 
@@ -1029,7 +1029,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
 
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     } else if (dbus_message_is_signal(m, "org.bluez.MediaTransport", "PropertyChanged")) {
-        pa_bluetooth_transport *t;
+        pa_bluez4_transport *t;
         DBusMessageIter arg_i;
 
         if (!(t = pa_hashmap_get(y->transports, dbus_message_get_path(m))))
@@ -1052,8 +1052,8 @@ fail:
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
-pa_bluetooth_device* pa_bluetooth_discovery_get_by_address(pa_bluetooth_discovery *y, const char* address) {
-    pa_bluetooth_device *d;
+pa_bluez4_device* pa_bluez4_discovery_get_by_address(pa_bluez4_discovery *y, const char* address) {
+    pa_bluez4_device *d;
     void *state = NULL;
 
     pa_assert(y);
@@ -1067,8 +1067,8 @@ pa_bluetooth_device* pa_bluetooth_discovery_get_by_address(pa_bluetooth_discover
     return NULL;
 }
 
-pa_bluetooth_device* pa_bluetooth_discovery_get_by_path(pa_bluetooth_discovery *y, const char* path) {
-    pa_bluetooth_device *d;
+pa_bluez4_device* pa_bluez4_discovery_get_by_path(pa_bluez4_discovery *y, const char* path) {
+    pa_bluez4_device *d;
 
     pa_assert(y);
     pa_assert(PA_REFCNT_VALUE(y) > 0);
@@ -1081,7 +1081,7 @@ pa_bluetooth_device* pa_bluetooth_discovery_get_by_path(pa_bluetooth_discovery *
     return NULL;
 }
 
-bool pa_bluetooth_device_any_audio_connected(const pa_bluetooth_device *d) {
+bool pa_bluez4_device_any_audio_connected(const pa_bluez4_device *d) {
     unsigned i;
 
     pa_assert(d);
@@ -1089,7 +1089,7 @@ bool pa_bluetooth_device_any_audio_connected(const pa_bluetooth_device *d) {
     if (d->dead || d->device_info_valid != 1)
         return false;
 
-    if (d->audio_state == PA_BT_AUDIO_STATE_INVALID)
+    if (d->audio_state == PA_BLUEZ4_AUDIO_STATE_INVALID)
         return false;
 
     /* Make sure audio_state is *not* in CONNECTING state before we fire the
@@ -1105,17 +1105,17 @@ bool pa_bluetooth_device_any_audio_connected(const pa_bluetooth_device *d) {
      * connected. Waiting until the Audio interface gets connected means that
      * both headset profiles will be connected when the device module is
      * loaded. */
-    if (d->audio_state == PA_BT_AUDIO_STATE_CONNECTING)
+    if (d->audio_state == PA_BLUEZ4_AUDIO_STATE_CONNECTING)
         return false;
 
-    for (i = 0; i < PA_BLUETOOTH_PROFILE_COUNT; i++)
-        if (d->transports[i] && d->transports[i]->state != PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)
+    for (i = 0; i < PA_BLUEZ4_PROFILE_COUNT; i++)
+        if (d->transports[i] && d->transports[i]->state != PA_BLUEZ4_TRANSPORT_STATE_DISCONNECTED)
             return true;
 
     return false;
 }
 
-int pa_bluetooth_transport_acquire(pa_bluetooth_transport *t, bool optional, size_t *imtu, size_t *omtu) {
+int pa_bluez4_transport_acquire(pa_bluez4_transport *t, bool optional, size_t *imtu, size_t *omtu) {
     const char *accesstype = "rw";
     DBusMessage *m, *r;
     DBusError err;
@@ -1134,7 +1134,7 @@ int pa_bluetooth_transport_acquire(pa_bluetooth_transport *t, bool optional, siz
            suspended in the meantime, so we can't really guarantee that the
            stream will not be requested until BlueZ's API supports this
            atomically. */
-        if (t->state < PA_BLUETOOTH_TRANSPORT_STATE_PLAYING) {
+        if (t->state < PA_BLUEZ4_TRANSPORT_STATE_PLAYING) {
             pa_log_info("Failed optional acquire of transport %s", t->path);
             return -1;
         }
@@ -1170,7 +1170,7 @@ fail:
     return ret;
 }
 
-void pa_bluetooth_transport_release(pa_bluetooth_transport *t) {
+void pa_bluez4_transport_release(pa_bluez4_transport *t) {
     const char *accesstype = "rw";
     DBusMessage *m;
     DBusError err;
@@ -1192,7 +1192,7 @@ void pa_bluetooth_transport_release(pa_bluetooth_transport *t) {
         pa_log_info("Transport %s released", t->path);
 }
 
-static void set_property(pa_bluetooth_discovery *y, const char *bus, const char *path, const char *interface,
+static void set_property(pa_bluez4_discovery *y, const char *bus, const char *path, const char *interface,
                          const char *prop_name, int prop_type, void *prop_value) {
     DBusMessage *m;
     DBusMessageIter i;
@@ -1212,7 +1212,7 @@ static void set_property(pa_bluetooth_discovery *y, const char *bus, const char
     dbus_message_unref(m);
 }
 
-void pa_bluetooth_transport_set_microphone_gain(pa_bluetooth_transport *t, uint16_t value) {
+void pa_bluez4_transport_set_microphone_gain(pa_bluez4_transport *t, uint16_t value) {
     dbus_uint16_t gain = PA_MIN(value, HSP_MAX_GAIN);
 
     pa_assert(t);
@@ -1222,7 +1222,7 @@ void pa_bluetooth_transport_set_microphone_gain(pa_bluetooth_transport *t, uint1
                  "MicrophoneGain", DBUS_TYPE_UINT16, &gain);
 }
 
-void pa_bluetooth_transport_set_speaker_gain(pa_bluetooth_transport *t, uint16_t value) {
+void pa_bluez4_transport_set_speaker_gain(pa_bluez4_transport *t, uint16_t value) {
     dbus_uint16_t gain = PA_MIN(value, HSP_MAX_GAIN);
 
     pa_assert(t);
@@ -1232,7 +1232,7 @@ void pa_bluetooth_transport_set_speaker_gain(pa_bluetooth_transport *t, uint16_t
                  "SpeakerGain", DBUS_TYPE_UINT16, &gain);
 }
 
-static int setup_dbus(pa_bluetooth_discovery *y) {
+static int setup_dbus(pa_bluez4_discovery *y) {
     DBusError err;
 
     dbus_error_init(&err);
@@ -1246,11 +1246,11 @@ static int setup_dbus(pa_bluetooth_discovery *y) {
     return 0;
 }
 
-static pa_bluetooth_transport *transport_new(pa_bluetooth_device *d, const char *owner, const char *path, enum profile p,
+static pa_bluez4_transport *transport_new(pa_bluez4_device *d, const char *owner, const char *path, enum profile p,
                                              const uint8_t *config, int size) {
-    pa_bluetooth_transport *t;
+    pa_bluez4_transport *t;
 
-    t = pa_xnew0(pa_bluetooth_transport, 1);
+    t = pa_xnew0(pa_bluez4_transport, 1);
     t->device = d;
     t->owner = pa_xstrdup(owner);
     t->path = pa_xstrdup(path);
@@ -1268,9 +1268,9 @@ static pa_bluetooth_transport *transport_new(pa_bluetooth_device *d, const char
 }
 
 static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage *m, void *userdata) {
-    pa_bluetooth_discovery *y = userdata;
-    pa_bluetooth_device *d;
-    pa_bluetooth_transport *t;
+    pa_bluez4_discovery *y = userdata;
+    pa_bluez4_device *d;
+    pa_bluez4_transport *t;
     const char *sender, *path, *dev_path = NULL, *uuid = NULL;
     uint8_t *config = NULL;
     int size = 0;
@@ -1359,7 +1359,7 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
         goto fail2;
     }
 
-    old_any_connected = pa_bluetooth_device_any_audio_connected(d);
+    old_any_connected = pa_bluez4_device_any_audio_connected(d);
 
     sender = dbus_message_get_sender(m);
 
@@ -1376,7 +1376,7 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
     pa_assert_se(dbus_connection_send(pa_dbus_connection_get(y->connection), r, NULL));
     dbus_message_unref(r);
 
-    if (old_any_connected != pa_bluetooth_device_any_audio_connected(d))
+    if (old_any_connected != pa_bluez4_device_any_audio_connected(d))
         run_callback(d, false);
 
     return NULL;
@@ -1391,8 +1391,8 @@ fail2:
 }
 
 static DBusMessage *endpoint_clear_configuration(DBusConnection *c, DBusMessage *m, void *userdata) {
-    pa_bluetooth_discovery *y = userdata;
-    pa_bluetooth_transport *t;
+    pa_bluez4_discovery *y = userdata;
+    pa_bluez4_transport *t;
     DBusMessage *r;
     DBusError e;
     const char *path;
@@ -1406,15 +1406,15 @@ static DBusMessage *endpoint_clear_configuration(DBusConnection *c, DBusMessage
     }
 
     if ((t = pa_hashmap_get(y->transports, path))) {
-        bool old_any_connected = pa_bluetooth_device_any_audio_connected(t->device);
+        bool old_any_connected = pa_bluez4_device_any_audio_connected(t->device);
 
         pa_log_debug("Clearing transport %s profile %d", t->path, t->profile);
         t->device->transports[t->profile] = NULL;
         pa_hashmap_remove(y->transports, t->path);
-        t->state = PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED;
-        pa_hook_fire(&y->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED], t);
+        t->state = PA_BLUEZ4_TRANSPORT_STATE_DISCONNECTED;
+        pa_hook_fire(&y->hooks[PA_BLUEZ4_HOOK_TRANSPORT_STATE_CHANGED], t);
 
-        if (old_any_connected != pa_bluetooth_device_any_audio_connected(t->device))
+        if (old_any_connected != pa_bluez4_device_any_audio_connected(t->device))
             run_callback(t->device, false);
 
         transport_free(t);
@@ -1476,7 +1476,7 @@ static uint8_t a2dp_default_bitpool(uint8_t freq, uint8_t mode) {
 }
 
 static DBusMessage *endpoint_select_configuration(DBusConnection *c, DBusMessage *m, void *userdata) {
-    pa_bluetooth_discovery *y = userdata;
+    pa_bluez4_discovery *y = userdata;
     a2dp_sbc_t *cap, config;
     uint8_t *pconf = (uint8_t *) &config;
     int i, size;
@@ -1599,7 +1599,7 @@ fail:
 }
 
 static DBusHandlerResult endpoint_handler(DBusConnection *c, DBusMessage *m, void *userdata) {
-    struct pa_bluetooth_discovery *y = userdata;
+    struct pa_bluez4_discovery *y = userdata;
     DBusMessage *r = NULL;
     DBusError e;
     const char *path, *interface, *member;
@@ -1641,9 +1641,9 @@ static DBusHandlerResult endpoint_handler(DBusConnection *c, DBusMessage *m, voi
     return DBUS_HANDLER_RESULT_HANDLED;
 }
 
-pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
+pa_bluez4_discovery* pa_bluez4_discovery_get(pa_core *c) {
     DBusError err;
-    pa_bluetooth_discovery *y;
+    pa_bluez4_discovery *y;
     DBusConnection *conn;
     unsigned i;
     static const DBusObjectPathVTable vtable_endpoint = {
@@ -1655,16 +1655,16 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
     dbus_error_init(&err);
 
     if ((y = pa_shared_get(c, "bluez4-discovery")))
-        return pa_bluetooth_discovery_ref(y);
+        return pa_bluez4_discovery_ref(y);
 
-    y = pa_xnew0(pa_bluetooth_discovery, 1);
+    y = pa_xnew0(pa_bluez4_discovery, 1);
     PA_REFCNT_INIT(y);
     y->core = c;
     y->devices = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
     y->transports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
     PA_LLIST_HEAD_INIT(pa_dbus_pending, y->pending);
 
-    for (i = 0; i < PA_BLUETOOTH_HOOK_MAX; i++)
+    for (i = 0; i < PA_BLUEZ4_HOOK_MAX; i++)
         pa_hook_init(&y->hooks[i], y);
 
     pa_shared_set(c, "bluez4-discovery", y);
@@ -1712,14 +1712,14 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
 
 fail:
     if (y)
-        pa_bluetooth_discovery_unref(y);
+        pa_bluez4_discovery_unref(y);
 
     dbus_error_free(&err);
 
     return NULL;
 }
 
-pa_bluetooth_discovery* pa_bluetooth_discovery_ref(pa_bluetooth_discovery *y) {
+pa_bluez4_discovery* pa_bluez4_discovery_ref(pa_bluez4_discovery *y) {
     pa_assert(y);
     pa_assert(PA_REFCNT_VALUE(y) > 0);
 
@@ -1728,7 +1728,7 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_ref(pa_bluetooth_discovery *y) {
     return y;
 }
 
-void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
+void pa_bluez4_discovery_unref(pa_bluez4_discovery *y) {
     unsigned i;
 
     pa_assert(y);
@@ -1777,7 +1777,7 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
         pa_dbus_connection_unref(y->connection);
     }
 
-    for (i = 0; i < PA_BLUETOOTH_HOOK_MAX; i++)
+    for (i = 0; i < PA_BLUEZ4_HOOK_MAX; i++)
         pa_hook_done(&y->hooks[i]);
 
     if (y->core)
@@ -1786,26 +1786,26 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
     pa_xfree(y);
 }
 
-pa_hook* pa_bluetooth_discovery_hook(pa_bluetooth_discovery *y, pa_bluetooth_hook_t hook) {
+pa_hook* pa_bluez4_discovery_hook(pa_bluez4_discovery *y, pa_bluez4_hook_t hook) {
     pa_assert(y);
     pa_assert(PA_REFCNT_VALUE(y) > 0);
 
     return &y->hooks[hook];
 }
 
-pa_bt_form_factor_t pa_bluetooth_get_form_factor(uint32_t class) {
+pa_bluez4_form_factor_t pa_bluez4_get_form_factor(uint32_t class) {
     unsigned major, minor;
-    pa_bt_form_factor_t r;
-
-    static const pa_bt_form_factor_t table[] = {
-        [1] = PA_BT_FORM_FACTOR_HEADSET,
-        [2] = PA_BT_FORM_FACTOR_HANDSFREE,
-        [4] = PA_BT_FORM_FACTOR_MICROPHONE,
-        [5] = PA_BT_FORM_FACTOR_SPEAKER,
-        [6] = PA_BT_FORM_FACTOR_HEADPHONE,
-        [7] = PA_BT_FORM_FACTOR_PORTABLE,
-        [8] = PA_BT_FORM_FACTOR_CAR,
-        [10] = PA_BT_FORM_FACTOR_HIFI
+    pa_bluez4_form_factor_t r;
+
+    static const pa_bluez4_form_factor_t table[] = {
+        [1] = PA_BLUEZ4_FORM_FACTOR_HEADSET,
+        [2] = PA_BLUEZ4_FORM_FACTOR_HANDSFREE,
+        [4] = PA_BLUEZ4_FORM_FACTOR_MICROPHONE,
+        [5] = PA_BLUEZ4_FORM_FACTOR_SPEAKER,
+        [6] = PA_BLUEZ4_FORM_FACTOR_HEADPHONE,
+        [7] = PA_BLUEZ4_FORM_FACTOR_PORTABLE,
+        [8] = PA_BLUEZ4_FORM_FACTOR_CAR,
+        [10] = PA_BLUEZ4_FORM_FACTOR_HIFI
     };
 
     /*
@@ -1817,15 +1817,15 @@ pa_bt_form_factor_t pa_bluetooth_get_form_factor(uint32_t class) {
 
     switch (major) {
         case 2:
-            return PA_BT_FORM_FACTOR_PHONE;
+            return PA_BLUEZ4_FORM_FACTOR_PHONE;
         case 4:
             break;
         default:
             pa_log_debug("Unknown Bluetooth major device class %u", major);
-            return PA_BT_FORM_FACTOR_UNKNOWN;
+            return PA_BLUEZ4_FORM_FACTOR_UNKNOWN;
     }
 
-    r = minor < PA_ELEMENTSOF(table) ? table[minor] : PA_BT_FORM_FACTOR_UNKNOWN;
+    r = minor < PA_ELEMENTSOF(table) ? table[minor] : PA_BLUEZ4_FORM_FACTOR_UNKNOWN;
 
     if (!r)
         pa_log_debug("Unknown Bluetooth minor device class %u", minor);
@@ -1833,34 +1833,34 @@ pa_bt_form_factor_t pa_bluetooth_get_form_factor(uint32_t class) {
     return r;
 }
 
-const char *pa_bt_form_factor_to_string(pa_bt_form_factor_t ff) {
+const char *pa_bluez4_form_factor_to_string(pa_bluez4_form_factor_t ff) {
     switch (ff) {
-        case PA_BT_FORM_FACTOR_UNKNOWN:
+        case PA_BLUEZ4_FORM_FACTOR_UNKNOWN:
             return "unknown";
-        case PA_BT_FORM_FACTOR_HEADSET:
+        case PA_BLUEZ4_FORM_FACTOR_HEADSET:
             return "headset";
-        case PA_BT_FORM_FACTOR_HANDSFREE:
+        case PA_BLUEZ4_FORM_FACTOR_HANDSFREE:
             return "hands-free";
-        case PA_BT_FORM_FACTOR_MICROPHONE:
+        case PA_BLUEZ4_FORM_FACTOR_MICROPHONE:
             return "microphone";
-        case PA_BT_FORM_FACTOR_SPEAKER:
+        case PA_BLUEZ4_FORM_FACTOR_SPEAKER:
             return "speaker";
-        case PA_BT_FORM_FACTOR_HEADPHONE:
+        case PA_BLUEZ4_FORM_FACTOR_HEADPHONE:
             return "headphone";
-        case PA_BT_FORM_FACTOR_PORTABLE:
+        case PA_BLUEZ4_FORM_FACTOR_PORTABLE:
             return "portable";
-        case PA_BT_FORM_FACTOR_CAR:
+        case PA_BLUEZ4_FORM_FACTOR_CAR:
             return "car";
-        case PA_BT_FORM_FACTOR_HIFI:
+        case PA_BLUEZ4_FORM_FACTOR_HIFI:
             return "hifi";
-        case PA_BT_FORM_FACTOR_PHONE:
+        case PA_BLUEZ4_FORM_FACTOR_PHONE:
             return "phone";
     }
 
     pa_assert_not_reached();
 }
 
-char *pa_bluetooth_cleanup_name(const char *name) {
+char *pa_bluez4_cleanup_name(const char *name) {
     char *t, *s, *d;
     bool space = false;
 
@@ -1891,7 +1891,7 @@ char *pa_bluetooth_cleanup_name(const char *name) {
     return t;
 }
 
-bool pa_bluetooth_uuid_has(pa_bluetooth_uuid *uuids, const char *uuid) {
+bool pa_bluez4_uuid_has(pa_bluez4_uuid *uuids, const char *uuid) {
     pa_assert(uuid);
 
     while (uuids) {
diff --git a/src/modules/bluetooth/bluez4-util.h b/src/modules/bluetooth/bluez4-util.h
index 4570a10..b920545 100644
--- a/src/modules/bluetooth/bluez4-util.h
+++ b/src/modules/bluetooth/bluez4-util.h
@@ -27,7 +27,7 @@
 #include <pulsecore/llist.h>
 #include <pulsecore/macro.h>
 
-#define PA_BLUETOOTH_ERROR_NOT_SUPPORTED "org.bluez.Error.NotSupported"
+#define PA_BLUEZ4_ERROR_NOT_SUPPORTED "org.bluez.Error.NotSupported"
 
 /* UUID copied from bluez/audio/device.h */
 #define GENERIC_AUDIO_UUID      "00001203-0000-1000-8000-00805f9b34fb"
@@ -45,16 +45,16 @@
 
 #define HSP_MAX_GAIN 15
 
-typedef struct pa_bluetooth_uuid pa_bluetooth_uuid;
-typedef struct pa_bluetooth_device pa_bluetooth_device;
-typedef struct pa_bluetooth_discovery pa_bluetooth_discovery;
-typedef struct pa_bluetooth_transport pa_bluetooth_transport;
+typedef struct pa_bluez4_uuid pa_bluez4_uuid;
+typedef struct pa_bluez4_device pa_bluez4_device;
+typedef struct pa_bluez4_discovery pa_bluez4_discovery;
+typedef struct pa_bluez4_transport pa_bluez4_transport;
 
 struct userdata;
 
-struct pa_bluetooth_uuid {
+struct pa_bluez4_uuid {
     char *uuid;
-    PA_LLIST_FIELDS(pa_bluetooth_uuid);
+    PA_LLIST_FIELDS(pa_bluez4_uuid);
 };
 
 enum profile {
@@ -65,32 +65,32 @@ enum profile {
     PROFILE_OFF
 };
 
-#define PA_BLUETOOTH_PROFILE_COUNT PROFILE_OFF
+#define PA_BLUEZ4_PROFILE_COUNT PROFILE_OFF
 
-struct pa_bluetooth_hook_uuid_data {
-    pa_bluetooth_device *device;
+struct pa_bluez4_hook_uuid_data {
+    pa_bluez4_device *device;
     const char *uuid;
 };
 
-/* Hook data: pa_bluetooth_discovery pointer. */
-typedef enum pa_bluetooth_hook {
-    PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED, /* Call data: pa_bluetooth_device */
-    PA_BLUETOOTH_HOOK_DEVICE_UUID_ADDED, /* Call data: pa_bluetooth_hook_uuid_data */
-    PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED, /* Call data: pa_bluetooth_transport */
-    PA_BLUETOOTH_HOOK_TRANSPORT_NREC_CHANGED, /* Call data: pa_bluetooth_transport */
-    PA_BLUETOOTH_HOOK_TRANSPORT_MICROPHONE_GAIN_CHANGED, /* Call data: pa_bluetooth_transport */
-    PA_BLUETOOTH_HOOK_TRANSPORT_SPEAKER_GAIN_CHANGED, /* Call data: pa_bluetooth_transport */
-    PA_BLUETOOTH_HOOK_MAX
-} pa_bluetooth_hook_t;
-
-typedef enum pa_bluetooth_transport_state {
-    PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED,
-    PA_BLUETOOTH_TRANSPORT_STATE_IDLE, /* Connected but not playing */
-    PA_BLUETOOTH_TRANSPORT_STATE_PLAYING
-} pa_bluetooth_transport_state_t;
-
-struct pa_bluetooth_transport {
-    pa_bluetooth_device *device;
+/* Hook data: pa_bluez4_discovery pointer. */
+typedef enum pa_bluez4_hook {
+    PA_BLUEZ4_HOOK_DEVICE_CONNECTION_CHANGED, /* Call data: pa_bluez4_device */
+    PA_BLUEZ4_HOOK_DEVICE_UUID_ADDED, /* Call data: pa_bluez4_hook_uuid_data */
+    PA_BLUEZ4_HOOK_TRANSPORT_STATE_CHANGED, /* Call data: pa_bluez4_transport */
+    PA_BLUEZ4_HOOK_TRANSPORT_NREC_CHANGED, /* Call data: pa_bluez4_transport */
+    PA_BLUEZ4_HOOK_TRANSPORT_MICROPHONE_GAIN_CHANGED, /* Call data: pa_bluez4_transport */
+    PA_BLUEZ4_HOOK_TRANSPORT_SPEAKER_GAIN_CHANGED, /* Call data: pa_bluez4_transport */
+    PA_BLUEZ4_HOOK_MAX
+} pa_bluez4_hook_t;
+
+typedef enum pa_bluez4_transport_state {
+    PA_BLUEZ4_TRANSPORT_STATE_DISCONNECTED,
+    PA_BLUEZ4_TRANSPORT_STATE_IDLE, /* Connected but not playing */
+    PA_BLUEZ4_TRANSPORT_STATE_PLAYING
+} pa_bluez4_transport_state_t;
+
+struct pa_bluez4_transport {
+    pa_bluez4_device *device;
     char *owner;
     char *path;
     enum profile profile;
@@ -98,23 +98,23 @@ struct pa_bluetooth_transport {
     uint8_t *config;
     int config_size;
 
-    pa_bluetooth_transport_state_t state;
+    pa_bluez4_transport_state_t state;
     bool nrec;
     uint16_t microphone_gain; /* Used for HSP/HFP */
     uint16_t speaker_gain; /* Used for HSP/HFP */
 };
 
 /* This enum is shared among Audio, Headset, AudioSink, and AudioSource, although not all values are acceptable in all profiles */
-typedef enum pa_bt_audio_state {
-    PA_BT_AUDIO_STATE_INVALID = -1,
-    PA_BT_AUDIO_STATE_DISCONNECTED,
-    PA_BT_AUDIO_STATE_CONNECTING,
-    PA_BT_AUDIO_STATE_CONNECTED,
-    PA_BT_AUDIO_STATE_PLAYING
-} pa_bt_audio_state_t;
-
-struct pa_bluetooth_device {
-    pa_bluetooth_discovery *discovery;
+typedef enum pa_bluez4_audio_state {
+    PA_BLUEZ4_AUDIO_STATE_INVALID = -1,
+    PA_BLUEZ4_AUDIO_STATE_DISCONNECTED,
+    PA_BLUEZ4_AUDIO_STATE_CONNECTING,
+    PA_BLUEZ4_AUDIO_STATE_CONNECTED,
+    PA_BLUEZ4_AUDIO_STATE_PLAYING
+} pa_bluez4_audio_state_t;
+
+struct pa_bluez4_device {
+    pa_bluez4_discovery *discovery;
     bool dead;
 
     int device_info_valid;      /* 0: no results yet; 1: good results; -1: bad results ... */
@@ -122,57 +122,57 @@ struct pa_bluetooth_device {
     /* Device information */
     char *name;
     char *path;
-    pa_bluetooth_transport *transports[PA_BLUETOOTH_PROFILE_COUNT];
+    pa_bluez4_transport *transports[PA_BLUEZ4_PROFILE_COUNT];
     int paired;
     char *alias;
-    PA_LLIST_HEAD(pa_bluetooth_uuid, uuids);
+    PA_LLIST_HEAD(pa_bluez4_uuid, uuids);
     char *address;
     int class;
     int trusted;
 
     /* Audio state */
-    pa_bt_audio_state_t audio_state;
+    pa_bluez4_audio_state_t audio_state;
 
     /* AudioSink, AudioSource, Headset and HandsfreeGateway states */
-    pa_bt_audio_state_t profile_state[PA_BLUETOOTH_PROFILE_COUNT];
+    pa_bluez4_audio_state_t profile_state[PA_BLUEZ4_PROFILE_COUNT];
 };
 
-pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *core);
-pa_bluetooth_discovery* pa_bluetooth_discovery_ref(pa_bluetooth_discovery *y);
-void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *d);
+pa_bluez4_discovery* pa_bluez4_discovery_get(pa_core *core);
+pa_bluez4_discovery* pa_bluez4_discovery_ref(pa_bluez4_discovery *y);
+void pa_bluez4_discovery_unref(pa_bluez4_discovery *d);
 
-pa_bluetooth_device* pa_bluetooth_discovery_get_by_path(pa_bluetooth_discovery *d, const char* path);
-pa_bluetooth_device* pa_bluetooth_discovery_get_by_address(pa_bluetooth_discovery *d, const char* address);
+pa_bluez4_device* pa_bluez4_discovery_get_by_path(pa_bluez4_discovery *d, const char* path);
+pa_bluez4_device* pa_bluez4_discovery_get_by_address(pa_bluez4_discovery *d, const char* address);
 
-bool pa_bluetooth_device_any_audio_connected(const pa_bluetooth_device *d);
+bool pa_bluez4_device_any_audio_connected(const pa_bluez4_device *d);
 
-int pa_bluetooth_transport_acquire(pa_bluetooth_transport *t, bool optional, size_t *imtu, size_t *omtu);
-void pa_bluetooth_transport_release(pa_bluetooth_transport *t);
+int pa_bluez4_transport_acquire(pa_bluez4_transport *t, bool optional, size_t *imtu, size_t *omtu);
+void pa_bluez4_transport_release(pa_bluez4_transport *t);
 
-void pa_bluetooth_transport_set_microphone_gain(pa_bluetooth_transport *t, uint16_t value);
-void pa_bluetooth_transport_set_speaker_gain(pa_bluetooth_transport *t, uint16_t value);
+void pa_bluez4_transport_set_microphone_gain(pa_bluez4_transport *t, uint16_t value);
+void pa_bluez4_transport_set_speaker_gain(pa_bluez4_transport *t, uint16_t value);
 
-pa_hook* pa_bluetooth_discovery_hook(pa_bluetooth_discovery *y, pa_bluetooth_hook_t hook);
+pa_hook* pa_bluez4_discovery_hook(pa_bluez4_discovery *y, pa_bluez4_hook_t hook);
 
-typedef enum pa_bt_form_factor {
-    PA_BT_FORM_FACTOR_UNKNOWN,
-    PA_BT_FORM_FACTOR_HEADSET,
-    PA_BT_FORM_FACTOR_HANDSFREE,
-    PA_BT_FORM_FACTOR_MICROPHONE,
-    PA_BT_FORM_FACTOR_SPEAKER,
-    PA_BT_FORM_FACTOR_HEADPHONE,
-    PA_BT_FORM_FACTOR_PORTABLE,
-    PA_BT_FORM_FACTOR_CAR,
-    PA_BT_FORM_FACTOR_HIFI,
-    PA_BT_FORM_FACTOR_PHONE,
-} pa_bt_form_factor_t;
+typedef enum pa_bluez4_form_factor {
+    PA_BLUEZ4_FORM_FACTOR_UNKNOWN,
+    PA_BLUEZ4_FORM_FACTOR_HEADSET,
+    PA_BLUEZ4_FORM_FACTOR_HANDSFREE,
+    PA_BLUEZ4_FORM_FACTOR_MICROPHONE,
+    PA_BLUEZ4_FORM_FACTOR_SPEAKER,
+    PA_BLUEZ4_FORM_FACTOR_HEADPHONE,
+    PA_BLUEZ4_FORM_FACTOR_PORTABLE,
+    PA_BLUEZ4_FORM_FACTOR_CAR,
+    PA_BLUEZ4_FORM_FACTOR_HIFI,
+    PA_BLUEZ4_FORM_FACTOR_PHONE,
+} pa_bluez4_form_factor_t;
 
-pa_bt_form_factor_t pa_bluetooth_get_form_factor(uint32_t class);
-const char *pa_bt_form_factor_to_string(pa_bt_form_factor_t ff);
+pa_bluez4_form_factor_t pa_bluez4_get_form_factor(uint32_t class);
+const char *pa_bluez4_form_factor_to_string(pa_bluez4_form_factor_t ff);
 
-char *pa_bluetooth_cleanup_name(const char *name);
+char *pa_bluez4_cleanup_name(const char *name);
 
-bool pa_bluetooth_uuid_has(pa_bluetooth_uuid *uuids, const char *uuid);
-const char *pa_bt_profile_to_string(enum profile profile);
+bool pa_bluez4_uuid_has(pa_bluez4_uuid *uuids, const char *uuid);
+const char *pa_bluez4_profile_to_string(enum profile profile);
 
 #endif
diff --git a/src/modules/bluetooth/module-bluez4-device.c b/src/modules/bluetooth/module-bluez4-device.c
index 2d1224f..aca10d5 100644
--- a/src/modules/bluetooth/module-bluez4-device.c
+++ b/src/modules/bluetooth/module-bluez4-device.c
@@ -135,11 +135,11 @@ struct userdata {
     pa_core *core;
     pa_module *module;
 
-    pa_bluetooth_device *device;
+    pa_bluez4_device *device;
     pa_hook_slot *uuid_added_slot;
     char *address;
     char *path;
-    pa_bluetooth_transport *transport;
+    pa_bluez4_transport *transport;
     bool transport_acquired;
     pa_hook_slot *discovery_slot;
     pa_hook_slot *sink_state_changed_slot;
@@ -149,7 +149,7 @@ struct userdata {
     pa_hook_slot *transport_microphone_changed_slot;
     pa_hook_slot *transport_speaker_changed_slot;
 
-    pa_bluetooth_discovery *discovery;
+    pa_bluez4_discovery *discovery;
     bool auto_connect;
 
     char *output_port_name;
@@ -351,7 +351,7 @@ static void bt_transport_release(struct userdata *u) {
 
     pa_log_debug("Releasing transport %s", u->transport->path);
 
-    pa_bluetooth_transport_release(u->transport);
+    pa_bluez4_transport_release(u->transport);
 
     u->transport_acquired = false;
 
@@ -366,7 +366,7 @@ static int bt_transport_acquire(struct userdata *u, bool optional) {
 
     pa_log_debug("Acquiring transport %s", u->transport->path);
 
-    u->stream_fd = pa_bluetooth_transport_acquire(u->transport, optional, &u->read_link_mtu, &u->write_link_mtu);
+    u->stream_fd = pa_bluez4_transport_acquire(u->transport, optional, &u->read_link_mtu, &u->write_link_mtu);
     if (u->stream_fd < 0) {
         if (!optional)
             pa_log("Failed to acquire transport %s", u->transport->path);
@@ -1192,10 +1192,10 @@ finish:
     pa_log_debug("IO thread shutting down");
 }
 
-static pa_available_t transport_state_to_availability(pa_bluetooth_transport_state_t state) {
-    if (state == PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)
+static pa_available_t transport_state_to_availability(pa_bluez4_transport_state_t state) {
+    if (state == PA_BLUEZ4_TRANSPORT_STATE_DISCONNECTED)
         return PA_AVAILABLE_NO;
-    else if (state >= PA_BLUETOOTH_TRANSPORT_STATE_PLAYING)
+    else if (state >= PA_BLUEZ4_TRANSPORT_STATE_PLAYING)
         return PA_AVAILABLE_YES;
     else
         return PA_AVAILABLE_UNKNOWN;
@@ -1221,8 +1221,8 @@ static pa_available_t get_port_availability(struct userdata *u, pa_direction_t d
     pa_assert(u);
     pa_assert(u->device);
 
-    for (i = 0; i < PA_BLUETOOTH_PROFILE_COUNT; i++) {
-        pa_bluetooth_transport *transport;
+    for (i = 0; i < PA_BLUEZ4_PROFILE_COUNT; i++) {
+        pa_bluez4_transport *transport;
 
         if (!(get_profile_direction(i) & direction))
             continue;
@@ -1231,16 +1231,16 @@ static pa_available_t get_port_availability(struct userdata *u, pa_direction_t d
             continue;
 
         switch(transport->state) {
-            case PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED:
+            case PA_BLUEZ4_TRANSPORT_STATE_DISCONNECTED:
                 continue;
 
-            case PA_BLUETOOTH_TRANSPORT_STATE_IDLE:
+            case PA_BLUEZ4_TRANSPORT_STATE_IDLE:
                 if (result == PA_AVAILABLE_NO)
                     result = PA_AVAILABLE_UNKNOWN;
 
                 break;
 
-            case PA_BLUETOOTH_TRANSPORT_STATE_PLAYING:
+            case PA_BLUEZ4_TRANSPORT_STATE_PLAYING:
                 return PA_AVAILABLE_YES;
         }
     }
@@ -1249,12 +1249,12 @@ static pa_available_t get_port_availability(struct userdata *u, pa_direction_t d
 }
 
 /* Run from main thread */
-static void handle_transport_state_change(struct userdata *u, struct pa_bluetooth_transport *transport) {
+static void handle_transport_state_change(struct userdata *u, struct pa_bluez4_transport *transport) {
     bool acquire = false;
     bool release = false;
     enum profile profile;
     pa_card_profile *cp;
-    pa_bluetooth_transport_state_t state;
+    pa_bluez4_transport_state_t state;
     pa_device_port *port;
 
     pa_assert(u);
@@ -1264,7 +1264,7 @@ static void handle_transport_state_change(struct userdata *u, struct pa_bluetoot
     state = transport->state;
 
     /* Update profile availability */
-    if (!(cp = pa_hashmap_get(u->card->profiles, pa_bt_profile_to_string(profile))))
+    if (!(cp = pa_hashmap_get(u->card->profiles, pa_bluez4_profile_to_string(profile))))
         return;
 
     pa_card_profile_set_available(cp, transport_state_to_availability(state));
@@ -1277,8 +1277,8 @@ static void handle_transport_state_change(struct userdata *u, struct pa_bluetoot
     pa_device_port_set_available(port, get_port_availability(u, PA_DIRECTION_INPUT));
 
     /* Acquire or release transport as needed */
-    acquire = (state == PA_BLUETOOTH_TRANSPORT_STATE_PLAYING && u->profile == profile);
-    release = (state != PA_BLUETOOTH_TRANSPORT_STATE_PLAYING && u->profile == profile);
+    acquire = (state == PA_BLUEZ4_TRANSPORT_STATE_PLAYING && u->profile == profile);
+    release = (state != PA_BLUEZ4_TRANSPORT_STATE_PLAYING && u->profile == profile);
 
     if (acquire)
         if (bt_transport_acquire(u, true) >= 0) {
@@ -1336,7 +1336,7 @@ static void sink_set_volume_cb(pa_sink *s) {
 
     pa_cvolume_set(&s->real_volume, u->sample_spec.channels, volume);
 
-    pa_bluetooth_transport_set_speaker_gain(u->transport, gain);
+    pa_bluez4_transport_set_speaker_gain(u->transport, gain);
 }
 
 /* Run from main thread */
@@ -1363,7 +1363,7 @@ static void source_set_volume_cb(pa_source *s) {
 
     pa_cvolume_set(&s->real_volume, u->sample_spec.channels, volume);
 
-    pa_bluetooth_transport_set_microphone_gain(u->transport, gain);
+    pa_bluez4_transport_set_microphone_gain(u->transport, gain);
 }
 
 /* Run from main thread */
@@ -1457,7 +1457,7 @@ static pa_hook_result_t source_state_changed_cb(pa_core *c, pa_source *s, struct
     return PA_HOOK_OK;
 }
 
-static pa_hook_result_t transport_nrec_changed_cb(pa_bluetooth_discovery *y, pa_bluetooth_transport *t, struct userdata *u) {
+static pa_hook_result_t transport_nrec_changed_cb(pa_bluez4_discovery *y, pa_bluez4_transport *t, struct userdata *u) {
     pa_proplist *p;
 
     pa_assert(t);
@@ -1474,7 +1474,7 @@ static pa_hook_result_t transport_nrec_changed_cb(pa_bluetooth_discovery *y, pa_
     return PA_HOOK_OK;
 }
 
-static pa_hook_result_t transport_microphone_gain_changed_cb(pa_bluetooth_discovery *y, pa_bluetooth_transport *t,
+static pa_hook_result_t transport_microphone_gain_changed_cb(pa_bluez4_discovery *y, pa_bluez4_transport *t,
                                                              struct userdata *u) {
     pa_cvolume v;
 
@@ -1493,7 +1493,7 @@ static pa_hook_result_t transport_microphone_gain_changed_cb(pa_bluetooth_discov
     return PA_HOOK_OK;
 }
 
-static pa_hook_result_t transport_speaker_gain_changed_cb(pa_bluetooth_discovery *y, pa_bluetooth_transport *t,
+static pa_hook_result_t transport_speaker_gain_changed_cb(pa_bluez4_discovery *y, pa_bluez4_transport *t,
                                                           struct userdata *u) {
     pa_cvolume v;
 
@@ -1548,7 +1548,7 @@ static int add_sink(struct userdata *u) {
 
         u->sink = u->hsp.sco_sink;
         p = pa_proplist_new();
-        pa_proplist_sets(p, "bluetooth.protocol", pa_bt_profile_to_string(u->profile));
+        pa_proplist_sets(p, "bluetooth.protocol", pa_bluez4_profile_to_string(u->profile));
         pa_proplist_update(u->sink->proplist, PA_UPDATE_MERGE, p);
         pa_proplist_free(p);
     } else {
@@ -1559,7 +1559,7 @@ static int add_sink(struct userdata *u) {
         data.driver = __FILE__;
         data.module = u->module;
         pa_sink_new_data_set_sample_spec(&data, &u->sample_spec);
-        pa_proplist_sets(data.proplist, "bluetooth.protocol", pa_bt_profile_to_string(u->profile));
+        pa_proplist_sets(data.proplist, "bluetooth.protocol", pa_bluez4_profile_to_string(u->profile));
         if (u->profile == PROFILE_HSP)
             pa_proplist_sets(data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "phone");
         data.card = u->card;
@@ -1620,7 +1620,7 @@ static int add_source(struct userdata *u) {
 
     if (USE_SCO_OVER_PCM(u)) {
         u->source = u->hsp.sco_source;
-        pa_proplist_sets(u->source->proplist, "bluetooth.protocol", pa_bt_profile_to_string(u->profile));
+        pa_proplist_sets(u->source->proplist, "bluetooth.protocol", pa_bluez4_profile_to_string(u->profile));
     } else {
         pa_source_new_data data;
         bool b;
@@ -1629,7 +1629,7 @@ static int add_source(struct userdata *u) {
         data.driver = __FILE__;
         data.module = u->module;
         pa_source_new_data_set_sample_spec(&data, &u->sample_spec);
-        pa_proplist_sets(data.proplist, "bluetooth.protocol", pa_bt_profile_to_string(u->profile));
+        pa_proplist_sets(data.proplist, "bluetooth.protocol", pa_bluez4_profile_to_string(u->profile));
         if (u->profile == PROFILE_HSP)
             pa_proplist_sets(data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "phone");
 
@@ -1673,7 +1673,7 @@ static int add_source(struct userdata *u) {
     }
 
     if ((u->profile == PROFILE_HSP) || (u->profile == PROFILE_HFGW)) {
-        pa_bluetooth_transport *t = u->transport;
+        pa_bluez4_transport *t = u->transport;
         pa_proplist_sets(u->source->proplist, "bluetooth.nrec", t->nrec ? "1" : "0");
     }
 
@@ -1690,7 +1690,7 @@ static int add_source(struct userdata *u) {
 }
 
 static void bt_transport_config_a2dp(struct userdata *u) {
-    const pa_bluetooth_transport *t;
+    const pa_bluez4_transport *t;
     struct a2dp_info *a2dp = &u->a2dp;
     a2dp_sbc_t *config;
 
@@ -1810,11 +1810,11 @@ static void bt_transport_config(struct userdata *u) {
 }
 
 /* Run from main thread */
-static pa_hook_result_t transport_state_changed_cb(pa_bluetooth_discovery *y, pa_bluetooth_transport *t, struct userdata *u) {
+static pa_hook_result_t transport_state_changed_cb(pa_bluez4_discovery *y, pa_bluez4_transport *t, struct userdata *u) {
     pa_assert(t);
     pa_assert(u);
 
-    if (t == u->transport && t->state == PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)
+    if (t == u->transport && t->state == PA_BLUEZ4_TRANSPORT_STATE_DISCONNECTED)
         pa_assert_se(pa_card_set_profile(u->card, "off", false) >= 0);
 
     if (t->device == u->device)
@@ -1825,7 +1825,7 @@ static pa_hook_result_t transport_state_changed_cb(pa_bluetooth_discovery *y, pa
 
 /* Run from main thread */
 static int setup_transport(struct userdata *u) {
-    pa_bluetooth_transport *t;
+    pa_bluez4_transport *t;
 
     pa_assert(u);
     pa_assert(!u->transport);
@@ -1833,7 +1833,7 @@ static int setup_transport(struct userdata *u) {
 
     /* check if profile has a transport */
     t = u->device->transports[u->profile];
-    if (!t || t->state == PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED) {
+    if (!t || t->state == PA_BLUEZ4_TRANSPORT_STATE_DISCONNECTED) {
         pa_log_warn("Profile has no transport");
         return -1;
     }
@@ -2028,9 +2028,9 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
     d = PA_CARD_PROFILE_DATA(new_profile);
 
     if (*d != PROFILE_OFF) {
-        const pa_bluetooth_device *device = u->device;
+        const pa_bluez4_device *device = u->device;
 
-        if (!device->transports[*d] || device->transports[*d]->state == PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED) {
+        if (!device->transports[*d] || device->transports[*d]->state == PA_BLUEZ4_TRANSPORT_STATE_DISCONNECTED) {
             pa_log_warn("Profile not connected, refused to switch profile to %s", new_profile->name);
             return -PA_ERR_IO;
         }
@@ -2078,51 +2078,51 @@ static void create_card_ports(struct userdata *u, pa_hashmap *ports) {
     pa_assert(ports);
     pa_assert(u->device);
 
-    switch (pa_bluetooth_get_form_factor(u->device->class)) {
-        case PA_BT_FORM_FACTOR_UNKNOWN:
+    switch (pa_bluez4_get_form_factor(u->device->class)) {
+        case PA_BLUEZ4_FORM_FACTOR_UNKNOWN:
             break;
 
-        case PA_BT_FORM_FACTOR_HEADSET:
+        case PA_BLUEZ4_FORM_FACTOR_HEADSET:
             name_prefix = "headset";
             input_description = output_description = _("Headset");
             break;
 
-        case PA_BT_FORM_FACTOR_HANDSFREE:
+        case PA_BLUEZ4_FORM_FACTOR_HANDSFREE:
             name_prefix = "handsfree";
             input_description = output_description = _("Handsfree");
             break;
 
-        case PA_BT_FORM_FACTOR_MICROPHONE:
+        case PA_BLUEZ4_FORM_FACTOR_MICROPHONE:
             name_prefix = "microphone";
             input_description = _("Microphone");
             break;
 
-        case PA_BT_FORM_FACTOR_SPEAKER:
+        case PA_BLUEZ4_FORM_FACTOR_SPEAKER:
             name_prefix = "speaker";
             output_description = _("Speaker");
             break;
 
-        case PA_BT_FORM_FACTOR_HEADPHONE:
+        case PA_BLUEZ4_FORM_FACTOR_HEADPHONE:
             name_prefix = "headphone";
             output_description = _("Headphone");
             break;
 
-        case PA_BT_FORM_FACTOR_PORTABLE:
+        case PA_BLUEZ4_FORM_FACTOR_PORTABLE:
             name_prefix = "portable";
             input_description = output_description = _("Portable");
             break;
 
-        case PA_BT_FORM_FACTOR_CAR:
+        case PA_BLUEZ4_FORM_FACTOR_CAR:
             name_prefix = "car";
             input_description = output_description = _("Car");
             break;
 
-        case PA_BT_FORM_FACTOR_HIFI:
+        case PA_BLUEZ4_FORM_FACTOR_HIFI:
             name_prefix = "hifi";
             input_description = output_description = _("HiFi");
             break;
 
-        case PA_BT_FORM_FACTOR_PHONE:
+        case PA_BLUEZ4_FORM_FACTOR_PHONE:
             name_prefix = "phone";
             input_description = output_description = _("Phone");
             break;
@@ -2219,7 +2219,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid
     }
 
     if (p) {
-        pa_bluetooth_transport *t;
+        pa_bluez4_transport *t;
 
         if ((t = u->device->transports[*d]))
             p->available = transport_state_to_availability(t->state);
@@ -2234,11 +2234,11 @@ static int add_card(struct userdata *u) {
     bool b;
     pa_card_profile *p;
     enum profile *d;
-    pa_bt_form_factor_t ff;
+    pa_bluez4_form_factor_t ff;
     char *n;
     const char *default_profile;
-    const pa_bluetooth_device *device;
-    const pa_bluetooth_uuid *uuid;
+    const pa_bluez4_device *device;
+    const pa_bluez4_uuid *uuid;
 
     pa_assert(u);
     pa_assert(u->device);
@@ -2249,7 +2249,7 @@ static int add_card(struct userdata *u) {
     data.driver = __FILE__;
     data.module = u->module;
 
-    n = pa_bluetooth_cleanup_name(device->alias);
+    n = pa_bluez4_cleanup_name(device->alias);
     pa_proplist_sets(data.proplist, PA_PROP_DEVICE_DESCRIPTION, n);
     pa_xfree(n);
     pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, device->address);
@@ -2257,8 +2257,8 @@ static int add_card(struct userdata *u) {
     pa_proplist_sets(data.proplist, PA_PROP_DEVICE_CLASS, "sound");
     pa_proplist_sets(data.proplist, PA_PROP_DEVICE_BUS, "bluetooth");
 
-    if ((ff = pa_bluetooth_get_form_factor(device->class)) != PA_BT_FORM_FACTOR_UNKNOWN)
-        pa_proplist_sets(data.proplist, PA_PROP_DEVICE_FORM_FACTOR, pa_bt_form_factor_to_string(ff));
+    if ((ff = pa_bluez4_get_form_factor(device->class)) != PA_BLUEZ4_FORM_FACTOR_UNKNOWN)
+        pa_proplist_sets(data.proplist, PA_PROP_DEVICE_FORM_FACTOR, pa_bluez4_form_factor_to_string(ff));
 
     pa_proplist_sets(data.proplist, "bluez.path", device->path);
     pa_proplist_setf(data.proplist, "bluez.class", "0x%06x", (unsigned) device->class);
@@ -2317,7 +2317,7 @@ static int add_card(struct userdata *u) {
     d = PA_CARD_PROFILE_DATA(u->card->active_profile);
 
     if (*d != PROFILE_OFF && (!device->transports[*d] ||
-                              device->transports[*d]->state == PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)) {
+                              device->transports[*d]->state == PA_BLUEZ4_TRANSPORT_STATE_DISCONNECTED)) {
         pa_log_warn("Default profile not connected, selecting off profile");
         u->card->active_profile = pa_hashmap_get(u->card->profiles, "off");
         u->card->save_profile = false;
@@ -2333,8 +2333,8 @@ static int add_card(struct userdata *u) {
 }
 
 /* Run from main thread */
-static pa_bluetooth_device* find_device(struct userdata *u, const char *address, const char *path) {
-    pa_bluetooth_device *d = NULL;
+static pa_bluez4_device* find_device(struct userdata *u, const char *address, const char *path) {
+    pa_bluez4_device *d = NULL;
 
     pa_assert(u);
 
@@ -2344,7 +2344,7 @@ static pa_bluetooth_device* find_device(struct userdata *u, const char *address,
     }
 
     if (path) {
-        if (!(d = pa_bluetooth_discovery_get_by_path(u->discovery, path))) {
+        if (!(d = pa_bluez4_discovery_get_by_path(u->discovery, path))) {
             pa_log_error("%s is not a valid BlueZ audio device.", path);
             return NULL;
         }
@@ -2355,7 +2355,7 @@ static pa_bluetooth_device* find_device(struct userdata *u, const char *address,
         }
 
     } else {
-        if (!(d = pa_bluetooth_discovery_get_by_address(u->discovery, address))) {
+        if (!(d = pa_bluez4_discovery_get_by_address(u->discovery, address))) {
             pa_log_error("%s is not known.", address);
             return NULL;
         }
@@ -2370,7 +2370,7 @@ static pa_bluetooth_device* find_device(struct userdata *u, const char *address,
 }
 
 /* Run from main thread */
-static pa_hook_result_t uuid_added_cb(pa_bluetooth_discovery *y, const struct pa_bluetooth_hook_uuid_data *data,
+static pa_hook_result_t uuid_added_cb(pa_bluez4_discovery *y, const struct pa_bluez4_hook_uuid_data *data,
                                       struct userdata *u) {
     pa_card_profile *p;
 
@@ -2398,7 +2398,7 @@ static pa_hook_result_t uuid_added_cb(pa_bluetooth_discovery *y, const struct pa
 }
 
 /* Run from main thread */
-static pa_hook_result_t discovery_hook_cb(pa_bluetooth_discovery *y, const pa_bluetooth_device *d, struct userdata *u) {
+static pa_hook_result_t discovery_hook_cb(pa_bluez4_discovery *y, const pa_bluez4_device *d, struct userdata *u) {
     pa_assert(u);
     pa_assert(d);
 
@@ -2407,7 +2407,7 @@ static pa_hook_result_t discovery_hook_cb(pa_bluetooth_discovery *y, const pa_bl
 
     if (d->dead)
         pa_log_debug("Device %s removed: unloading module", d->path);
-    else if (!pa_bluetooth_device_any_audio_connected(d))
+    else if (!pa_bluez4_device_any_audio_connected(d))
         pa_log_debug("Unloading module, because device %s doesn't have any audio profiles connected anymore.", d->path);
     else
         return PA_HOOK_OK;
@@ -2422,7 +2422,7 @@ int pa__init(pa_module *m) {
     uint32_t channels;
     struct userdata *u;
     const char *address, *path;
-    pa_bluetooth_device *device;
+    pa_bluez4_device *device;
 
     pa_assert(m);
 
@@ -2474,7 +2474,7 @@ int pa__init(pa_module *m) {
     address = pa_modargs_get_value(ma, "address", NULL);
     path = pa_modargs_get_value(ma, "path", NULL);
 
-    if (!(u->discovery = pa_bluetooth_discovery_get(m->core)))
+    if (!(u->discovery = pa_bluez4_discovery_get(m->core)))
         goto fail;
 
     if (!(device = find_device(u, address, path)))
@@ -2483,11 +2483,11 @@ int pa__init(pa_module *m) {
     u->device = device;
 
     u->discovery_slot =
-        pa_hook_connect(pa_bluetooth_discovery_hook(u->discovery, PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED),
+        pa_hook_connect(pa_bluez4_discovery_hook(u->discovery, PA_BLUEZ4_HOOK_DEVICE_CONNECTION_CHANGED),
                         PA_HOOK_NORMAL, (pa_hook_cb_t) discovery_hook_cb, u);
 
     u->uuid_added_slot =
-        pa_hook_connect(pa_bluetooth_discovery_hook(u->discovery, PA_BLUETOOTH_HOOK_DEVICE_UUID_ADDED),
+        pa_hook_connect(pa_bluez4_discovery_hook(u->discovery, PA_BLUEZ4_HOOK_DEVICE_UUID_ADDED),
                         PA_HOOK_NORMAL, (pa_hook_cb_t) uuid_added_cb, u);
 
     u->sink_state_changed_slot =
@@ -2499,19 +2499,19 @@ int pa__init(pa_module *m) {
                         PA_HOOK_NORMAL, (pa_hook_cb_t) source_state_changed_cb, u);
 
     u->transport_state_changed_slot =
-        pa_hook_connect(pa_bluetooth_discovery_hook(u->discovery, PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED),
+        pa_hook_connect(pa_bluez4_discovery_hook(u->discovery, PA_BLUEZ4_HOOK_TRANSPORT_STATE_CHANGED),
                         PA_HOOK_NORMAL, (pa_hook_cb_t) transport_state_changed_cb, u);
 
     u->transport_nrec_changed_slot =
-        pa_hook_connect(pa_bluetooth_discovery_hook(u->discovery, PA_BLUETOOTH_HOOK_TRANSPORT_NREC_CHANGED),
+        pa_hook_connect(pa_bluez4_discovery_hook(u->discovery, PA_BLUEZ4_HOOK_TRANSPORT_NREC_CHANGED),
                         PA_HOOK_NORMAL, (pa_hook_cb_t) transport_nrec_changed_cb, u);
 
     u->transport_microphone_changed_slot =
-        pa_hook_connect(pa_bluetooth_discovery_hook(u->discovery, PA_BLUETOOTH_HOOK_TRANSPORT_MICROPHONE_GAIN_CHANGED),
+        pa_hook_connect(pa_bluez4_discovery_hook(u->discovery, PA_BLUEZ4_HOOK_TRANSPORT_MICROPHONE_GAIN_CHANGED),
                         PA_HOOK_NORMAL, (pa_hook_cb_t) transport_microphone_gain_changed_cb, u);
 
     u->transport_speaker_changed_slot =
-        pa_hook_connect(pa_bluetooth_discovery_hook(u->discovery, PA_BLUETOOTH_HOOK_TRANSPORT_SPEAKER_GAIN_CHANGED),
+        pa_hook_connect(pa_bluez4_discovery_hook(u->discovery, PA_BLUEZ4_HOOK_TRANSPORT_SPEAKER_GAIN_CHANGED),
                         PA_HOOK_NORMAL, (pa_hook_cb_t) transport_speaker_gain_changed_cb, u);
 
     /* Add the card structure. This will also initialize the default profile */
@@ -2617,7 +2617,7 @@ void pa__done(pa_module *m) {
     pa_xfree(u->path);
 
     if (u->discovery)
-        pa_bluetooth_discovery_unref(u->discovery);
+        pa_bluez4_discovery_unref(u->discovery);
 
     pa_xfree(u);
 }
diff --git a/src/modules/bluetooth/module-bluez4-discover.c b/src/modules/bluetooth/module-bluez4-discover.c
index e6ae931..50b1676 100644
--- a/src/modules/bluetooth/module-bluez4-discover.c
+++ b/src/modules/bluetooth/module-bluez4-discover.c
@@ -55,7 +55,7 @@ struct userdata {
     pa_module *module;
     pa_modargs *modargs;
     pa_core *core;
-    pa_bluetooth_discovery *discovery;
+    pa_bluez4_discovery *discovery;
     pa_hook_slot *slot;
     pa_hashmap *hashmap;
 };
@@ -65,7 +65,7 @@ struct module_info {
     uint32_t module;
 };
 
-static pa_hook_result_t load_module_for_device(pa_bluetooth_discovery *y, const pa_bluetooth_device *d, struct userdata *u) {
+static pa_hook_result_t load_module_for_device(pa_bluez4_discovery *y, const pa_bluez4_device *d, struct userdata *u) {
     struct module_info *mi;
 
     pa_assert(u);
@@ -73,7 +73,7 @@ static pa_hook_result_t load_module_for_device(pa_bluetooth_discovery *y, const
 
     mi = pa_hashmap_get(u->hashmap, d->path);
 
-    if (pa_bluetooth_device_any_audio_connected(d)) {
+    if (pa_bluez4_device_any_audio_connected(d)) {
 
         if (!mi) {
             pa_module *m = NULL;
@@ -145,10 +145,10 @@ int pa__init(pa_module* m) {
     ma = NULL;
     u->hashmap = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
 
-    if (!(u->discovery = pa_bluetooth_discovery_get(u->core)))
+    if (!(u->discovery = pa_bluez4_discovery_get(u->core)))
         goto fail;
 
-    u->slot = pa_hook_connect(pa_bluetooth_discovery_hook(u->discovery, PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED),
+    u->slot = pa_hook_connect(pa_bluez4_discovery_hook(u->discovery, PA_BLUEZ4_HOOK_DEVICE_CONNECTION_CHANGED),
                               PA_HOOK_NORMAL, (pa_hook_cb_t) load_module_for_device, u);
 
     return 0;
@@ -174,7 +174,7 @@ void pa__done(pa_module* m) {
         pa_hook_slot_free(u->slot);
 
     if (u->discovery)
-        pa_bluetooth_discovery_unref(u->discovery);
+        pa_bluez4_discovery_unref(u->discovery);
 
     if (u->hashmap) {
         struct module_info *mi;
-- 
1.7.11.7



More information about the pulseaudio-discuss mailing list