int result = BLUETOOTH_ERROR_NONE;
char address[BT_ADDRESS_STRING_SIZE] = { 0 };
bluetooth_device_info_t dev_info;
+ const char *stack_name = NULL;
BT_DBG("+");
retv_if(device_address == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
/* Ready to initiate bonding */
- /* In Tizen, we will first remove bond and then attempt to create bond to keep
- consistency with bluedroid. Even if remove bond fails due to device not already
- bonded, then straight away create bond is triggered. This is because, remove bond
- is handled differently in bluedroid and bluez. In Bluez, if device is
- already removed, remove bond call fails.
- However in bluedroid, remove bond on already removed device returns success. So we will
- handle the cases transparently*/
- if (conn_type == BLUETOOTH_DEV_CONN_BREDR) {
- bt_device_bond_state = BT_DEVICE_BOND_STATE_REMOVE_BONDING;
- } else if (conn_type == BLUETOOTH_DEV_CONN_LE) {
- /* No need to remove if LE conn */
+ stack_name = oal_get_stack_name();
+ if (stack_name && !g_strcmp0(stack_name, "bluez")) {
+ BT_DBG("[bluez] Create bond by type %d", conn_type);
bt_device_bond_state = BT_DEVICE_BOND_STATE_REMOVED_BONDING;
+ } else {
+ /* In Tizen, we will first remove bond and then attempt to create bond to keep
+ consistency with bluedroid. Even if remove bond fails due to device not already
+ bonded, then straight away create bond is triggered. This is because, remove bond
+ is handled differently in bluedroid and bluez. In Bluez, if device is
+ already removed, remove bond call fails.
+ However in bluedroid, remove bond on already removed device returns success. So we will
+ handle the cases transparently */
+ bt_device_bond_state = BT_DEVICE_BOND_STATE_REMOVE_BONDING;
}
+
bond_retry_count = 0;
result = __bt_device_handle_bond_state();