summaryrefslogtreecommitdiffstats
path: root/plugins/lib/bluetooth/hal-bt-data.c
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-09-11 17:19:27 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:57:27 +0200
commit26741cc7c9fa1302016d05f936befc7f1b79bfd0 (patch)
treea38b1c0e1dd02887b1ddff492cf55d16415461ab /plugins/lib/bluetooth/hal-bt-data.c
parente185efc0a2ed5b8d295d29a7afadd84342b80549 (diff)
Improve Hal-Bt plugin A2DP bt devices detection
Consider an A2DP bluetooth device as connected only if its seen as 'AVPConnected' by 'Bluetooth-Manager'. Change-Id: I54511a193ebf64e35a7605723440f3a0fae2b2fd Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to 'plugins/lib/bluetooth/hal-bt-data.c')
-rw-r--r--plugins/lib/bluetooth/hal-bt-data.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/lib/bluetooth/hal-bt-data.c b/plugins/lib/bluetooth/hal-bt-data.c
index a548039..cfcb57d 100644
--- a/plugins/lib/bluetooth/hal-bt-data.c
+++ b/plugins/lib/bluetooth/hal-bt-data.c
@@ -96,7 +96,7 @@ struct HalBtDeviceData *HalBtDataAddBtDeviceToBtDeviceList(struct HalBtDeviceDat
// TODO JAI : get hci device of bt device here
if(wrap_json_unpack(currentSingleBtDeviceDataJ,
- "{s:s s:s s:o}",
+ "{s:s s:s}",
"Name", &currentBtDeviceName,
"Address", &currentBtDeviceAddress)) {
HalBtDataRemoveSelectedBtDeviceFromList(firstBtDeviceData, currentBtDeviceData);
@@ -171,7 +171,7 @@ int HalBtDataHandleReceivedSingleBtDeviceData(struct HalBtPluginData *halBtPlugi
unsigned int idx = 0, currentBtDeviceIsConnected, currentBtDeviceIsA2DP;
- char *currentBtDeviceAddress, *currentBtDeviceIsConnectedString;
+ char *currentBtDeviceAddress, *currentBtDeviceIsConnectedString, *currentBtDeviceIsAVPConnectedString;
json_object *currentBtAllProfilesJ, *currentBtCurrentProfileJ;
@@ -180,9 +180,10 @@ int HalBtDataHandleReceivedSingleBtDeviceData(struct HalBtPluginData *halBtPlugi
return -1;
if(wrap_json_unpack(currentSingleBtDeviceDataJ,
- "{s:s s:s s:s}",
+ "{s:s s:s s:s s:o}",
"Address", &currentBtDeviceAddress,
"Connected", &currentBtDeviceIsConnectedString,
+ "AVPConnected", &currentBtDeviceIsAVPConnectedString,
"UUIDs", &currentBtAllProfilesJ)) {
return -2;
}
@@ -210,7 +211,8 @@ int HalBtDataHandleReceivedSingleBtDeviceData(struct HalBtPluginData *halBtPlugi
if(! currentBtDeviceIsA2DP)
return 0;
- currentBtDeviceIsConnected = ! strncmp(currentBtDeviceIsConnectedString, "True", strlen(currentBtDeviceIsConnectedString));
+ currentBtDeviceIsConnected = ((! strncmp(currentBtDeviceIsConnectedString, "True", strlen(currentBtDeviceIsConnectedString))) &&
+ (! strncmp(currentBtDeviceIsAVPConnectedString, "True", strlen(currentBtDeviceIsAVPConnectedString))));
currentBtDevice = HalBtDataSearchBtDeviceByAddress(&halBtPluginData->first, currentBtDeviceAddress);