Commit graph

7443 commits

Author SHA1 Message Date
João Paulo Rechi Vita
8d303f0bd1 bluetooth: Process source messages for BlueZ 5 cards 2013-09-29 16:54:38 +03:00
João Paulo Rechi Vita
05366fdc22 bluetooth: Process sink messages for BlueZ 5 cards 2013-09-29 16:54:38 +03:00
João Paulo Rechi Vita
eb9813c833 bluetooth: Create I/O thread function for BlueZ 5 cards
Create the thread function, the render and push functions for A2DP, the
process message function for communication between the I/O thread and
the main thread, and other helper functions related to them.
2013-09-29 16:54:38 +03:00
João Paulo Rechi Vita
44462904df bluetooth: Set card profile for BlueZ 5 cards 2013-09-29 16:54:38 +03:00
João Paulo Rechi Vita
d243fdd07b bluetooth: Start / stop I/O thread for BlueZ 5 cards 2013-09-29 16:54:38 +03:00
João Paulo Rechi Vita
8d1decffd7 bluetooth: Create source for BlueZ 5 cards 2013-09-29 16:54:38 +03:00
João Paulo Rechi Vita
0274032141 bluetooth: Create sink for BlueZ 5 cards 2013-09-29 16:54:38 +03:00
João Paulo Rechi Vita
7e80678cc5 bluetooth: Initialize profiles for BlueZ 5 cards
Initialized the currently active profile, configure and acquire the
transport.
2013-09-29 16:54:38 +03:00
João Paulo Rechi Vita
a0ed6d7970 bluetooth: Create BlueZ 5 card profile for each audio UUID 2013-09-29 16:54:38 +03:00
João Paulo Rechi Vita
5a9007338b bluetooth: Create BlueZ 5 card ports 2013-09-29 16:54:38 +03:00
João Paulo Rechi Vita
501f5e2898 bluetooth: Create BlueZ 5 card 2013-09-29 16:54:38 +03:00
João Paulo Rechi Vita
6ba1610b6f bluetooth: Unload module-bluez5-device on device's disconnection 2013-09-29 16:54:38 +03:00
João Paulo Rechi Vita
da61957602 bluetooth: Get BlueZ 5 device object
Get the remote device information stored in pa_bluetooth_discovery. This
also creates the mandatory parameter 'path' for module-bluez5-device,
which is used to inform the object path of the remote device in BlueZ on
the module load.
2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
384f4751eb bluetooth: Create module-bluez5-device 2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
a5fdf965ed bluetooth: Track devices in module-bluez5-discover 2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
e352da60a7 bluetooth: Handle PropertiesChanged for org.bluez.MediaTransport1 2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
f65cafe64d bluetooth: Handle PropertiesChanged for org.bluez.Device1 2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
82fd8cc845 bluetooth: Protect from a misbehaving bluetoothd
bluetoothd always send the GetManagedObjects() reply messages with the
objects array argument following an in-depth order starting from the
root. That means parents will always be known at the time their children
objects are parsed, if clients parse the objects in the same order they
appear in the array, as we do in PulseAudio.

This commit tries to protect PulseAudio in the case bluetoothd changes
that behavior for some reason. It hasn't been tested, since this
situation never occurs.
2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
89e97215c7 bluetooth: Parse BlueZ 5 device properties
This code is based on previous work by Mikel Astiz.
2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
877f0a7d54 bluetooth: Handle PropertiesChanged for org.bluez.Adapter1 2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
a59177e666 bluetooth: Register endpoints with BlueZ 5 adapter 2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
42dccb6b37 bluetooth: Parse BlueZ 5 adapter properties 2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
f1d8958fb6 bluetooth: Parse BlueZ 5 D-Bus interfaces
Parse the arguments of the InterfacesAdded signal and the
GetManagedObjects() reply.

