diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-09-11 17:28:25 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-10-08 15:57:27 +0200 |
commit | 9b706274538456524003a119fd24fb00e3bde5e2 (patch) | |
tree | 9ccfab28bb010093aa814e05ab97838ac0566d8b /plugins/lib | |
parent | ad0caaef716aef6a79c4b86b86916a6dcd3e395a (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>
Diffstat (limited to 'plugins/lib')
-rw-r--r-- | plugins/lib/bluetooth/hal-bt.c | 15 |
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 |