int ret = OAL_STATUS_SUCCESS;
if (bond_retry_count < MAX_BOND_RETRY_COUNT) {
ret = device_create_bond((bt_address_t *)trigger_bond_info->dev_addr, BLUETOOTH_DEV_CONN_DEFAULT);
- bond_retry_count++;
+ if (ret != OAL_STATUS_SUCCESS) {
+ BT_ERR("Create Bond procedure could not suceed");
+ __bt_device_handle_pending_requests(BLUETOOTH_ERROR_INTERNAL, BT_BOND_DEVICE,
+ trigger_bond_info->addr, BT_ADDRESS_STRING_SIZE);
+ __bt_free_bond_info(BT_DEVICE_BOND_INFO);
+ __bt_free_pairing_info(&trigger_pairing_info);
+ bond_retry_count = 0;
+ } else
+ bond_retry_count++;
} else {
BT_ERR("Create Bond failed MAX_BOND_RETRY_COUNT TIMES!!");
- }
- if (ret != OAL_STATUS_SUCCESS || bond_retry_count >= MAX_BOND_RETRY_COUNT) {
- BT_ERR("Create Bond procedure could not suceed");
__bt_device_handle_pending_requests(BLUETOOTH_ERROR_INTERNAL, BT_BOND_DEVICE,
trigger_bond_info->addr, BT_ADDRESS_STRING_SIZE);
__bt_free_bond_info(BT_DEVICE_BOND_INFO);
__bt_free_pairing_info(&trigger_pairing_info);
} else if (trigger_bond_info) {
if (__bt_device_handle_bond_state()!= BLUETOOTH_ERROR_NONE) {
- __bt_device_handle_pending_requests(BLUETOOTH_ERROR_INTERNAL, BT_BOND_DEVICE,
- trigger_bond_info->addr, BT_ADDRESS_STRING_SIZE);
- __bt_free_bond_info(BT_DEVICE_BOND_INFO);
- __bt_free_pairing_info(&trigger_pairing_info);
+ if (trigger_bond_info) {
+ __bt_device_handle_pending_requests(BLUETOOTH_ERROR_INTERNAL, BT_BOND_DEVICE,
+ trigger_bond_info->addr, BT_ADDRESS_STRING_SIZE);
+ __bt_free_bond_info(BT_DEVICE_BOND_INFO);
+ __bt_free_pairing_info(&trigger_pairing_info);
+ }
}
}
break;
static void __bt_free_pairing_info(bt_pairing_data_t **p_info)
{
+ BT_DBG("+");
bt_pairing_data_t * info = *p_info;
if (info) {
if(info->addr) {
g_free(info);
}
*p_info = NULL;
+ BT_DBG("-");
}
static void __bt_free_bond_info(uint8_t type)
trigger_unbond_info = NULL;
}
}
+ BT_INFO("-");
}
static void __bt_free_service_search_info(bt_service_search_info_data_t **p_info)