From b6acaeea244541d58b0ff1fc6b7d1dc1dc79cc8a Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Fri, 28 Sep 2018 16:57:04 +0800 Subject: binding: bluetooth: report HFPConnected status Due to ofono code removal the HFPConnected status wasn't being reported to clients that depended on it. Ideally this needs to be in agl-service-telephony binding, but till then just report HFP as 'connected' if both device is connected and has the HFP UUID in the advertised services. Bug-AGL: SPEC-1765 Change-Id: I6a1c5afe1d89a6ac6a4e84b07777d04368a4e772 Signed-off-by: Matt Ranostay --- binding-bluetooth/bluetooth-api.c | 10 +++++++--- binding-bluetooth/bluetooth-api.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/binding-bluetooth/bluetooth-api.c b/binding-bluetooth/bluetooth-api.c index cf6e427..61fa204 100644 --- a/binding-bluetooth/bluetooth-api.c +++ b/binding-bluetooth/bluetooth-api.c @@ -249,9 +249,13 @@ static json_object *new_json_object_from_device(struct btd_device *BDdevice, uns if (BD_HFPCONNECTED & filter) { - jstring = (TRUE == BDdevice->hfpconnected) ? - json_object_new_string("True"):json_object_new_string("False"); - json_object_object_add(jresp, "HFPConnected", jstring); + gpointer found = NULL; + + if (BDdevice->connected) + found = g_list_find_custom(BDdevice->uuids, HFP_UUID, strcmp); + + json_object_object_add(jresp, "HFPConnected", + json_object_new_string(found ? "True": "False")); } if (BD_UUID_PROFILES & filter) diff --git a/binding-bluetooth/bluetooth-api.h b/binding-bluetooth/bluetooth-api.h index b1dbd45..55a9095 100644 --- a/binding-bluetooth/bluetooth-api.h +++ b/binding-bluetooth/bluetooth-api.h @@ -50,6 +50,7 @@ typedef struct { unsigned int index; /* currently selected media file */ } BtCtxHandleT; +#define HFP_UUID "0000111f-0000-1000-8000-00805f9b34fb" #endif /* BLUETOOTH_API_H */ -- cgit 1.2.3-korg