From 9b706274538456524003a119fd24fb00e3bde5e2 Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Tue, 11 Sep 2018 17:28:25 +0200 Subject: Improve Hal-Bt plugin event catcher behaviour Improve Hal-Bt plugin event catcher behaviour by : - avoiding error generation when bluetooth device is changed. - avoiding calling 'mixer' when the selected device is changed. Change-Id: Ia7402f865551ff9df418269ac6927b66581bae9a Signed-off-by: Jonathan Aillet --- plugins/lib/bluetooth/hal-bt.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 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 0f49311..8caee5b 100644 --- a/plugins/lib/bluetooth/hal-bt.c +++ b/plugins/lib/bluetooth/hal-bt.c @@ -213,12 +213,15 @@ CTLP_CAPI(events, source, argsJ, queryJ) return -1; } - if(localHalBtPluginData.selectedBtDevice && localHalBtPluginData.selectedBtDevice != previouslySelectedBtDevice) + if(localHalBtPluginData.selectedBtDevice == previouslySelectedBtDevice) { + AFB_ApiDebug(source->api, "Bluetooth event received but device didn't change"); + return 0; + } + + if(localHalBtPluginData.selectedBtDevice) localHalBtPluginData.btStreamEnabled = 1; - else if (! localHalBtPluginData.selectedBtDevice) - localHalBtPluginData.btStreamEnabled = 0; else - return 0; + localHalBtPluginData.btStreamEnabled = 0; if(HalBtMixerLinkSetBtStreamingSettings(source->api, localHalBtPluginData.currentHalData->ctlHalSpecificData->mixerApiName, @@ -232,5 +235,5 @@ CTLP_CAPI(events, source, argsJ, queryJ) return -2; } - return 1; -} + return 0; +} \ No newline at end of file -- cgit 1.2.3-korg