mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'test/ctrl_acl_u_pkt_type_v5.1' into 'release/v5.1'
feat(bt/bluedroid): Added an API to specify data types for ACL-U traffic See merge request espressif/esp-idf!27598
This commit is contained in:
commit
48091104b6
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -424,4 +424,23 @@ esp_err_t esp_bt_gap_set_qos(esp_bd_addr_t remote_bda, uint32_t t_poll)
|
||||
arg.set_qos.t_poll = t_poll;
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_gap_set_acl_pkt_types(esp_bd_addr_t remote_bda, uint16_t pkt_types)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
btc_gap_bt_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BT;
|
||||
msg.act = BTC_GAP_BT_ACT_SET_ACL_PKT_TYPES;
|
||||
|
||||
memcpy(&arg.set_acl_pkt_types.bda, remote_bda, sizeof(bt_bdaddr_t));
|
||||
arg.set_acl_pkt_types.pkt_types = pkt_types;
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
#endif /* #if BTC_GAP_BT_INCLUDED == TRUE */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -91,7 +91,35 @@ typedef struct {
|
||||
|
||||
typedef uint8_t esp_bt_eir_type_t;
|
||||
|
||||
/* ACL Packet Types */
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DM1 0x0008
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DH1 0x0010
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DM3 0x0400
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DH3 0x0800
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DM5 0x4000
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DH5 0x8000
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH1 0x0002
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH1 0x0004
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH3 0x0100
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH3 0x0200
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH5 0x1000
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH5 0x2000
|
||||
|
||||
// DM1 cann not be disabled. All options are mandatory to include DM1.
|
||||
#define ESP_BT_ACL_DM1_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DM1 | 0x330e) /* 0x330e */
|
||||
#define ESP_BT_ACL_DH1_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DH1 | 0x330e) /* 0x331e */
|
||||
#define ESP_BT_ACL_DM3_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DM3 | 0x330e) /* 0x370e */
|
||||
#define ESP_BT_ACL_DH3_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DH3 | 0x330e) /* 0x3b0e */
|
||||
#define ESP_BT_ACL_DM5_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DM5 | 0x330e) /* 0x730e */
|
||||
#define ESP_BT_ACL_DH5_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DH5 | 0x330e) /* 0xb30e */
|
||||
#define ESP_BT_ACL_2_DH1_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH1 & 0x330e) /* 0x330c */
|
||||
#define ESP_BT_ACL_3_DH1_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH1 & 0x330e) /* 0x330a */
|
||||
#define ESP_BT_ACL_2_DH3_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH3 & 0x330e) /* 0x320e */
|
||||
#define ESP_BT_ACL_3_DH3_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH3 & 0x330e) /* 0x310e */
|
||||
#define ESP_BT_ACL_2_DH5_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH5 & 0x330e) /* 0x230e */
|
||||
#define ESP_BT_ACL_3_DH5_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH5 & 0x330e) /* 0x130e */
|
||||
|
||||
typedef uint16_t esp_bt_acl_pkt_type_t;
|
||||
|
||||
/* ESP_BT_EIR_FLAG bit definition */
|
||||
#define ESP_BT_EIR_FLAG_LIMIT_DISC (0x01 << 0)
|
||||
@ -218,6 +246,7 @@ typedef enum {
|
||||
ESP_BT_GAP_QOS_CMPL_EVT, /*!< QOS complete event */
|
||||
ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT, /*!< ACL connection complete status event */
|
||||
ESP_BT_GAP_ACL_DISCONN_CMPL_STAT_EVT, /*!< ACL disconnection complete status event */
|
||||
ESP_BT_GAP_ACL_PKT_TYPE_CHANGED_EVT, /*!< Set ACL packet types event */
|
||||
ESP_BT_GAP_EVT_MAX,
|
||||
} esp_bt_gap_cb_event_t;
|
||||
|
||||
@ -377,6 +406,15 @@ typedef union {
|
||||
logical transport. unit is 0.625ms. */
|
||||
} qos_cmpl; /*!< QoS complete parameter struct */
|
||||
|
||||
/**
|
||||
* @brief ESP_BT_GAP_ACL_PKT_TYPE_CHANGED_EVT
|
||||
*/
|
||||
struct set_acl_pkt_types_param {
|
||||
esp_bt_status_t status; /*!< set ACL packet types status */
|
||||
esp_bd_addr_t bda; /*!< remote bluetooth device address */
|
||||
uint16_t pkt_types; /*!< packet types successfully set */
|
||||
} set_acl_pkt_types; /*!< set ACL packet types parameter struct */
|
||||
|
||||
/**
|
||||
* @brief ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT
|
||||
*/
|
||||
@ -791,6 +829,17 @@ esp_err_t esp_bt_gap_read_remote_name(esp_bd_addr_t remote_bda);
|
||||
*/
|
||||
esp_err_t esp_bt_gap_set_qos(esp_bd_addr_t remote_bda, uint32_t t_poll);
|
||||
|
||||
/**
|
||||
* @brief Set ACL packet types. FOR INTERNAL TESTING ONLY.
|
||||
* An ESP_BT_GAP_SET_ACL_PPKT_TYPES_EVT event will reported to
|
||||
* the APP layer.
|
||||
*
|
||||
* @return - ESP_OK: success
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - other: failed
|
||||
*/
|
||||
esp_err_t esp_bt_gap_set_acl_pkt_types(esp_bd_addr_t remote_bda, esp_bt_acl_pkt_type_t pkt_types);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -833,6 +833,28 @@ void bta_dm_config_eir (tBTA_DM_MSG *p_data)
|
||||
|
||||
bta_dm_set_eir(NULL);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_set_acl_pkt_types
|
||||
**
|
||||
** Description Sets ACL packet types
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_dm_set_acl_pkt_types (tBTA_DM_MSG *p_data)
|
||||
{
|
||||
if (p_data->set_acl_pkt_types.set_acl_pkt_types_cb != NULL) {
|
||||
BTM_SetAclPktTypes(p_data->set_acl_pkt_types.rmt_addr,
|
||||
p_data->set_acl_pkt_types.pkt_types,
|
||||
p_data->set_acl_pkt_types.set_acl_pkt_types_cb);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s(), the callback function can't be NULL.", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -271,6 +271,30 @@ void BTA_DmSetAfhChannels(const uint8_t *channels, tBTA_CMPL_CB *set_afh_cb)
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmSetAclPktTypes
|
||||
**
|
||||
** Description This function sets the packet types used for ACL traffic.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_DmSetAclPktTypes(BD_ADDR remote_addr, UINT16 pkt_types, tBTM_CMPL_CB *p_cb)
|
||||
{
|
||||
tBTA_DM_API_SET_ACL_PKT_TYPES *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_SET_ACL_PKT_TYPES *) osi_malloc(sizeof(tBTA_DM_API_SET_ACL_PKT_TYPES))) != NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_SET_ACL_PKT_TYPES_EVT;
|
||||
bdcpy(p_msg->rmt_addr, remote_addr);
|
||||
p_msg->pkt_types = pkt_types;
|
||||
p_msg->set_acl_pkt_types_cb = p_cb;
|
||||
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
#endif /// CLASSIC_BT_INCLUDED == TRUE
|
||||
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
|
@ -61,6 +61,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
||||
bta_dm_get_dev_name, /* BTA_DM_API_GET_NAME_EVT */
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
bta_dm_config_eir, /* BTA_DM_API_CONFIG_EIR_EVT */
|
||||
bta_dm_set_acl_pkt_types, /* BTA_DM_API_SET_ACL_PKT_TYPES_EVT */
|
||||
#endif
|
||||
bta_dm_set_afh_channels, /* BTA_DM_API_SET_AFH_CHANNELS_EVT */
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
|
@ -56,6 +56,7 @@ enum {
|
||||
BTA_DM_API_GET_NAME_EVT,
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
BTA_DM_API_CONFIG_EIR_EVT,
|
||||
BTA_DM_API_SET_ACL_PKT_TYPES_EVT,
|
||||
#endif
|
||||
BTA_DM_API_SET_AFH_CHANNELS_EVT,
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
@ -267,6 +268,14 @@ typedef struct {
|
||||
tBTA_CMPL_CB *set_afh_cb;
|
||||
}tBTA_DM_API_SET_AFH_CHANNELS;
|
||||
|
||||
/* data type for BTA_DM_API_SET_ACL_PKT_TYPES_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR rmt_addr;
|
||||
UINT16 pkt_types;
|
||||
tBTM_CMPL_CB *set_acl_pkt_types_cb;
|
||||
} tBTA_DM_API_SET_ACL_PKT_TYPES;
|
||||
|
||||
/* data type for BTA_DM_API_GET_REMOTE_NAME_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
@ -1086,6 +1095,7 @@ typedef union {
|
||||
tBTA_DM_API_CONFIG_EIR config_eir;
|
||||
|
||||
tBTA_DM_API_SET_AFH_CHANNELS set_afh_channels;
|
||||
tBTA_DM_API_SET_ACL_PKT_TYPES set_acl_pkt_types;
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
tBTA_DM_API_GET_REMOTE_NAME get_rmt_name;
|
||||
#endif
|
||||
@ -1587,6 +1597,7 @@ extern void bta_dm_set_dev_name (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_get_dev_name (tBTA_DM_MSG *p_data);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
extern void bta_dm_config_eir (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_set_acl_pkt_types (tBTA_DM_MSG *p_data);
|
||||
#endif
|
||||
extern void bta_dm_set_afh_channels (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_read_rmt_name(tBTA_DM_MSG *p_data);
|
||||
|
@ -438,6 +438,8 @@ typedef tBTM_RSSI_RESULTS tBTA_RSSI_RESULTS;
|
||||
typedef tBTM_SET_AFH_CHANNELS_RESULTS tBTA_SET_AFH_CHANNELS_RESULTS;
|
||||
typedef tBTM_BLE_SET_CHANNELS_RESULTS tBTA_BLE_SET_CHANNELS_RESULTS;
|
||||
|
||||
typedef tBTM_SET_ACL_PKT_TYPES_RESULTS tBTA_SET_ACL_PKT_TYPES_RESULTS;
|
||||
|
||||
typedef tBTM_REMOTE_DEV_NAME tBTA_REMOTE_DEV_NAME;
|
||||
|
||||
/* advertising channel map */
|
||||
@ -1766,6 +1768,18 @@ void BTA_DmSetAfhChannels(const uint8_t *channels, tBTA_CMPL_CB *set_afh_cb);
|
||||
void BTA_DmSetQos(BD_ADDR bd_addr, UINT32 t_poll, tBTM_CMPL_CB *p_cb);
|
||||
#endif /// (BTA_DM_QOS_INCLUDED == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmSetAclPktTypes
|
||||
**
|
||||
** Description This function sets the packet types used for ACL traffic.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_DmSetAclPktTypes(BD_ADDR remote_addr, UINT16 pkt_types, tBTM_CMPL_CB *p_cb);
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -726,6 +726,33 @@ static void btc_gap_bt_set_afh_channels(btc_gap_bt_args_t *arg)
|
||||
BTA_DmSetAfhChannels(arg->set_afh_channels.channels, btc_gap_bt_set_afh_channels_cmpl_callback);
|
||||
}
|
||||
|
||||
static void btc_gap_bt_set_acl_pkt_types_cmpl_callback(void *p_data)
|
||||
{
|
||||
tBTA_SET_ACL_PKT_TYPES_RESULTS *result = (tBTA_SET_ACL_PKT_TYPES_RESULTS *)p_data;
|
||||
esp_bt_gap_cb_param_t param;
|
||||
bt_status_t ret;
|
||||
btc_msg_t msg;
|
||||
msg.sig = BTC_SIG_API_CB;
|
||||
msg.pid = BTC_PID_GAP_BT;
|
||||
msg.act = BTC_GAP_BT_SET_ACL_PKT_TYPES_EVT;
|
||||
|
||||
param.set_acl_pkt_types.status = btc_btm_status_to_esp_status(result->status);
|
||||
memcpy(param.set_acl_pkt_types.bda, result->rem_bda, sizeof(esp_bd_addr_t));
|
||||
param.set_acl_pkt_types.pkt_types = result->pkt_types;
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_bt_gap_cb_param_t), NULL, NULL);
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
static void btc_gap_set_acl_pkt_types(btc_gap_bt_args_t *arg)
|
||||
{
|
||||
BTA_DmSetAclPktTypes(arg->set_acl_pkt_types.bda.address,
|
||||
arg->set_acl_pkt_types.pkt_types,
|
||||
btc_gap_bt_set_acl_pkt_types_cmpl_callback);
|
||||
}
|
||||
|
||||
static void btc_gap_bt_read_remote_name_cmpl_callback(void *p_data)
|
||||
{
|
||||
tBTA_REMOTE_DEV_NAME *result = (tBTA_REMOTE_DEV_NAME *)p_data;
|
||||
@ -798,6 +825,7 @@ void btc_gap_bt_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||
case BTC_GAP_BT_ACT_SET_AFH_CHANNELS:
|
||||
case BTC_GAP_BT_ACT_READ_REMOTE_NAME:
|
||||
case BTC_GAP_BT_ACT_SET_QOS:
|
||||
case BTC_GAP_BT_ACT_SET_ACL_PKT_TYPES:
|
||||
break;
|
||||
#if (BT_SSP_INCLUDED == TRUE)
|
||||
case BTC_GAP_BT_ACT_PASSKEY_REPLY:
|
||||
@ -864,6 +892,7 @@ void btc_gap_bt_arg_deep_free(btc_msg_t *msg)
|
||||
case BTC_GAP_BT_ACT_SET_AFH_CHANNELS:
|
||||
case BTC_GAP_BT_ACT_READ_REMOTE_NAME:
|
||||
case BTC_GAP_BT_ACT_SET_QOS:
|
||||
case BTC_GAP_BT_ACT_SET_ACL_PKT_TYPES:
|
||||
break;
|
||||
#if (BT_SSP_INCLUDED == TRUE)
|
||||
case BTC_GAP_BT_ACT_PASSKEY_REPLY:
|
||||
@ -966,6 +995,10 @@ void btc_gap_bt_call_handler(btc_msg_t *msg)
|
||||
btc_gap_bt_set_qos(arg);
|
||||
break;
|
||||
}
|
||||
case BTC_GAP_BT_ACT_SET_ACL_PKT_TYPES: {
|
||||
btc_gap_set_acl_pkt_types(arg);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1009,6 +1042,7 @@ void btc_gap_bt_cb_deep_free(btc_msg_t *msg)
|
||||
case BTC_GAP_BT_REMOVE_BOND_DEV_COMPLETE_EVT:
|
||||
case BTC_GAP_BT_QOS_EVT:
|
||||
#if (BT_SSP_INCLUDED == TRUE)
|
||||
case BTC_GAP_BT_SET_ACL_PKT_TYPES_EVT:
|
||||
case BTC_GAP_BT_CFM_REQ_EVT:
|
||||
case BTC_GAP_BT_KEY_NOTIF_EVT:
|
||||
case BTC_GAP_BT_KEY_REQ_EVT:
|
||||
@ -1093,6 +1127,10 @@ void btc_gap_bt_cb_handler(btc_msg_t *msg)
|
||||
btc_gap_bt_cb_to_app(ESP_BT_GAP_QOS_CMPL_EVT, (esp_bt_gap_cb_param_t *)msg->arg);
|
||||
break;
|
||||
}
|
||||
case BTC_GAP_BT_SET_ACL_PKT_TYPES_EVT: {
|
||||
btc_gap_bt_cb_to_app(ESP_BT_GAP_ACL_PKT_TYPE_CHANGED_EVT, (esp_bt_gap_cb_param_t *)msg->arg);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BTC_TRACE_ERROR("%s: Unhandled event (%d)!\n", __FUNCTION__, msg->act);
|
||||
break;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -31,6 +31,7 @@ typedef enum {
|
||||
BTC_GAP_BT_MODE_CHG_EVT,
|
||||
BTC_GAP_BT_REMOVE_BOND_DEV_COMPLETE_EVT,
|
||||
BTC_GAP_BT_QOS_EVT,
|
||||
BTC_GAP_BT_SET_ACL_PKT_TYPES_EVT,
|
||||
}btc_gap_bt_evt_t;
|
||||
|
||||
typedef enum {
|
||||
@ -51,6 +52,7 @@ typedef enum {
|
||||
BTC_GAP_BT_ACT_SET_AFH_CHANNELS,
|
||||
BTC_GAP_BT_ACT_READ_REMOTE_NAME,
|
||||
BTC_GAP_BT_ACT_SET_QOS,
|
||||
BTC_GAP_BT_ACT_SET_ACL_PKT_TYPES,
|
||||
} btc_gap_bt_act_t;
|
||||
|
||||
/* btc_bt_gap_args_t */
|
||||
@ -147,6 +149,12 @@ typedef union {
|
||||
uint32_t t_poll;
|
||||
} set_qos;
|
||||
|
||||
// BTC_GAP_BT_ACT_SET_ACL_PKT_TYPES
|
||||
struct set_acl_pkt_types_args {
|
||||
bt_bdaddr_t bda;
|
||||
uint16_t pkt_types;
|
||||
} set_acl_pkt_types;
|
||||
|
||||
} btc_gap_bt_args_t;
|
||||
|
||||
void btc_gap_bt_call_handler(btc_msg_t *msg);
|
||||
|
@ -2117,6 +2117,70 @@ tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda, tBT_TRANSPORT transport, tBTM_C
|
||||
return (BTM_UNKNOWN_ADDR);
|
||||
}
|
||||
|
||||
tBTM_STATUS BTM_SetAclPktTypes(BD_ADDR remote_bda, UINT16 pkt_types, tBTM_CMPL_CB *p_cb)
|
||||
{
|
||||
#if CLASSIC_BT_INCLUDED == TRUE
|
||||
tBTM_STATUS ret = BTM_UNKNOWN_ADDR;
|
||||
tACL_CONN *p;
|
||||
tBTM_SET_ACL_PKT_TYPES_RESULTS result;
|
||||
|
||||
/* If someone already waiting on the version, do not allow another */
|
||||
if (btm_cb.devcb.p_set_acl_pkt_types_cmpl_cb) {
|
||||
result.status = HCI_ERR_REPEATED_ATTEMPTS;
|
||||
(*p_cb)(&result);
|
||||
return (BTM_BUSY);;
|
||||
}
|
||||
|
||||
p = btm_bda_to_acl(remote_bda, BT_TRANSPORT_BR_EDR);
|
||||
|
||||
if (p != (tACL_CONN *)NULL) {
|
||||
btu_start_timer (&btm_cb.devcb.set_acl_pkt_types_timer, BTU_TTYPE_BTM_ACL,
|
||||
BTM_DEV_REPLY_TIMEOUT);
|
||||
|
||||
btm_cb.devcb.p_set_acl_pkt_types_cmpl_cb = p_cb;
|
||||
if (btm_set_packet_types(p, pkt_types) != BTM_CMD_STARTED) {
|
||||
btm_cb.devcb.p_set_acl_pkt_types_cmpl_cb = NULL;
|
||||
btu_stop_timer (&btm_cb.devcb.set_acl_pkt_types_timer);
|
||||
result.status = HCI_ERR_MEMORY_FULL;
|
||||
(*p_cb)(&result);
|
||||
ret = BTM_NO_RESOURCES;
|
||||
} else {
|
||||
ret = BTM_CMD_STARTED;
|
||||
}
|
||||
}
|
||||
/* If here, no BD Addr found */
|
||||
return ret;
|
||||
#else
|
||||
return BTM_NO_RESOURCES;
|
||||
#endif
|
||||
}
|
||||
|
||||
void btm_acl_pkt_types_changed(UINT8 status, UINT16 handle, UINT16 pkt_types)
|
||||
{
|
||||
#if CLASSIC_BT_INCLUDED == TRUE
|
||||
BTM_TRACE_DEBUG ("btm_acl_pkt_types_changed\n");
|
||||
tACL_CONN *conn = NULL;
|
||||
tBTM_SET_ACL_PKT_TYPES_RESULTS results;
|
||||
btu_stop_timer (&btm_cb.devcb.set_acl_pkt_types_timer);
|
||||
|
||||
/* If there is a callback registered for packet types changed, call it */
|
||||
if (btm_cb.devcb.p_set_acl_pkt_types_cmpl_cb) {
|
||||
if (status == HCI_SUCCESS) {
|
||||
results.status = BTM_SUCCESS;
|
||||
} else {
|
||||
results.status = BTM_BAD_VALUE_RET;
|
||||
}
|
||||
results.pkt_types = pkt_types;
|
||||
/* Search through the list of active channels for the correct BD Addr */
|
||||
if ((conn = btm_handle_to_acl(handle)) != NULL) {
|
||||
memcpy(results.rem_bda, conn->remote_addr, BD_ADDR_LEN);
|
||||
(*btm_cb.devcb.p_set_acl_pkt_types_cmpl_cb)(&results);
|
||||
}
|
||||
btm_cb.devcb.p_set_acl_pkt_types_cmpl_cb = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
tBTM_STATUS BTM_BleReadAdvTxPower(tBTM_CMPL_CB *p_cb)
|
||||
{
|
||||
|
@ -214,6 +214,10 @@ tBTM_CMPL_CB *p_tx_power_cmpl_cb;/* Callback function to be called
|
||||
TIMER_LIST_ENT afh_channels_timer;
|
||||
tBTM_CMPL_CB *p_afh_channels_cmpl_cb; /* Callback function to be called When */
|
||||
/* set AFH channels is completed */
|
||||
|
||||
TIMER_LIST_ENT set_acl_pkt_types_timer;
|
||||
tBTM_CMPL_CB *p_set_acl_pkt_types_cmpl_cb; /* Callback function to be called when */
|
||||
/* set ACL packet types is completed */
|
||||
#endif
|
||||
|
||||
DEV_CLASS dev_class; /* Local device class */
|
||||
@ -1041,6 +1045,7 @@ 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);
|
||||
void btm_acl_pkt_types_changed(UINT8 status, UINT16 handle, UINT16 pkt_types);
|
||||
void btm_read_link_quality_complete (UINT8 *p);
|
||||
tBTM_STATUS btm_set_packet_types (tACL_CONN *p, UINT16 pkt_types);
|
||||
void btm_process_clk_off_comp_evt (UINT16 hci_handle, UINT16 clock_offset);
|
||||
|
@ -90,7 +90,7 @@ static void btu_hcif_loopback_command_evt (void);
|
||||
static void btu_hcif_data_buf_overflow_evt (void);
|
||||
static void btu_hcif_max_slots_changed_evt (void);
|
||||
static void btu_hcif_read_clock_off_comp_evt (UINT8 *p);
|
||||
static void btu_hcif_conn_pkt_type_change_evt (void);
|
||||
static void btu_hcif_conn_pkt_type_change_evt (UINT8 *p);
|
||||
static void btu_hcif_qos_violation_evt (UINT8 *p);
|
||||
static void btu_hcif_page_scan_mode_change_evt (void);
|
||||
static void btu_hcif_page_scan_rep_mode_chng_evt (void);
|
||||
@ -284,7 +284,7 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
|
||||
btu_hcif_read_clock_off_comp_evt (p);
|
||||
break;
|
||||
case HCI_CONN_PKT_TYPE_CHANGE_EVT:
|
||||
btu_hcif_conn_pkt_type_change_evt ();
|
||||
btu_hcif_conn_pkt_type_change_evt (p);
|
||||
break;
|
||||
case HCI_QOS_VIOLATION_EVT:
|
||||
btu_hcif_qos_violation_evt (p);
|
||||
@ -1764,8 +1764,19 @@ static void btu_hcif_read_clock_off_comp_evt (UINT8 *p)
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
static void btu_hcif_conn_pkt_type_change_evt (void)
|
||||
static void btu_hcif_conn_pkt_type_change_evt (UINT8 *p)
|
||||
{
|
||||
UINT8 status;
|
||||
UINT16 handle;
|
||||
UINT16 pkt_types;
|
||||
|
||||
STREAM_TO_UINT8 (status, p);
|
||||
STREAM_TO_UINT16 (handle, p);
|
||||
STREAM_TO_UINT16 (pkt_types, p);
|
||||
|
||||
handle = HCID_GET_HANDLE (handle);
|
||||
|
||||
btm_acl_pkt_types_changed(status, handle, pkt_types);
|
||||
}
|
||||
|
||||
|
||||
|
@ -810,6 +810,15 @@ typedef struct {
|
||||
UINT8 hci_status;
|
||||
} tBTM_SET_AFH_CHANNELS_RESULTS;
|
||||
|
||||
/* Structure returned with set ACL packet types event (in tBTM_CMPL_CB callback function)
|
||||
** in response to BTM_SetAclPktTypes call.
|
||||
*/
|
||||
typedef struct {
|
||||
tBTM_STATUS status;
|
||||
BD_ADDR rem_bda;
|
||||
UINT16 pkt_types;
|
||||
} tBTM_SET_ACL_PKT_TYPES_RESULTS;
|
||||
|
||||
/* Structure returned with set BLE channels event (in tBTM_CMPL_CB callback function)
|
||||
** in response to BTM_BleSetChannels call.
|
||||
*/
|
||||
@ -2205,6 +2214,20 @@ UINT8 BTM_SetTraceLevel (UINT8 new_level);
|
||||
//extern
|
||||
tBTM_STATUS BTM_WritePageTimeout(UINT16 timeout);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_SetAclPktTypes
|
||||
**
|
||||
** Description Send HCI Change Connection Packet Type
|
||||
**
|
||||
** Returns
|
||||
** BTM_SUCCESS Command sent.
|
||||
** BTM_NO_RESOURCES If out of resources to send the command.
|
||||
**
|
||||
*******************************************************************************/
|
||||
//extern
|
||||
tBTM_STATUS BTM_SetAclPktTypes(BD_ADDR remote_bda, UINT16 pkt_types, tBTM_CMPL_CB *p_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_WriteVoiceSettings
|
||||
|
Loading…
Reference in New Issue
Block a user