forked from espressif/esp-idf
Merge branch 'bugfix/fix_blecibr25_119_v5.1' into 'release/v5.1'
fix(ble/bluedroid): Fixed extended adv restart failure during reconnection (v5.1) See merge request espressif/esp-idf!39774
This commit is contained in:
@@ -1688,7 +1688,7 @@ esp_err_t esp_ble_gap_vendor_command_send(esp_ble_vendor_cmd_params_t *vendor_cm
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_set_vendor_event_mask(uint32_t event_mask)
|
||||
esp_err_t esp_ble_gap_set_vendor_event_mask(esp_ble_vendor_evt_mask_t event_mask)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
|
@@ -206,8 +206,11 @@ typedef enum {
|
||||
|
||||
/// white list address type
|
||||
typedef enum {
|
||||
BLE_WL_ADDR_TYPE_PUBLIC = 0x00,
|
||||
BLE_WL_ADDR_TYPE_RANDOM = 0x01,
|
||||
BLE_WL_ADDR_TYPE_PUBLIC = 0x00, /*!< Public Device Address */
|
||||
BLE_WL_ADDR_TYPE_RANDOM = 0x01, /*!< Random Device Address */
|
||||
#if (CONFIG_BT_BLE_50_FEATURES_SUPPORTED)
|
||||
BLE_WL_ADDR_TYPE_ANONYMOUS = 0xFF, /*!< Devices sending anonymous advertisements, use to enable anonymous advertising report for scanning */
|
||||
#endif // (CONFIG_BT_BLE_50_FEATURES_SUPPORTED)
|
||||
} esp_ble_wl_addr_type_t;
|
||||
|
||||
/// Used to exchange the encryption key in the init key & response key
|
||||
|
@@ -1073,11 +1073,58 @@ typedef struct {
|
||||
} esp_ble_gap_past_params_t;
|
||||
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
|
||||
typedef enum{
|
||||
typedef enum {
|
||||
ESP_BLE_NETWORK_PRIVACY_MODE = 0X00, /*!< Network Privacy Mode for peer device (default) */
|
||||
ESP_BLE_DEVICE_PRIVACY_MODE = 0X01, /*!< Device Privacy Mode for peer device */
|
||||
} esp_ble_privacy_mode_t;
|
||||
|
||||
#define ESP_BLE_VENDOR_SCAN_REQ_RECV_EVT_MASK BIT(0) /*!< Vendor BLE legacy SCAN_REQ received event mask */
|
||||
#define ESP_BLE_VENDOR_CHMAP_UPDATE_EVT_MASK BIT(1) /*!< Vendor BLE channel map update event mask */
|
||||
#define ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT_MASK BIT(3) /*!< Vendor BLE sleep wakeup event mask */
|
||||
#define ESP_BLE_VENDOR_CONN_REQ_RECV_EVT_MASK BIT(4) /*!< Vendor BLE CONNECT_IND and AUX_CONNECT_REQ received event mask */
|
||||
#define ESP_BLE_VENDOR_CONN_RSP_RECV_EVT_MASK BIT(5) /*!< Vendor BLE AUX_CONNECT_RSP received event mask */
|
||||
typedef uint32_t esp_ble_vendor_evt_mask_t;
|
||||
|
||||
#define ESP_BLE_VENDOR_PDU_RECV_EVT (0) /*!< Vendor BLE specify PDU received event */
|
||||
#define ESP_BLE_VENDOR_CHAN_MAP_UPDATE_EVT (1) /*!< Vendor BLE channel map update complete event */
|
||||
#define ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT (2) /*!< Vendor BLE sleep wakeup event */
|
||||
typedef uint8_t esp_ble_vendor_evt_t;
|
||||
|
||||
typedef enum {
|
||||
ESP_BLE_VENDOR_PDU_SCAN_REQ = 0, /*!< SCAN_REQ PDU type */
|
||||
ESP_BLE_VENDOR_PDU_CONN_REQ, /*!< CONNECT_IND and AUX_CONNECT_REQ PDU type */
|
||||
ESP_BLE_VENDOR_PDU_CONN_RSP, /*!< AUX_CONNECT_RSP PDU type */
|
||||
} esp_ble_vendor_pdu_t;
|
||||
|
||||
/**
|
||||
* @brief BLE vendor event parameters union
|
||||
*/
|
||||
typedef union {
|
||||
/**
|
||||
* @brief ESP_BLE_VENDOR_PDU_RECV_EVT
|
||||
*/
|
||||
struct ble_pdu_recv_evt_param {
|
||||
esp_ble_vendor_pdu_t type; /*!< The type of LE PDU */
|
||||
uint8_t handle; /*!< The handle of advertising set */
|
||||
esp_ble_addr_type_t addr_type; /*!< The address type of peer device */
|
||||
esp_bd_addr_t peer_addr; /*!< The address of peer device */
|
||||
} pdu_recv; /*!< Event parameter of ESP_BLE_VENDOR_PDU_RECV_EVT */
|
||||
/**
|
||||
* @brief ESP_BLE_VENDOR_CHAN_MAP_UPDATE_EVT
|
||||
*/
|
||||
struct ble_chan_map_update_evt_param {
|
||||
uint8_t status; /*!< Indicate the channel map update status (HCI error code) */
|
||||
uint16_t conn_handle; /*!< The connection handle */
|
||||
esp_gap_ble_channels ch_map; /*!< The channel map after updated */
|
||||
} chan_map_update; /*!< Event parameter of ESP_BLE_VENDOR_CHAN_MAP_UPDATE_EVT */
|
||||
/**
|
||||
* @brief ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT
|
||||
*/
|
||||
struct ble_sleep_wakeup_evt_param {
|
||||
// No parameters
|
||||
} sleep_wakeup; /*!< Event parameter of ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT */
|
||||
} esp_ble_vendor_evt_param_t;
|
||||
|
||||
/**
|
||||
* @brief Gap callback parameters union
|
||||
*/
|
||||
@@ -1591,10 +1638,11 @@ typedef union {
|
||||
* @brief ESP_GAP_BLE_VENDOR_HCI_EVT
|
||||
*/
|
||||
struct ble_vendor_hci_event_evt_param {
|
||||
uint8_t subevt_code; /*!< Subevent code for vendor HCI event, the range is 0xC0 to 0xFF */
|
||||
uint8_t param_len; /*!< The length of the event parameter buffer */
|
||||
uint8_t *param_buf; /*!< The pointer of the event parameter buffer */
|
||||
} vendor_hci_evt; /*!< Event parameter buffer of ESP_GAP_BLE_VENDOR_HCI_EVT */
|
||||
esp_ble_vendor_evt_t subevt_code; /*!< Subevent code for BLE vendor HCI event */
|
||||
esp_ble_vendor_evt_param_t param; /*!< Event parameter of BLE vendor HCI subevent */
|
||||
uint8_t param_len; /*!< The length of the event parameter buffer (for internal use only) */
|
||||
uint8_t *param_buf; /*!< The pointer of the event parameter buffer (for internal use only) */
|
||||
} vendor_hci_evt; /*!< Event parameter of ESP_GAP_BLE_VENDOR_HCI_EVT */
|
||||
} esp_ble_gap_cb_param_t;
|
||||
|
||||
/**
|
||||
@@ -2807,14 +2855,13 @@ esp_err_t esp_ble_gap_set_csa_support(uint8_t csa_select);
|
||||
/**
|
||||
* @brief This function is used to control which vendor events are generated by the HCI for the Host.
|
||||
*
|
||||
* @param[in] event_mask: Bit0: Legacy scan request received event
|
||||
* Bit1: Vendor channel map update complete event
|
||||
* @param[in] event_mask: The BLE vendor HCI event mask
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*/
|
||||
esp_err_t esp_ble_gap_set_vendor_event_mask(uint32_t event_mask);
|
||||
esp_err_t esp_ble_gap_set_vendor_event_mask(esp_ble_vendor_evt_mask_t event_mask);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -146,6 +146,18 @@ uint32_t btc_get_ble_status(void)
|
||||
status |= BIT(BTC_BLE_STATUS_CONN);
|
||||
}
|
||||
|
||||
// Number of active ACL connection
|
||||
extern uint8_t btm_ble_acl_active_count(void);
|
||||
if (btm_ble_acl_active_count()) {
|
||||
status |= BIT(BTC_BLE_STATUS_CONN);
|
||||
}
|
||||
|
||||
// Number of active L2C plcb
|
||||
extern uint8_t l2cu_ble_plcb_active_count(void);
|
||||
if (l2cu_ble_plcb_active_count()) {
|
||||
status |= BIT(BTC_BLE_STATUS_CONN);
|
||||
}
|
||||
|
||||
// Address resolve status
|
||||
extern uint8_t btm_get_ble_addr_resolve_disable_status(void);
|
||||
if (btm_get_ble_addr_resolve_disable_status()) {
|
||||
@@ -182,18 +194,6 @@ uint32_t btc_get_ble_status(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Number of active ACL connection
|
||||
extern uint8_t btm_acl_active_count(void);
|
||||
if (btm_acl_active_count()) {
|
||||
status |= BIT(BTC_BLE_STATUS_CONN);
|
||||
}
|
||||
|
||||
// Number of active L2C plcb
|
||||
extern uint8_t l2cu_plcb_active_count(void);
|
||||
if (l2cu_plcb_active_count()) {
|
||||
status |= BIT(BTC_BLE_STATUS_CONN);
|
||||
}
|
||||
|
||||
#if (GATTC_INCLUDED == TRUE)
|
||||
// Number of registered GATTC APP
|
||||
extern uint8_t bta_gattc_cl_rcb_active_count(void);
|
||||
|
@@ -1385,7 +1385,7 @@ static void btc_ble_set_vendor_evt_mask_callback(UINT8 status)
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = ESP_GAP_BLE_SET_VENDOR_EVT_MASK_COMPLETE_EVT;
|
||||
|
||||
param.set_csa_support_cmpl.status = btc_btm_status_to_esp_status(status);
|
||||
param.set_vendor_evt_mask_cmpl.status = btc_btm_status_to_esp_status(status);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL, NULL);
|
||||
|
||||
@@ -1399,15 +1399,46 @@ static void btc_ble_vendor_hci_event_callback(UINT8 subevt_code, UINT8 param_len
|
||||
esp_ble_gap_cb_param_t param = {0};
|
||||
bt_status_t ret;
|
||||
btc_msg_t msg = {0};
|
||||
esp_ble_vendor_evt_param_t *evt_param = ¶m.vendor_hci_evt.param;
|
||||
bool copy_param = false;
|
||||
|
||||
msg.sig = BTC_SIG_API_CB;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = ESP_GAP_BLE_VENDOR_HCI_EVT;
|
||||
|
||||
param.vendor_hci_evt.subevt_code = subevt_code;
|
||||
param.vendor_hci_evt.param_len = param_len;
|
||||
param.vendor_hci_evt.param_buf = params;
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), btc_gap_ble_cb_deep_copy, btc_gap_ble_cb_deep_free);
|
||||
param.vendor_hci_evt.param_len = 0;
|
||||
param.vendor_hci_evt.param_buf = NULL;
|
||||
switch (subevt_code) {
|
||||
case BLE_VENDOR_PDU_RECV_EVT:
|
||||
param.vendor_hci_evt.subevt_code = ESP_BLE_VENDOR_PDU_RECV_EVT;
|
||||
STREAM_TO_UINT8(evt_param->pdu_recv.type, params);
|
||||
STREAM_TO_UINT8(evt_param->pdu_recv.handle, params);
|
||||
STREAM_TO_UINT8(evt_param->pdu_recv.addr_type, params);
|
||||
STREAM_TO_BDADDR(evt_param->pdu_recv.peer_addr, params);
|
||||
break;
|
||||
case BLE_VENDOR_CHMAP_UPDATE_EVT:
|
||||
param.vendor_hci_evt.subevt_code = ESP_BLE_VENDOR_CHAN_MAP_UPDATE_EVT;
|
||||
STREAM_TO_UINT8(evt_param->chan_map_update.status, params);
|
||||
STREAM_TO_UINT16(evt_param->chan_map_update.conn_handle, params);
|
||||
REVERSE_STREAM_TO_ARRAY(evt_param->chan_map_update.ch_map, params, ESP_GAP_BLE_CHANNELS_LEN);
|
||||
break;
|
||||
case BLE_VENDOR_SLEEP_WAKEUP_EVT:
|
||||
param.vendor_hci_evt.subevt_code = ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT;
|
||||
// No parameters
|
||||
break;
|
||||
default:
|
||||
copy_param = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (copy_param) {
|
||||
param.vendor_hci_evt.param_len = param_len;
|
||||
param.vendor_hci_evt.param_buf = (param_len) ? params : NULL;
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), btc_gap_ble_cb_deep_copy, btc_gap_ble_cb_deep_free);
|
||||
} else {
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL, NULL);
|
||||
}
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
|
@@ -22,6 +22,10 @@ extern tBTA_BLE_ADV_DATA *gl_bta_scan_rsp_data_ptr;
|
||||
|
||||
#define BLE_ISVALID_PARAM(x, min, max) (((x) >= (min) && (x) <= (max)))
|
||||
|
||||
#define BLE_VENDOR_PDU_RECV_EVT (0xC0)
|
||||
#define BLE_VENDOR_CHMAP_UPDATE_EVT (0xC1)
|
||||
#define BLE_VENDOR_SLEEP_WAKEUP_EVT (0xC3)
|
||||
|
||||
typedef enum {
|
||||
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
BTC_GAP_BLE_ACT_CFG_ADV_DATA = 0,
|
||||
|
@@ -608,6 +608,7 @@ tBTM_STATUS BTM_BleStartExtAdvRestart(uint8_t con_handle)
|
||||
}
|
||||
|
||||
if((index >= MAX_BLE_ADV_INSTANCE) || (!adv_record[index].invalid)) {
|
||||
BTM_TRACE_WARNING("%s failed to find extend adv, adv_handle %u con_handle %u", __func__, index, con_handle);
|
||||
return BTM_WRONG_MODE;
|
||||
}
|
||||
|
||||
@@ -1233,7 +1234,7 @@ void btm_ble_adv_set_terminated_evt(tBTM_BLE_ADV_TERMINAT *params)
|
||||
}
|
||||
|
||||
// adv terminated due to connection, save the adv handle and connection handle
|
||||
if(params->completed_event == 0x00) {
|
||||
if(params->status == 0x00) {
|
||||
adv_record[params->adv_handle].ter_con_handle = params->conn_handle;
|
||||
} else {
|
||||
adv_record[params->adv_handle].ter_con_handle = INVALID_VALUE;
|
||||
|
@@ -201,7 +201,12 @@ BOOLEAN btm_add_dev_to_controller (BOOLEAN to_add, BD_ADDR bd_addr, tBLE_ADDR_TY
|
||||
|
||||
/* Controller do not support resolvable address now, only support public address and static random address */
|
||||
BOOLEAN started = FALSE;
|
||||
if(wl_addr_type > BLE_ADDR_RANDOM) {
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
if (wl_addr_type > BLE_ADDR_RANDOM && wl_addr_type != BLE_ADDR_ANONYMOUS)
|
||||
#else
|
||||
if (wl_addr_type > BLE_ADDR_RANDOM)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
{
|
||||
BTM_TRACE_ERROR("wl_addr_type is error\n");
|
||||
return started;
|
||||
}
|
||||
@@ -278,7 +283,12 @@ void btm_enq_wl_dev_operation(BOOLEAN to_add, BD_ADDR bd_addr, tBLE_ADDR_TYPE ad
|
||||
*******************************************************************************/
|
||||
BOOLEAN btm_update_dev_to_white_list(BOOLEAN to_add, BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, tBTM_UPDATE_WHITELIST_CBACK *update_wl_cb)
|
||||
{
|
||||
if(addr_type > BLE_ADDR_RANDOM) {
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
if (addr_type > BLE_ADDR_RANDOM && addr_type != BLE_ADDR_ANONYMOUS)
|
||||
#else
|
||||
if (addr_type > BLE_ADDR_RANDOM)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
{
|
||||
BTM_TRACE_ERROR("%s address type is error, unable to add device", __func__);
|
||||
if (update_wl_cb){
|
||||
update_wl_cb(HCI_ERR_ILLEGAL_PARAMETER_FMT,to_add);
|
||||
|
@@ -4547,7 +4547,7 @@ static void btm_ble_vs_evt_callback(UINT8 len, UINT8 *p)
|
||||
STREAM_TO_UINT8(sub_event, p);
|
||||
len--;
|
||||
|
||||
if (sub_event < HCI_VSE_LE_LEGACY_SCAN_REQ_RECEIVED_EVT) {
|
||||
if (sub_event < HCI_VSE_LE_SUBEVT_BASE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -122,7 +122,8 @@ void btm_free(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t btm_acl_active_count(void)
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
uint8_t btm_ble_acl_active_count(void)
|
||||
{
|
||||
list_node_t *p_node = NULL;
|
||||
tACL_CONN *p_acl_conn = NULL;
|
||||
@@ -130,14 +131,14 @@ uint8_t btm_acl_active_count(void)
|
||||
|
||||
for (p_node = list_begin(btm_cb.p_acl_db_list); p_node; p_node = list_next(p_node)) {
|
||||
p_acl_conn = list_node(p_node);
|
||||
if (p_acl_conn && p_acl_conn->in_use) {
|
||||
if (p_acl_conn && p_acl_conn->in_use && p_acl_conn->transport == BT_TRANSPORT_LE) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
|
||||
// Address resolution status
|
||||
uint8_t btm_get_ble_addr_resolve_disable_status(void)
|
||||
{
|
||||
|
@@ -1239,7 +1239,8 @@ uint8_t gatt_tcb_active_count(void)
|
||||
|
||||
for(p_node = list_begin(gatt_cb.p_tcb_list); p_node; p_node = list_next(p_node)) {
|
||||
p_tcb = list_node(p_node);
|
||||
if (p_tcb && p_tcb->in_use && (p_tcb->ch_state != GATT_CH_CLOSE)) {
|
||||
if (p_tcb && p_tcb->in_use && (p_tcb->transport == BT_TRANSPORT_LE) &&
|
||||
(p_tcb->ch_state != GATT_CH_CLOSE)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@@ -484,6 +484,7 @@ typedef struct {
|
||||
#define BLE_ADDR_RANDOM_ID 0x03
|
||||
#define BLE_ADDR_TYPE_MAX BLE_ADDR_RANDOM_ID
|
||||
#define BLE_ADDR_UNKNOWN_TYPE 0XFF
|
||||
#define BLE_ADDR_ANONYMOUS 0xFF
|
||||
typedef UINT8 tBLE_ADDR_TYPE;
|
||||
#define BLE_ADDR_TYPE_MASK (BLE_ADDR_RANDOM | BLE_ADDR_PUBLIC)
|
||||
|
||||
|
@@ -848,9 +848,9 @@
|
||||
#define HCI_VENDOR_CH_CLASSIFICATION_EVT_SUBCODE 0x06
|
||||
#define HCI_VENDOR_CH_CLASSIFICATION_REPORTING_MODE_EVT_SUBCODE 0x07
|
||||
|
||||
#define HCI_VSE_LE_LEGACY_SCAN_REQ_RECEIVED_EVT 0xC0
|
||||
#define HCI_VSE_LE_CHAN_MAP_UPDATE_CMPL_EVT 0xC1
|
||||
#define HCI_VSE_LE_EVT_MAX 0xFF
|
||||
#define HCI_VENDOR_SPECIFIC_EVT 0xFF /* Vendor specific events */
|
||||
#define HCI_VSE_LE_SUBEVT_BASE 0xC0 /* BLE vendor event code base */
|
||||
#define HCI_VSE_LE_EVT_MAX 0xFF /* BLE vendor event code max */
|
||||
#define HCI_NAP_TRACE_EVT 0xFF /* was define 0xFE, 0xFD, change to 0xFF
|
||||
because conflict w/ TCI_EVT and per
|
||||
specification compliant */
|
||||
|
@@ -65,7 +65,7 @@
|
||||
#define L2CAP_WAIT_UNPARK_TOUT 2 /* 2 seconds */
|
||||
#define L2CAP_LINK_INFO_RESP_TOUT 2 /* 2 seconds */
|
||||
#define L2CAP_UPDATE_CONN_PARAM_TOUT 6 /* 6 seconds */
|
||||
#define L2CAP_BLE_LINK_CONNECT_TOUT BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT // configed in menuconfig
|
||||
#define L2CAP_BLE_LINK_CONNECT_TOUT BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT // configured in menuconfig
|
||||
#define L2CAP_BLE_CONN_PARAM_UPD_TOUT 30 /* 30 seconds */
|
||||
|
||||
/* quick timer uses millisecond unit */
|
||||
@@ -80,10 +80,10 @@
|
||||
** the Bluetooth specification.
|
||||
*/
|
||||
typedef enum {
|
||||
CST_CLOSED, /* Channel is in clodes state */
|
||||
CST_CLOSED, /* Channel is in closed state */
|
||||
CST_ORIG_W4_SEC_COMP, /* Originator waits security clearence */
|
||||
CST_TERM_W4_SEC_COMP, /* Acceptor waits security clearence */
|
||||
CST_W4_L2CAP_CONNECT_RSP, /* Waiting for peer conenct response */
|
||||
CST_W4_L2CAP_CONNECT_RSP, /* Waiting for peer connect response */
|
||||
CST_W4_L2CA_CONNECT_RSP, /* Waiting for upper layer connect rsp */
|
||||
CST_CONFIG, /* Negotiating configuration */
|
||||
CST_OPEN, /* Data transfer state */
|
||||
@@ -208,8 +208,8 @@ typedef struct {
|
||||
UINT32 controller_idle; /* # of times less than 2 packets in controller */
|
||||
/* when the xmit window was closed */
|
||||
UINT32 pkts_retransmitted; /* # of packets that were retransmitted */
|
||||
UINT32 retrans_touts; /* # of retransmission timouts */
|
||||
UINT32 xmit_ack_touts; /* # of xmit ack timouts */
|
||||
UINT32 retrans_touts; /* # of retransmission timeouts */
|
||||
UINT32 xmit_ack_touts; /* # of xmit ack timeouts */
|
||||
|
||||
#define L2CAP_ERTM_STATS_NUM_AVG 10
|
||||
#define L2CAP_ERTM_STATS_AVG_NUM_SAMPLES 100
|
||||
@@ -386,7 +386,7 @@ typedef struct t_l2c_linkcb {
|
||||
|
||||
tL2C_CCB *p_pending_ccb; /* ccb of waiting channel during link disconnect */
|
||||
TIMER_LIST_ENT info_timer_entry; /* Timer entry for info resp timeout evt */
|
||||
TIMER_LIST_ENT upda_con_timer; /* Timer entry for update connection parametr */
|
||||
TIMER_LIST_ENT upda_con_timer; /* Timer entry for update connection parameter */
|
||||
BD_ADDR remote_bd_addr; /* The BD address of the remote */
|
||||
|
||||
UINT8 link_role; /* Master or slave */
|
||||
@@ -599,7 +599,7 @@ extern BOOLEAN l2cu_start_post_bond_timer (UINT16 handle);
|
||||
extern void l2cu_release_lcb (tL2C_LCB *p_lcb);
|
||||
extern tL2C_LCB *l2cu_find_lcb_by_bd_addr (BD_ADDR p_bd_addr, tBT_TRANSPORT transport);
|
||||
extern tL2C_LCB *l2cu_find_lcb_by_handle (UINT16 handle);
|
||||
extern uint8_t l2cu_plcb_active_count(void);
|
||||
extern uint8_t l2cu_ble_plcb_active_count(void);
|
||||
extern void l2cu_update_lcb_4_bonding (BD_ADDR p_bd_addr, BOOLEAN is_bonding);
|
||||
|
||||
extern UINT8 l2cu_get_conn_role (tL2C_LCB *p_this_lcb);
|
||||
|
@@ -242,7 +242,7 @@ BOOLEAN L2CA_EnableUpdateBleConnParams (BD_ADDR rem_bda, BOOLEAN enable)
|
||||
return (FALSE);
|
||||
}
|
||||
bool is_disable = (p_lcb->conn_update_mask & L2C_BLE_CONN_UPDATE_DISABLE);
|
||||
if(l2cu_plcb_active_count() >1 && !(enable && is_disable)) {
|
||||
if(l2cu_ble_plcb_active_count() >1 && !(enable && is_disable)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@@ -478,6 +478,8 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
|
||||
if (l2cu_create_conn(p_lcb, BT_TRANSPORT_LE)) {
|
||||
btm_acl_removed (p_lcb->remote_bd_addr, BT_TRANSPORT_LE);
|
||||
lcb_is_free = FALSE; /* still using this lcb */
|
||||
} else {
|
||||
L2CAP_TRACE_ERROR("master retry connect failed");
|
||||
}
|
||||
}
|
||||
#endif // (GATTC_CONNECT_RETRY_EN == TRUE)
|
||||
@@ -486,7 +488,10 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
|
||||
if(btm_ble_inter_get() && p_lcb->link_role == HCI_ROLE_SLAVE) {
|
||||
p_lcb->retry_create_con ++;
|
||||
L2CAP_TRACE_DEBUG("slave restart extend adv, retry count %d reason 0x%x\n", p_lcb->retry_create_con, reason);
|
||||
BTM_BleStartExtAdvRestart(handle);
|
||||
tBTM_STATUS start_adv_status = BTM_BleStartExtAdvRestart(handle);
|
||||
if (start_adv_status != BTM_SUCCESS) {
|
||||
L2CAP_TRACE_ERROR("slave restart extend adv failed (err 0x%x)", start_adv_status);
|
||||
}
|
||||
}
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
@@ -494,7 +499,10 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
|
||||
if(!btm_ble_inter_get() && p_lcb->link_role == HCI_ROLE_SLAVE) {
|
||||
p_lcb->retry_create_con ++;
|
||||
L2CAP_TRACE_DEBUG("slave resatrt adv, retry count %d reason 0x%x\n", p_lcb->retry_create_con, reason);
|
||||
btm_ble_start_adv();
|
||||
tBTM_STATUS start_adv_status = btm_ble_start_adv();
|
||||
if (start_adv_status != BTM_SUCCESS) {
|
||||
L2CAP_TRACE_ERROR("slave resatrt adv failed (err 0x%x)", start_adv_status);
|
||||
}
|
||||
}
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
}
|
||||
|
@@ -336,14 +336,14 @@ tL2C_LCB *l2cu_find_free_lcb (void)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
uint8_t l2cu_plcb_active_count(void)
|
||||
uint8_t l2cu_ble_plcb_active_count(void)
|
||||
{
|
||||
list_node_t *p_node = NULL;
|
||||
tL2C_LCB *p_lcb = NULL;
|
||||
uint8_t active_count = 0;
|
||||
for (p_node = list_begin(l2cb.p_lcb_pool); p_node; p_node = list_next(p_node)) {
|
||||
p_lcb = list_node(p_node);
|
||||
if (p_lcb && p_lcb->in_use) {
|
||||
if (p_lcb && p_lcb->in_use && p_lcb->transport == BT_TRANSPORT_LE) {
|
||||
active_count ++;
|
||||
}
|
||||
}
|
||||
@@ -615,7 +615,7 @@ void l2cu_send_peer_connect_rsp (tL2C_CCB *p_ccb, UINT16 result, UINT16 status)
|
||||
**
|
||||
** Description Build and send an L2CAP "connection response neg" message
|
||||
** to the peer. This function is called when there is no peer
|
||||
** CCB (non-existant PSM or no resources).
|
||||
** CCB (non-existent PSM or no resources).
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
@@ -1737,7 +1737,7 @@ void l2cu_release_ccb (tL2C_CCB *p_ccb)
|
||||
) {
|
||||
l2cu_dequeue_ccb (p_ccb);
|
||||
|
||||
/* Delink the CCB from the LCB */
|
||||
/* Unlink the CCB from the LCB */
|
||||
p_ccb->p_lcb = NULL;
|
||||
}
|
||||
|
||||
@@ -1960,7 +1960,7 @@ tL2C_RCB *l2cu_find_ble_rcb_by_psm (UINT16 psm)
|
||||
**
|
||||
** Returns UINT8 - L2CAP_PEER_CFG_OK if passed to upper layer,
|
||||
** L2CAP_PEER_CFG_UNACCEPTABLE if automatically responded to
|
||||
** because parameters are unnacceptable from a specification
|
||||
** because parameters are unacceptable from a specification
|
||||
** point of view.
|
||||
** L2CAP_PEER_CFG_DISCONNECT if no compatible channel modes
|
||||
** between the two devices, and shall be closed.
|
||||
@@ -2558,7 +2558,7 @@ BOOLEAN l2cu_set_acl_priority (BD_ADDR bd_addr, UINT8 priority, BOOLEAN reset_af
|
||||
**
|
||||
** Function l2cu_set_non_flushable_pbf
|
||||
**
|
||||
** Description set L2CAP_PKT_START_NON_FLUSHABLE if controller supoorts
|
||||
** Description set L2CAP_PKT_START_NON_FLUSHABLE if controller supports
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
@@ -3328,7 +3328,7 @@ static tL2C_CCB *l2cu_get_next_channel_in_rr(tL2C_LCB *p_lcb)
|
||||
for ( i = 0; (i < L2CAP_NUM_CHNL_PRIORITY) && (!p_serve_ccb); i++ ) {
|
||||
/* scan all channel within serving priority group until finding a channel to serve */
|
||||
for ( j = 0; (j < p_lcb->rr_serv[p_lcb->rr_pri].num_ccb) && (!p_serve_ccb); j++) {
|
||||
/* scaning from next serving channel */
|
||||
/* scanning from next serving channel */
|
||||
p_ccb = p_lcb->rr_serv[p_lcb->rr_pri].p_serve_ccb;
|
||||
|
||||
if (!p_ccb) {
|
||||
|
Reference in New Issue
Block a user