mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 09:09:10 -04:00
Merge branch 'feat/support_read_periodic_adv_size' into 'master'
feat(ble/bluedroid): Support read periodic advertiser list size command Closes IDF-11793 See merge request espressif/esp-idf!36751
This commit is contained in:
commit
bcea8c9881
@ -1502,6 +1502,17 @@ esp_err_t esp_ble_gap_periodic_adv_clear_dev(void)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_get_periodic_list_size(uint8_t *size)
|
||||
{
|
||||
if (size == NULL) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
btc_get_periodic_list_size(size);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
|
||||
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
|
||||
|
@ -2593,6 +2593,17 @@ esp_err_t esp_ble_gap_periodic_adv_remove_dev_from_list(esp_ble_addr_type_t addr
|
||||
*/
|
||||
esp_err_t esp_ble_gap_periodic_adv_clear_dev(void);
|
||||
|
||||
/**
|
||||
* @brief Retrieve the capacity of the periodic advertiser list in the controller.
|
||||
*
|
||||
* @param[out] size: Pointer to a variable where the capacity of the periodic advertiser list will be stored.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Success
|
||||
* - Others : Failure
|
||||
*/
|
||||
esp_err_t esp_ble_gap_get_periodic_list_size(uint8_t *size);
|
||||
|
||||
/**
|
||||
* @brief This function is used to set aux connection parameters
|
||||
*
|
||||
@ -2611,7 +2622,6 @@ esp_err_t esp_ble_gap_prefer_ext_connect_params_set(esp_bd_addr_t addr,
|
||||
const esp_ble_gap_conn_params_t *phy_1m_conn_params,
|
||||
const esp_ble_gap_conn_params_t *phy_2m_conn_params,
|
||||
const esp_ble_gap_conn_params_t *phy_coded_conn_params);
|
||||
|
||||
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
|
@ -1594,6 +1594,13 @@ static void btc_ble_dtm_enhance_rx_start(uint8_t rx_channel, uint8_t phy, uint8_
|
||||
}
|
||||
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
|
||||
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
void btc_get_periodic_list_size(uint8_t *size)
|
||||
{
|
||||
BTM_BleGetPeriodicAdvListSize(size);
|
||||
return;
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
|
||||
static void btc_ble_dtm_stop(tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
|
||||
{
|
||||
|
@ -463,6 +463,9 @@ typedef union {
|
||||
void btc_gap_ble_call_handler(btc_msg_t *msg);
|
||||
void btc_gap_ble_cb_handler(btc_msg_t *msg);
|
||||
void btc_get_whitelist_size(uint16_t *length);
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
void btc_get_periodic_list_size(uint8_t *length);
|
||||
#endif //#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
void btc_gap_ble_arg_deep_free(btc_msg_t *msg);
|
||||
void btc_gap_ble_cb_deep_free(btc_msg_t *msg);
|
||||
|
@ -86,6 +86,9 @@ typedef struct {
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
uint16_t ble_ext_adv_data_max_len;
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
uint16_t get_ble_periodic_advertiser_list_size;
|
||||
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
} controller_local_param_t;
|
||||
|
||||
@ -283,6 +286,12 @@ static void start_up(void)
|
||||
&controller_param.ble_ext_adv_data_max_len);
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
response = AWAIT_COMMAND(controller_param.packet_factory->read_periodic_adv_list_size());
|
||||
controller_param.packet_parser->parse_ble_read_periodic_adv_list_size_response(
|
||||
response,
|
||||
&controller_param.get_ble_periodic_advertiser_list_size);
|
||||
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
#endif // (BLE_50_FEATURE_SUPPORT == TRUE && BLE_42_FEATURE_SUPPORT == FALSE)
|
||||
|
||||
if (HCI_LE_DATA_LEN_EXT_SUPPORTED(controller_param.features_ble.as_array)) {
|
||||
@ -525,6 +534,14 @@ static uint16_t ble_get_ext_adv_data_max_len(void)
|
||||
return controller_param.ble_ext_adv_data_max_len;
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
static uint8_t get_ble_periodic_adv_list_size(void)
|
||||
{
|
||||
assert(controller_param.readable);
|
||||
assert(controller_param.ble_supported);
|
||||
return controller_param.get_ble_periodic_advertiser_list_size;
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
static uint8_t get_sco_data_size(void)
|
||||
@ -587,6 +604,9 @@ static const controller_t interface = {
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
ble_get_ext_adv_data_max_len,
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
get_ble_periodic_adv_list_size,
|
||||
#endif // (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
get_sco_data_size,
|
||||
|
@ -84,6 +84,9 @@ typedef struct controller_t {
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
uint16_t (*ble_get_ext_adv_data_max_len)(void);
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
uint8_t (*get_ble_periodic_adv_list_size)(void);
|
||||
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
#endif // BLE_50_FEATURE_SUPPORT
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
|
@ -226,6 +226,12 @@ static BT_HDR *make_read_max_adv_data_len(void)
|
||||
return make_command_no_params(HCI_BLE_RD_MAX_ADV_DATA_LEN);
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
static BT_HDR *read_periodic_adv_list_size(void)
|
||||
{
|
||||
return make_command_no_params(HCI_BLE_RD_PERIOD_ADV_LIST_SIZE);
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
// Internal functions
|
||||
|
||||
@ -277,6 +283,9 @@ static const hci_packet_factory_t interface = {
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
make_read_max_adv_data_len,
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
read_periodic_adv_list_size,
|
||||
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
make_ble_read_suggested_default_data_length,
|
||||
make_ble_write_suggested_default_data_length,
|
||||
|
@ -222,7 +222,21 @@ static void parse_ble_read_adv_max_len_response(
|
||||
}
|
||||
osi_free(response);
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
static void parse_ble_read_periodic_adv_list_size_response(
|
||||
BT_HDR *response,
|
||||
uint16_t *periodic_adv_list_size_ptr)
|
||||
{
|
||||
|
||||
uint8_t *stream = read_command_complete_header(response, HCI_BLE_RD_PERIOD_ADV_LIST_SIZE, 1 /* bytes after */);
|
||||
if (stream) {
|
||||
// Size: 1 Octets ; Value: 0x01 to 0xFF ; Total number of Periodic Advertiser list entries that can be stored in the Controller
|
||||
STREAM_TO_UINT8(*periodic_adv_list_size_ptr, stream);
|
||||
}
|
||||
osi_free(response);
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
|
||||
@ -287,6 +301,9 @@ static const hci_packet_parser_t interface = {
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
parse_ble_read_adv_max_len_response,
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
parse_ble_read_periodic_adv_list_size_response,
|
||||
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
parse_ble_read_suggested_default_data_length_response
|
||||
};
|
||||
|
@ -48,6 +48,9 @@ typedef struct {
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
BT_HDR *(*make_read_max_adv_data_len)(void);
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
BT_HDR *(*read_periodic_adv_list_size)(void);
|
||||
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
BT_HDR *(*make_ble_read_suggested_default_data_length)(void);
|
||||
BT_HDR *(*make_ble_write_suggested_default_data_length)(uint16_t SuggestedMaxTxOctets, uint16_t SuggestedMaxTxTime);
|
||||
|
@ -101,6 +101,12 @@ typedef struct {
|
||||
uint16_t *ble_ext_adv_data_max_len_ptr
|
||||
);
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
void (*parse_ble_read_periodic_adv_list_size_response) (
|
||||
BT_HDR *response,
|
||||
uint16_t *periodic_advertiser_list_size
|
||||
);
|
||||
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
void (*parse_ble_read_suggested_default_data_length_response)(
|
||||
BT_HDR *response,
|
||||
|
@ -2222,6 +2222,18 @@ void BTM_BleGetWhiteListSize(uint16_t *length)
|
||||
*length = p_cb->white_list_avail_size;
|
||||
return;
|
||||
}
|
||||
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
void BTM_BleGetPeriodicAdvListSize(uint8_t *size)
|
||||
{
|
||||
tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
|
||||
if (p_cb->periodic_adv_list_size == 0) {
|
||||
BTM_TRACE_WARNING("%s Periodic Adv list is full.", __func__);
|
||||
}
|
||||
*size = p_cb->periodic_adv_list_size;
|
||||
}
|
||||
#endif //#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
|
||||
|
@ -423,6 +423,23 @@ void btm_ble_white_list_init(UINT8 white_list_size)
|
||||
btm_cb.ble_ctr_cb.white_list_avail_size = white_list_size;
|
||||
}
|
||||
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_periodic_adv_list_init
|
||||
**
|
||||
** Description Initialize the periodic advertiser list size.
|
||||
**
|
||||
** Parameters periodic_adv_size: The size of the periodic advertiser list to be initialized.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btm_ble_periodic_adv_list_init(UINT8 periodic_adv_size)
|
||||
{
|
||||
BTM_TRACE_DEBUG("%s white_list_size = %d", __func__, periodic_adv_size);
|
||||
btm_cb.ble_ctr_cb.periodic_adv_list_size = periodic_adv_size;
|
||||
}
|
||||
#endif //#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_add_2_white_list_complete
|
||||
|
@ -199,6 +199,9 @@ static void reset_complete(void)
|
||||
|
||||
if (controller->supports_ble()) {
|
||||
btm_ble_white_list_init(controller->get_ble_white_list_size());
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
btm_ble_periodic_adv_list_init(controller->get_ble_periodic_adv_list_size());
|
||||
#endif //#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
l2c_link_processs_ble_num_bufs(controller->get_acl_buffer_count_ble());
|
||||
}
|
||||
#endif
|
||||
|
@ -353,6 +353,10 @@ typedef struct {
|
||||
tBTM_BLE_SEL_CBACK *p_select_cback;
|
||||
/* white list information */
|
||||
UINT8 white_list_avail_size;
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
/* periodic list information */
|
||||
UINT8 periodic_adv_list_size;
|
||||
#endif //#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
tBTM_UPDATE_WHITELIST_CBACK *update_wl_cb;
|
||||
tBTM_BLE_WL_STATE wl_state;
|
||||
|
||||
@ -552,6 +556,9 @@ void btm_ble_channel_select_algorithm_evt(tBTM_BLE_CHANNEL_SEL_ALG *params);
|
||||
void btm_ble_periodic_adv_report_evt(tBTM_PERIOD_ADV_REPORT *params);
|
||||
void btm_ble_periodic_adv_sync_lost_evt(tBTM_BLE_PERIOD_ADV_SYNC_LOST *params);
|
||||
void btm_ble_periodic_adv_sync_establish_evt(tBTM_BLE_PERIOD_ADV_SYNC_ESTAB *params);
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
void btm_ble_periodic_adv_list_init(UINT8 periodic_adv_size);
|
||||
#endif //#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
|
@ -3049,7 +3049,9 @@ tBTM_STATUS BTM_BleReadAdvTxPower(tBTM_CMPL_CB *p_cb);
|
||||
|
||||
void BTM_BleGetWhiteListSize(uint16_t *length);
|
||||
|
||||
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
void BTM_BleGetPeriodicAdvListSize(uint8_t *size);
|
||||
#endif //#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_ReadLinkQuality
|
||||
|
Loading…
x
Reference in New Issue
Block a user