From d289f1267172a124fceb2fb657895eec2a0c2e0b Mon Sep 17 00:00:00 2001 From: Seungyoun Ju Date: Mon, 30 May 2016 21:56:40 +0900 Subject: [PATCH] Provide BLE pairing method as best effort way [Model] SM-Z300F [BinType] AP [Customer] OPEN [Issue#] N/A [Request] Operator [Occurrence Version] BPE5 [Problem] Basis Peak watch disconnects BLE connection if remote device doesn't make BLE pairing within 5 seconds. But BLE service discovery requires over 5 seconds so it is always disconnected. [Cause & Measure] There is no way to make BLE pairing without BLE service discovery. So it needs to provide BLE pairing way as best effort way. [Checking Method] Make BLE connection with Basis Peak [Team] Basic connection [Developer] Seungyoun Ju [Solution company] Samsung [Change Type] Specification change Change-Id: I8930a9546cfa8d66ade64c8d42a29155232bda43 Signed-off-by: DoHyun Pyun --- src/device.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/device.c b/src/device.c index 64c1eac..2b3c25f 100644 --- a/src/device.c +++ b/src/device.c @@ -2908,8 +2908,14 @@ static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg, return btd_error_already_exists(msg); else if (device_is_bonded(device, DEV_CONN_LE)) return btd_error_already_exists(msg); - } - else { + + if (device->bredr) + conn_type = DEV_CONN_BREDR; + else if (device->le) + conn_type = DEV_CONN_LE; + else + conn_type = DEV_CONN_BREDR; + } else { if (device_is_bonded(device, conn_type)) return btd_error_already_exists(msg); } @@ -2929,9 +2935,9 @@ static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg, #endif #ifdef __TIZEN_PATCH__ - if ((device_is_bredrle(device) || bdaddr_type != BDADDR_BREDR) && - conn_type == DEV_CONN_LE) { - DBG("Le Connect request"); + if (conn_type == DEV_CONN_LE && + (device_is_bredrle(device) || bdaddr_type != BDADDR_BREDR)) { + DBG("LE Connect request"); connect_le = TRUE; } #endif @@ -2945,8 +2951,8 @@ static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg, io_cap = IO_CAPABILITY_NOINPUTNOOUTPUT; #ifdef __TIZEN_PATCH__ - if (((conn_type == DEV_CONN_DEFAULT && bdaddr_type != BDADDR_BREDR) || - (connect_le))) + if ((conn_type == DEV_CONN_LE && bdaddr_type != BDADDR_BREDR) || + connect_le) bonding = bonding_request_new(msg, device, bdaddr_type, agent); else bonding = bonding_request_new(msg, device, BDADDR_BREDR, agent); @@ -2970,7 +2976,7 @@ static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg, * this in the ATT connect callback) */ #ifdef __TIZEN_PATCH__ - if (((conn_type == DEV_CONN_DEFAULT && bdaddr_type != BDADDR_BREDR) || + if (((conn_type == DEV_CONN_LE && bdaddr_type != BDADDR_BREDR) || (connect_le)) && !device->le_state.connected) err = device_connect_le(device); else if (connect_le) /* Send bonding request if LE is already connected*/ -- 2.7.4