Return ALREADY_CONNECT ERROR if device is already paired 64/230864/3
authorhimanshu <h.himanshu@samsung.com>
Wed, 15 Apr 2020 08:36:42 +0000 (14:06 +0530)
committerhimanshu <h.himanshu@samsung.com>
Fri, 17 Apr 2020 04:12:25 +0000 (09:42 +0530)
Change-Id: I1ff5ec86191059d740cba14b19f2eef0e42ff8a6
Signed-off-by: himanshu <h.himanshu@samsung.com>
bt-oal/bluez_hal/src/bt-hal-device-dbus-handler.c
bt-oal/common/oal-common.c
bt-oal/hardware/bluetooth.h
bt-oal/include/oal-manager.h
bt-service-adaptation/services/device/bt-service-core-device.c

index 8ed366f..1ffc035 100644 (file)
@@ -737,8 +737,8 @@ static void __bt_hal_bond_device_cb(GDBusProxy *proxy, GAsyncResult *res,
                g_dbus_error_strip_remote_error(err);
                ERR("@@@Error occured in CreateBonding [%s]", err->message);
                if (g_strrstr(err->message, "Already Exists")) {
-                       ERR("Still bond existing even after remove");
-                       result = BT_STATUS_AUTH_FAILURE;
+                       ERR("Bond Already exists");
+                       result = BT_STATUS_ALREADY_CONNECT;
                } else if (g_strrstr(err->message, "Authentication Rejected")) {
                        INFO("REJECTED");
                        result = BT_STATUS_AUTH_REJECTED;
@@ -774,10 +774,7 @@ static void __bt_hal_bond_device_cb(GDBusProxy *proxy, GAsyncResult *res,
                }
        }
 
-       if (result == BT_STATUS_AUTH_FAILURE ||
-                       result == BT_STATUS_RMT_DEV_DOWN ||
-                       result == BT_STATUS_AUTH_REJECTED ||
-                       result == BT_STATUS_FAIL) {
+       if (result != BT_STATUS_SUCCESS) {
                DBG("Bonding Failed!!");
 
                /* Prepare to send event to HAL bluetooth */
index a367159..068cf6f 100644 (file)
@@ -187,6 +187,8 @@ oal_status_t convert_to_oal_status(bt_status_t status)
                break;
        case BT_STATUS_CONN_TOUT:
                ret = OAL_STATUS_LINK_LOSS;
+       case BT_STATUS_ALREADY_CONNECT:
+               ret = OAL_STATUS_ALREADY_CONNECT;
                break;
 #ifdef TIZEN_BT_HAL
        case BT_STATUS_CONN_TERM_LOCAL_HOST:
index 7cda2ee..6a233bc 100644 (file)
@@ -98,7 +98,8 @@ typedef enum {
        BT_STATUS_CONN_TOUT,   /* disconnection due to supervision timeout */
        BT_STATUS_AUTH_REJECTED,
        BT_STATUS_CONN_TERM_LOCAL_HOST,
-       BT_STATUS_CONN_TERM_RMT_HOST
+       BT_STATUS_CONN_TERM_RMT_HOST,
+       BT_STATUS_ALREADY_CONNECT,
 #endif
 } bt_status_t;
 
index dc4fa39..8a1ab7d 100755 (executable)
@@ -82,7 +82,8 @@ typedef enum {
 #else
        OAL_STATUS_LINK_LOSS,
        OAL_STATUS_CONN_TERM_LOCAL_HOST,
-       OAL_STATUS_CONN_TERM_RMT_HOST
+       OAL_STATUS_CONN_TERM_RMT_HOST,
+       OAL_STATUS_ALREADY_CONNECT,
 #endif
 } oal_status_t;
 
index 33867f8..c6e2ad5 100644 (file)
@@ -924,6 +924,18 @@ static void __bt_device_handle_bond_failed_event(event_dev_bond_failed_t* bond_f
                __bt_free_pairing_info(&trigger_pairing_info);
                break;
        }
+       case OAL_STATUS_ALREADY_CONNECT:
+       {
+               int result = BLUETOOTH_ERROR_ALREADY_CONNECT;
+               BT_INFO("OAL_STATUS_ALREADY_CONNECT");
+
+               if (trigger_bond_info) {
+                       __bt_device_handle_pending_requests(result, BT_BOND_DEVICE,
+                               trigger_bond_info->addr, BT_ADDRESS_STRING_SIZE);
+                       __bt_free_bond_info(BT_DEVICE_BOND_INFO);
+               }
+               break;
+       }
        case OAL_STATUS_INTERNAL_ERROR:
        {
                BT_INFO("OAL_STATUS_INTERNAL_ERROR");