From e0f57e523112e1bc73a04e8615d7a21355f0ce0e Mon Sep 17 00:00:00 2001 From: Thierry Bultel Date: Tue, 4 Dec 2018 23:11:20 +0100 Subject: Add support for bluetooth telephony This adds support for bluetooth telephony. A big rework in the softmixer internals has been mandatory, in order to support dynamic streams creation and deletions. Bluetooth telephony relies on the recent evolutions of bluez-alsa, the most important one being the support of HFP over Ofono. The softmixer opens PCM ioplugs provided by bluez-alsa. Bluetooth SCO needs 2 streams, one for listening and the other for talking. These streams are created upon requests sent by the hal-manager. The hal manager subscribes for bluez-alsa events and request the list of availalble transports. For each "attach" transaction verb, the softmixer maintains a list of the all created objects (sources, sinks, zones, ramps, streams, and more) Additionnally, it creates a new verb when the attach succeeds, that verb is typically something like "sco_XX:XX:XX:XX:XX:XX", and the only supported action at the present time is {"action":"remove"}, that performs all the cleanup of the registered objects. Change-Id: I1b119e6c079e60daf771e63c083a1ef33a39f379 Signed-off-by: Thierry Bultel --- plugins/alsa/alsa-bluez.c | 71 ----------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 plugins/alsa/alsa-bluez.c (limited to 'plugins/alsa/alsa-bluez.c') diff --git a/plugins/alsa/alsa-bluez.c b/plugins/alsa/alsa-bluez.c deleted file mode 100644 index 080c3c8..0000000 --- a/plugins/alsa/alsa-bluez.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright(C) 2018 "IoT.bzh" - * Author Thierry Bultel - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http : //www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License - - * for the specific language governing permissions and - * limitations under the License. - * - * - */ - - -#include "alsa-bluez.h" - -#include -#include - -#define ALSA_BLUEZ_PROXY_LIB "/usr/lib/alsa-lib/libasound_module_pcm_bluealsa_proxy.so" -#define ALSA_BLUEZ_PROXY_SETDEVICE "bluealsa_proxy_set_remote_device" - -typedef int (*bluealsa_set_remote_device_ptr) (const char * interface, const char * device, const char * profile); - -static bluealsa_set_remote_device_ptr bluealsa_proxy_set_remote_device = NULL; - -void alsa_bluez_init() { - static bool initialized = false; - if (initialized) - goto failed; - -#if SND_LIB_VERSION >= (1<<16|1<<8|6) - char errbuf[256]; - void * dl = snd_dlopen(ALSA_BLUEZ_PROXY_LIB, RTLD_NOW, errbuf, 256); -#else - void * dl = snd_dlopen(ALSA_BLUEZ_PROXY_LIB, RTLD_NOW); -#endif - if (!dl) { - printf("Failed to open bluealsa proxy plugin\n"); - goto failed; - } - - void * func = snd_dlsym(dl, ALSA_BLUEZ_PROXY_SETDEVICE, SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION)); - if (!func) { - printf("Unable to find %s symbol\n", ALSA_BLUEZ_PROXY_SETDEVICE); - goto failed; - } - - bluealsa_proxy_set_remote_device = func; - initialized = true; - -failed: - return; -} - -int alsa_bluez_set_remote_device(const char * interface, const char * device, const char * profile) { - if (!bluealsa_proxy_set_remote_device) - return -1; - - return bluealsa_proxy_set_remote_device(interface,device,profile); -} - - -- cgit 1.2.3-korg