btm_execute_wl_dev_operation();
btm_cb.ble_ctr_cb.wl_state |= BTM_BLE_WL_ADV;
}
-
+ /* The complete event comes up immediately after the 'btsnd_hcic_ble_set_adv_enable' being called in dual core,
+ this causes the 'adv_mode' and 'state' not be set yet, so we set the state first */
+ tBTM_BLE_GAP_STATE temp_state = p_cb->state;
+ UINT8 adv_mode = p_cb->adv_mode;
+ p_cb->adv_mode = BTM_BLE_ADV_ENABLE;
+ p_cb->state = BTM_BLE_ADV_PENDING;
+ btm_ble_adv_states_operation(btm_ble_set_topology_mask, p_cb->evt_type);
if (btsnd_hcic_ble_set_adv_enable (BTM_BLE_ADV_ENABLE)) {
- p_cb->adv_mode = BTM_BLE_ADV_ENABLE;
- p_cb->state = BTM_BLE_ADV_PENDING;
- btm_ble_adv_states_operation(btm_ble_set_topology_mask, p_cb->evt_type);
rt = BTM_SUCCESS;
BTM_TRACE_EVENT ("BTM_SUCCESS\n");
} else {
p_cb->adv_mode = BTM_BLE_ADV_DISABLE;
+ p_cb->state = temp_state;
+ p_cb->adv_mode = adv_mode;
+ btm_ble_adv_states_operation(btm_ble_clear_topology_mask, p_cb->evt_type);
btm_cb.ble_ctr_cb.wl_state &= ~BTM_BLE_WL_ADV;
}
return rt;
p_dev_rec->sec_flags |= BTM_SEC_16_DIGIT_PIN_AUTHED;
}
} else {
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if BLE_INCLUDED == TRUE
+ /* Before the application layer has received the connection event, the device has received an
+ encrypted request from the peer device. The device should wait until the application layer
+ receives the connection event before updating 'sec_flags'. */
if ((p_tcb = gatt_find_tcb_by_addr(p_dev_rec->ble.pseudo_addr, BT_TRANSPORT_LE)) == NULL) {
//do nothing
} else
/* While scanning, if the free memory value in controller is less than SCAN_SEND_ADV_RESERVED_SIZE,
the adv packet will be discarded until the memory is restored. */
#define SCAN_SEND_ADV_RESERVED_SIZE 1000
-/* open controller log debug when adv lost */
+/* enable controller log debug when adv lost */
#define CONTROLLER_ADV_LOST_DEBUG_BIT (0<<0)
#ifdef CONFIG_BT_HCI_UART_NO