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.2' into 'release/v5.2'
feat(bt/bluedroid): Added an API to specify data types for ACL-U traffic (v5.2) See merge request espressif/esp-idf!27128
This commit is contained in:
commit
c23973dfa7
@ -475,4 +475,23 @@ esp_err_t esp_bt_gap_get_page_timeout(void)
|
||||
|
||||
return (btc_transfer_context(&msg, NULL, 0, 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 */
|
||||
|
@ -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)
|
||||
@ -220,6 +248,7 @@ typedef enum {
|
||||
ESP_BT_GAP_ACL_DISCONN_CMPL_STAT_EVT, /*!< ACL disconnection complete status event */
|
||||
ESP_BT_GAP_SET_PAGE_TO_EVT, /*!< Set page timeout event */
|
||||
ESP_BT_GAP_GET_PAGE_TO_EVT, /*!< Get page timeout 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;
|
||||
|
||||
@ -394,6 +423,15 @@ typedef union {
|
||||
uint16_t page_to; /*!< page_timeout value to be set, unit is 0.625ms. */
|
||||
} get_page_timeout; /*!< get page timeout 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
|
||||
*/
|
||||
@ -834,6 +872,17 @@ esp_err_t esp_bt_gap_set_page_timeout(uint16_t page_to);
|
||||
*/
|
||||
esp_err_t esp_bt_gap_get_page_timeout(void);
|
||||
|
||||
/**
|
||||
* @brief Set ACL packet types
|
||||
* 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
|
||||
|
@ -874,6 +874,28 @@ void bta_dm_get_page_timeout (tBTA_DM_MSG *p_data)
|
||||
{
|
||||
BTM_ReadPageTimeout(p_data->get_page_timeout.get_page_to_cb);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** 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
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -341,6 +341,30 @@ void BTA_DmGetPageTimeout(tBTM_CMPL_CB *p_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)
|
||||
|
@ -69,6 +69,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
||||
bta_dm_config_eir, /* BTA_DM_API_CONFIG_EIR_EVT */
|
||||
bta_dm_set_page_timeout, /* BTA_DM_API_PAGE_TO_SET_EVT */
|
||||
bta_dm_get_page_timeout, /* BTA_DM_API_PAGE_TO_GET_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)
|
||||
|
@ -61,6 +61,7 @@ enum {
|
||||
BTA_DM_API_CONFIG_EIR_EVT,
|
||||
BTA_DM_API_PAGE_TO_SET_EVT,
|
||||
BTA_DM_API_PAGE_TO_GET_EVT,
|
||||
BTA_DM_API_SET_ACL_PKT_TYPES_EVT,
|
||||
#endif
|
||||
BTA_DM_API_SET_AFH_CHANNELS_EVT,
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
@ -299,6 +300,14 @@ typedef struct {
|
||||
tBTM_CMPL_CB *get_page_to_cb;
|
||||
} tBTA_DM_API_PAGE_TO_GET;
|
||||
|
||||
/* 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;
|
||||
@ -1158,6 +1167,7 @@ typedef union {
|
||||
tBTA_DM_API_SET_AFH_CHANNELS set_afh_channels;
|
||||
tBTA_DM_API_PAGE_TO_SET set_page_timeout;
|
||||
tBTA_DM_API_PAGE_TO_GET get_page_timeout;
|
||||
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
|
||||
@ -1670,6 +1680,7 @@ extern void bta_dm_cfg_coex_status(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_config_eir (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_set_page_timeout (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_get_page_timeout (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);
|
||||
|
@ -443,6 +443,8 @@ typedef tBTM_BLE_SET_CHANNELS_RESULTS tBTA_BLE_SET_CHANNELS_RESULTS;
|
||||
typedef tBTM_SET_PAGE_TIMEOUT_RESULTS tBTA_SET_PAGE_TIMEOUT_RESULTS;
|
||||
typedef tBTM_GET_PAGE_TIMEOUT_RESULTS tBTA_GET_PAGE_TIMEOUT_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 */
|
||||
@ -1804,6 +1806,18 @@ void BTA_DmSetPageTimeout(UINT16 page_to, tBTM_CMPL_CB *p_cb);
|
||||
*******************************************************************************/
|
||||
void BTA_DmGetPageTimeout(tBTM_CMPL_CB *p_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** 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)
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -770,6 +770,33 @@ static void btc_gap_get_page_timeout(void)
|
||||
BTA_DmGetPageTimeout(btc_gap_bt_get_page_timeout_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;
|
||||
@ -844,6 +871,7 @@ void btc_gap_bt_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||
case BTC_GAP_BT_ACT_SET_QOS:
|
||||
case BTC_GAP_BT_ACT_SET_PAGE_TIMEOUT:
|
||||
case BTC_GAP_BT_ACT_GET_PAGE_TIMEOUT:
|
||||
case BTC_GAP_BT_ACT_SET_ACL_PKT_TYPES:
|
||||
break;
|
||||
case BTC_GAP_BT_ACT_PASSKEY_REPLY:
|
||||
case BTC_GAP_BT_ACT_CONFIRM_REPLY:
|
||||
@ -910,6 +938,7 @@ void btc_gap_bt_arg_deep_free(btc_msg_t *msg)
|
||||
case BTC_GAP_BT_ACT_SET_QOS:
|
||||
case BTC_GAP_BT_ACT_SET_PAGE_TIMEOUT:
|
||||
case BTC_GAP_BT_ACT_GET_PAGE_TIMEOUT:
|
||||
case BTC_GAP_BT_ACT_SET_ACL_PKT_TYPES:
|
||||
break;
|
||||
case BTC_GAP_BT_ACT_PASSKEY_REPLY:
|
||||
case BTC_GAP_BT_ACT_CONFIRM_REPLY:
|
||||
@ -1016,6 +1045,10 @@ void btc_gap_bt_call_handler(btc_msg_t *msg)
|
||||
btc_gap_get_page_timeout();
|
||||
break;
|
||||
}
|
||||
case BTC_GAP_BT_ACT_SET_ACL_PKT_TYPES: {
|
||||
btc_gap_set_acl_pkt_types(arg);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1060,6 +1093,7 @@ void btc_gap_bt_cb_deep_free(btc_msg_t *msg)
|
||||
case BTC_GAP_BT_QOS_EVT:
|
||||
case BTC_GAP_BT_SET_PAGE_TO_EVT:
|
||||
case BTC_GAP_BT_GET_PAGE_TO_EVT:
|
||||
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:
|
||||
@ -1149,6 +1183,10 @@ void btc_gap_bt_cb_handler(btc_msg_t *msg)
|
||||
btc_gap_bt_cb_to_app(ESP_BT_GAP_GET_PAGE_TO_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;
|
||||
|
@ -33,6 +33,7 @@ typedef enum {
|
||||
BTC_GAP_BT_QOS_EVT,
|
||||
BTC_GAP_BT_SET_PAGE_TO_EVT,
|
||||
BTC_GAP_BT_GET_PAGE_TO_EVT,
|
||||
BTC_GAP_BT_SET_ACL_PKT_TYPES_EVT,
|
||||
}btc_gap_bt_evt_t;
|
||||
|
||||
typedef enum {
|
||||
@ -55,6 +56,7 @@ typedef enum {
|
||||
BTC_GAP_BT_ACT_SET_QOS,
|
||||
BTC_GAP_BT_ACT_SET_PAGE_TIMEOUT,
|
||||
BTC_GAP_BT_ACT_GET_PAGE_TIMEOUT,
|
||||
BTC_GAP_BT_ACT_SET_ACL_PKT_TYPES,
|
||||
} btc_gap_bt_act_t;
|
||||
|
||||
/* btc_bt_gap_args_t */
|
||||
@ -156,6 +158,12 @@ typedef union {
|
||||
uint16_t page_to;
|
||||
} set_page_to;
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
@ -218,6 +218,9 @@ tBTM_CMPL_CB *p_afh_channels_cmpl_cb; /* Callback function to be called
|
||||
TIMER_LIST_ENT page_timeout_set_timer;
|
||||
tBTM_CMPL_CB *p_page_to_set_cmpl_cb; /* Callback function to be called when */
|
||||
/* set page timeout 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 */
|
||||
@ -1046,6 +1049,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);
|
||||
@ -282,7 +282,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);
|
||||
@ -1759,8 +1759,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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -851,6 +851,15 @@ typedef struct {
|
||||
UINT16 page_to;
|
||||
} tBTM_GET_PAGE_TIMEOUT_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.
|
||||
*/
|
||||
@ -2275,6 +2284,20 @@ tBTM_STATUS BTM_WritePageTimeout(UINT16 timeout, tBTM_CMPL_CB *p_cb);
|
||||
//extern
|
||||
tBTM_STATUS BTM_ReadPageTimeout(tBTM_CMPL_CB *p_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** 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