From 22c2c1435f4fe27af97cf0ed35cb0c28b13d8e6a Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Fri, 7 Sep 2018 18:41:02 +0200 Subject: Implement link with softmixer in hal-bt plugin In hal bluetooth plugin, implement all call to softmixer used to enable/disable bluetooth stream and to set bt streamed device. Change-Id: I16f6fbf6a02f34490876d390883bdd040661647e Signed-off-by: Jonathan Aillet --- plugins/lib/bluetooth/hal-bt.c | 44 ++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 15 deletions(-) (limited to 'plugins/lib/bluetooth/hal-bt.c') diff --git a/plugins/lib/bluetooth/hal-bt.c b/plugins/lib/bluetooth/hal-bt.c index bc89fe1..329cc48 100644 --- a/plugins/lib/bluetooth/hal-bt.c +++ b/plugins/lib/bluetooth/hal-bt.c @@ -28,6 +28,7 @@ #include "hal-bt.h" #include "hal-bt-cb.h" #include "hal-bt-data.h" +#include "hal-bt-mixer-link.h" // Local (static) Hal manager data structure static struct HalBtPluginData localHalBtPluginData; @@ -171,11 +172,18 @@ CTLP_CAPI(init, source, argsJ, queryJ) if(localHalBtPluginData.selectedBtDevice) { localHalBtPluginData.btStreamEnabled = 1; - /* TODO JAI : send selected device to softmixer (and enable stream here for now) - * Tell the softmixer that we want it as an input using 'bluealsa:HCI=hci0,DEV=F6:32:15:2A:80:70,PROFILE=a2dp' - string as capture associated with an 'uid' using smixer verb 'set-capture' - * Enable capture stream to playback using 'uid' used at 'set-capture' call - */ + + if(HalBtMixerLinkSetBtStreamingSettings(source->api, + localHalBtPluginData.currentHalData->ctlHalSpecificData->mixerApiName, + localHalBtPluginData.btStreamEnabled, + localHalBtPluginData.selectedBtDevice->hci, + localHalBtPluginData.selectedBtDevice->address)) { + AFB_ApiError(source->api, + "Couldn't set bluetooth streaming settings during call to verb '%s' of api '%s'", + MIXER_SET_STREAMED_BT_DEVICE_VERB, + localHalBtPluginData.currentHalData->ctlHalSpecificData->mixerApiName); + return -8; + } } return 0; @@ -191,18 +199,24 @@ CTLP_CAPI(events, source, argsJ, queryJ) return -1; } - if(localHalBtPluginData.selectedBtDevice && localHalBtPluginData.selectedBtDevice != previouslySelectedBtDevice) { + if(localHalBtPluginData.selectedBtDevice && localHalBtPluginData.selectedBtDevice != previouslySelectedBtDevice) localHalBtPluginData.btStreamEnabled = 1; - /* TODO JAI : send selected device to softmixer (and enable stream here for now) - * Tell the softmixer that we want it as an input using 'bluealsa:HCI=hci0,DEV=F6:32:15:2A:80:70,PROFILE=a2dp' - string as capture associated with an 'uid' using smixer verb 'set-capture' - * Enable capture stream to playback using 'uid' used at 'set-capture' call - */ - } - else if (! localHalBtPluginData.selectedBtDevice) { + else if (! localHalBtPluginData.selectedBtDevice) localHalBtPluginData.btStreamEnabled = 0; - // TODO JAI: Disable capture stream to playback using 'uid' used at 'set-capture' call + else + return 0; + + if(HalBtMixerLinkSetBtStreamingSettings(source->api, + localHalBtPluginData.currentHalData->ctlHalSpecificData->mixerApiName, + localHalBtPluginData.btStreamEnabled, + localHalBtPluginData.selectedBtDevice ? localHalBtPluginData.selectedBtDevice->hci : NULL, + localHalBtPluginData.selectedBtDevice ? localHalBtPluginData.selectedBtDevice->address : NULL)) { + AFB_ApiError(source->api, + "Couldn't set bluetooth streaming settings during call to verb '%s' of api '%s'", + MIXER_SET_STREAMED_BT_DEVICE_VERB, + localHalBtPluginData.currentHalData->ctlHalSpecificData->mixerApiName); + return -2; } - return 0; + return 1; } \ No newline at end of file -- cgit 1.2.3-korg