aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-09-11 17:28:25 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:57:27 +0200
commit9b706274538456524003a119fd24fb00e3bde5e2 (patch)
tree9ccfab28bb010093aa814e05ab97838ac0566d8b
parentad0caaef716aef6a79c4b86b86916a6dcd3e395a (diff)
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 <jonathan.aillet@iot.bzh>
-rw-r--r--plugins/lib/bluetooth/hal-bt.c15
1 files changed, 9 insertions, 6 deletions
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