summaryrefslogtreecommitdiffstats
path: root/plugins/lib/bluetooth/hal-bt.c
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-09-07 18:41:02 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:57:27 +0200
commit22c2c1435f4fe27af97cf0ed35cb0c28b13d8e6a (patch)
tree81270337e2e09de460e4bef88e6b68e46d9ae469 /plugins/lib/bluetooth/hal-bt.c
parent13d8b36149570aa91b8659ae74cf14e11c621233 (diff)
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 <jonathan.aillet@iot.bzh>
Diffstat (limited to 'plugins/lib/bluetooth/hal-bt.c')
-rw-r--r--plugins/lib/bluetooth/hal-bt.c44
1 files changed, 29 insertions, 15 deletions
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