This code is based on previous work by Mikel Astiz.
2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
878eccb680 bluetooth: Handle InterfacesAdded and InterfacesRemoved
This code is based on previous work by Mikel Astiz.
2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
1e58120a5c bluetooth: Create a function to remove only one adapter object 2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
b8edddddd3 bluetooth: Get managed objects
Get objects from the BlueZ 5 object manager. This code is based on
previous work by Mikel Astiz.
2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
d186d0f105 bluetooth: Add utility function to send D-Bus messages with reply 2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
63108c5cc8 bluetooth: Implement org.bluez.MediaEndpoint1.ClearConfiguration() 2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
2594909338 bluetooth: Implement org.bluez.MediaEndpoint1.SelectConfiguration() 2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
449d6cb1e2 bluetooth: Implement org.bluez.MediaEndpoint1.SetConfiguration() 2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
aff6fa79ba bluetooth: Register MediaEndpoint1 objects with D-Bus 2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
e78e7e698c bluetooth: Create pa_bluetooth_transport for BlueZ 5 support
Create the pa_bluetooth_transport structure to store information about
the bluetooth transport and utility functions to manipulate this
structure. The acquire() and release() operations are function pointers
in the pa_bluetooth_transport structure to make possible for different
transport backends to provide different implementations of these
operations. Thre is also a userdata field for the transport backend
provide data for the acquire/release functions.

This commit also creates a new function
pa_bluetooth_device_any_transport_connected() to check if there is any
audio connection between the host and a remote device.
2013-09-29 16:54:37 +03:00
João Paulo Rechi Vita
c3efb24aa7 bluetooth: Remove all devices and adapters when org.bluez goes away 2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
9be71b5838 bluetooth: Create pa_bluetooth_device for BlueZ 5 support
Create a structure pa_bluetooth_device to store information about the
bluetooth device and utility functions to manipulate this structure.
2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
546da17cbe bluetooth: Create pa_bluetooth_adapter for BlueZ 5 support 2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
19a23cef10 bluetooth: Create infrastrucure for bluetooth hooks
Create a pa_bluetooth_hook enum type and API to get pa_hooks from the
opaque pa_bluetooth_discovery struct.
2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
dcc28a23f9 bluetooth: Track org.bluez for BlueZ 5 2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
0103cd1379 bluetooth: Create pa_bluetooth_discovery for BlueZ 5
pa_bluetooth_discovery is the struct that holds information about known
Bluetooth audio devices and other information about the Bluetooth stack.

This commit also creates bluez5-util.[ch], which will hold a lot of
utility functions to help with the BlueZ 5 support.
2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
c706792df7 bluetooth: Create stub for module-bluez5-discover 2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
795e488f25 build: Add support for enabling/disabling BlueZ 5 support 2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
d7d3a1e2b2 build: Make the build of bluetooth modules BlueZ 4 specific 2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
4f972aa993 bluetooth: Remove module-bluetooth-proximity
module-bluetooth-proximity has not worked for quite a while, since it
uses pre-BlueZ4 APIs. Nobody complained since then, which is a good
indication that it doesn't have much users. Even the original commit
message refers to it more as a toy than as something of great use: "add
new fun module that automatically mutes your audio devices when you
leave with your bluetooth phone, and unmutes when you come back"

Removing it we completely remove the dependency on libbluetooth.
2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
e647e74f32 bluetooth: Prefix BlueZ 4 card profiles enum with PA_BLUEZ4_
Also typedef the enum as pa_bluez4_profile_t.
2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
75922e4667 bluetooth: Register BlueZ 4 endpoints in a separate object path
We need diferent object paths for BlueZ 4 and BlueZ 5 endpoints to avoid
crashing the daemon in the case both modules are loaded in parallel.
2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
0f84fef04d bluetooth: Name BlueZ 4 symbols accordingly
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*
2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
438094baa4 bluetooth: Rename shared struct to make it BlueZ 4 specific 2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
e414b5828b bluetooth: Rename bluetooth modules to BlueZ 4 2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
0589bed305 bluetooth: Update modules description and copyright
The current set of bluetooth modules only support up to BlueZ 4. Since
the BlueZ API when through a big change with the release of BlueZ 5 the
modules will be forked into a new set for BlueZ 5.

This commit also fixes the spelling of Bluetooth (it's a trademark which
should always be spelled with capital B) and the spelling of my name,
and also update the copyright note dates throughout the Bluetooth
modules.
2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
09b6c36944 Revert "bluetooth: Detect BlueZ 5"
This reverts commit 2247b18739.

This is part of the reversion of BlueZ 5 support so it can be added back
in a separate set of modules. This makes the code easier to maintain and
decrease PulseAudio's binary size.
2013-09-29 16:54:36 +03:00
João Paulo Rechi Vita
f3fadfa07f Revert "bluetooth: Parse the tree returned by ObjectManager"
This reverts commit c4bd51a345.

This is part of the reversion of BlueZ 5 support so it can be added back
in a separate set of modules. This makes the code easier to maintain and
decrease PulseAudio's binary size.
2013-09-29 16:54:36 +03:00