bluetooth: add HFP Gateway support

Create the 'Handsfree Gateway' profile for bluetooth cards and add
filters for 'org.bluez.HandsfreeGateway' to the discover module so
module-bluetooth-device is loaded with the correct profile when a
Handsfree Gateway connects to bluetoothd (in this case bluetoothd
is acting as the headset).
This commit is contained in:
João Paulo Rechi Vita 2010-01-29 11:01:31 -02:00 committed by Lennart Poettering
parent edf5f5be6b
commit 342e06498f
4 changed files with 72 additions and 20 deletions

View file

@ -83,8 +83,10 @@ static pa_hook_result_t load_module_for_device(pa_bluetooth_discovery *y, const
mi = pa_hashmap_get(u->hashmap, d->path);
if (!d->dead &&
d->device_connected > 0 && (d->audio_state >= PA_BT_AUDIO_STATE_CONNECTED || d->audio_source_state >= PA_BT_AUDIO_STATE_CONNECTED)) {
if (!d->dead && d->device_connected > 0 &&
(d->audio_state >= PA_BT_AUDIO_STATE_CONNECTED ||
d->audio_source_state >= PA_BT_AUDIO_STATE_CONNECTED ||
d->hfgw_state > PA_BT_AUDIO_STATE_CONNECTED)) {
if (!mi) {
pa_module *m = NULL;
@ -119,6 +121,9 @@ static pa_hook_result_t load_module_for_device(pa_bluetooth_discovery *y, const
if (d->audio_source_state >= PA_BT_AUDIO_STATE_CONNECTED)
args = pa_sprintf_malloc("%s profile=\"a2dp_source\" auto_connect=no", args);
if (d->hfgw_state > PA_BT_AUDIO_STATE_CONNECTED)
args = pa_sprintf_malloc("%s profile=\"hfgw\"", args);
pa_log_debug("Loading module-bluetooth-device %s", args);
m = pa_module_load(u->module->core, "module-bluetooth-device", args);
pa_xfree(args);