Provide BLE pairing method as best effort way 02/72402/1 accepted/tizen/common/20160603.150602 accepted/tizen/ivi/20160602.231152 accepted/tizen/mobile/20160602.231206 accepted/tizen/tv/20160602.231142 accepted/tizen/wearable/20160602.231140 submit/tizen/20160602.084111
authorSeungyoun Ju <sy39.ju@samsung.com>
Mon, 30 May 2016 12:56:40 +0000 (21:56 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 1 Jun 2016 00:02:33 +0000 (09:02 +0900)
[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 <dh79.pyun@samsung.com>
src/device.c

index 64c1eac..2b3c25f 100644 (file)
@@ -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*/