component / bt: add set pkt data length event callback

This commit is contained in:
zhiweijian
2017-06-14 21:19:48 +08:00
parent aefde1517d
commit 58b65291d9
12 changed files with 139 additions and 12 deletions

View File

@@ -136,6 +136,31 @@ UINT8 btm_handle_to_acl_index (UINT16 hci_handle)
return (xx);
}
/*******************************************************************************
**
** Function btm_handle_to_acl
**
** Description This function returns the FIRST acl_db entry for the passed hci_handle.
**
** Returns Returns pointer to the ACL DB for the requested BDA if found.
** NULL if not found.
**
*******************************************************************************/
tACL_CONN *btm_handle_to_acl (UINT16 hci_handle)
{
tACL_CONN *p = &btm_cb.acl_db[0];
UINT8 xx;
BTM_TRACE_DEBUG ("btm_handle_to_acl_index\n");
for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p++) {
if ((p->in_use) && (p->hci_handle == hci_handle)) {
return(p);
}
}
/* If here, no BD Addr found */
return ((tACL_CONN *)NULL);
}
#if BLE_PRIVACY_SPT == TRUE
/*******************************************************************************
**

View File

@@ -802,12 +802,12 @@ tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length)
if (!controller_get_interface()->supports_ble_packet_extension()) {
BTM_TRACE_ERROR("%s failed, request not supported", __FUNCTION__);
return BTM_ILLEGAL_VALUE;
return BTM_CONTROL_LE_DATA_LEN_UNSUPPORTED;
}
if (!HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl->peer_le_features)) {
BTM_TRACE_ERROR("%s failed, peer does not support request", __FUNCTION__);
return BTM_ILLEGAL_VALUE;
return BTM_PEER_LE_DATA_LEN_UNSUPPORTED;
}
if (p_acl != NULL) {

View File

@@ -67,7 +67,9 @@ enum {
BTM_SUCCESS_NO_SECURITY, /* 17 security passed, no security set */
BTM_FAILED_ON_SECURITY, /* 18 security failed */
BTM_REPEATED_ATTEMPTS, /* 19 repeated attempts for LE security requests */
BTM_MODE4_LEVEL4_NOT_SUPPORTED /* 20 Secure Connections Only Mode can't be supported */
BTM_MODE4_LEVEL4_NOT_SUPPORTED, /* 20 Secure Connections Only Mode can't be supported */
BTM_PEER_LE_DATA_LEN_UNSUPPORTED, /* 21 peer setting data length is unsupported*/
BTM_CONTROL_LE_DATA_LEN_UNSUPPORTED /* 22 controller setting data length is unsupported*/
};
typedef uint8_t tBTM_STATUS;
@@ -129,6 +131,11 @@ enum {
typedef UINT8 tBTM_DEV_STATUS;
typedef struct {
UINT16 rx_len;
UINT16 tx_len;
}tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS;
typedef struct {
UINT16 min_conn_int;
UINT16 max_conn_int;
@@ -166,6 +173,8 @@ typedef UINT8 (tBTM_FILTER_CB) (BD_ADDR bd_addr, DEV_CLASS dc);
typedef void (tBTM_UPDATE_CONN_PARAM_CBACK) (UINT8 status, BD_ADDR bd_addr, tBTM_LE_UPDATE_CONN_PRAMS *update_conn_params);
typedef void (tBTM_SET_PKT_DATA_LENGTH_CBACK) (UINT8 status, tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS *data_length_params);
/*****************************************************************************
** DEVICE DISCOVERY - Inquiry, Remote Name, Discovery, Class of Device

View File

@@ -116,6 +116,8 @@ BD_ADDR active_remote_addr; /* remote address used on this connectio
UINT8 active_remote_addr_type; /* local device address type for this connection */
BD_FEATURES peer_le_features; /* Peer LE Used features mask for the device */
tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb;
tBTM_SET_PKT_DATA_LENGTH_CBACK *p_set_pkt_data_cback;
tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS data_length_params;
#endif
} tACL_CONN;
@@ -932,6 +934,7 @@ void btm_cont_rswitch (tACL_CONN *p,
UINT8 hci_status);
UINT8 btm_handle_to_acl_index (UINT16 hci_handle);
tACL_CONN *btm_handle_to_acl (UINT16 hci_handle);
void btm_read_link_policy_complete (UINT8 *p);
void btm_read_rssi_complete (UINT8 *p);
void btm_read_tx_power_complete (UINT8 *p, BOOLEAN is_ble);

View File

@@ -1024,7 +1024,14 @@ void l2cble_process_data_length_change_event(UINT16 handle, UINT16 tx_data_len,
p_lcb->tx_data_len = tx_data_len;
}
/* ignore rx_data len for now */
tACL_CONN *p_acl = btm_handle_to_acl(handle);
if (p_acl != NULL && p_acl->p_set_pkt_data_cback){
tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS data_length_params;
data_length_params.rx_len = tx_data_len;
data_length_params.tx_len = rx_data_len;
p_acl->data_length_params = data_length_params;
(*p_acl->p_set_pkt_data_cback)(BTM_SUCCESS, &data_length_params);
}
}
/*******************************************************************************