mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
feat(ble/bluedroid): Add new bluedroid host examples
This commit is contained in:
@@ -196,6 +196,26 @@ config BT_LE_POWER_CONTROL_ENABLED
|
||||
help
|
||||
Set this option to enable the Power Control feature on controller
|
||||
|
||||
config BT_LE_SUBRATE_ENABLED
|
||||
bool "Enable BLE connection subrating"
|
||||
depends on BT_LE_50_FEATURE_SUPPORT && !BT_NIMBLE_ENABLED && !BT_BLUEDROID_ENABLED && SOC_BLE_SUBRATE_SUPPORTED
|
||||
default n
|
||||
help
|
||||
Set this option to enable the Connection Subrating feature on controller
|
||||
|
||||
config BT_LE_CTE_FEATURE_ENABLED
|
||||
bool "Enable Bluetooth LE Direction Finding (AoA/AoD)"
|
||||
depends on BT_LE_50_FEATURE_SUPPORT && SOC_BLE_CTE_SUPPORTED && !(BT_LE_SECURITY_ENABLE)
|
||||
default n
|
||||
help
|
||||
Enable this option to activate Bluetooth LE Direction Finding (AoA/AoD) feature.
|
||||
Note:
|
||||
This feature allows devices to determine the direction of a Bluetooth CTE signal,
|
||||
enabling Angle of Arrival (AoA) and Angle of Departure (AoD) functionality.
|
||||
In chip esp32h2, Direction Finding is not supported in encrypted
|
||||
communication scenarios. If you are using chip esp32h2, ensure that encryption is
|
||||
disabled when using this feature.
|
||||
|
||||
config BT_LE_PERIODIC_ADV_WITH_RESPONSE_ENABLED
|
||||
bool "Enable BLE periodic advertising with response"
|
||||
depends on BT_LE_50_FEATURE_SUPPORT && SOC_BLE_PERIODIC_ADV_WITH_RESPONSE
|
||||
|
||||
@@ -40,6 +40,7 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_HCI_EVT_HI_BUF_COUNT MYNEWT_VAL(BLE_TRANSPORT_EVT_COUNT)
|
||||
#define DEFAULT_BT_LE_HCI_EVT_LO_BUF_COUNT MYNEWT_VAL(BLE_TRANSPORT_EVT_DISCARDABLE_COUNT)
|
||||
#define DEFAULT_BT_LE_POWER_CONTROL_ENABLED MYNEWT_VAL(BLE_POWER_CONTROL)
|
||||
#define DEFAULT_BT_LE_SUBRATE_ENABLED MYNEWT_VAL(BLE_CONN_SUBRATING)
|
||||
#if defined(CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT)
|
||||
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (1)
|
||||
#else
|
||||
@@ -145,6 +146,13 @@ extern "C" {
|
||||
#else
|
||||
#define DEFAULT_BT_LE_POWER_CONTROL_ENABLED (0)
|
||||
#endif
|
||||
#if defined(CONFIG_BT_BLE_FEAT_CONN_SUBRATING)
|
||||
#define DEFAULT_BT_LE_SUBRATE_ENABLED (CONFIG_BT_BLE_FEAT_CONN_SUBRATING)
|
||||
#elif defined(CONFIG_BT_LE_SUBRATE_ENABLED)
|
||||
#define DEFAULT_BT_LE_SUBRATE_ENABLED (CONFIG_BT_LE_SUBRATE_ENABLED)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_SUBRATE_ENABLED (0)
|
||||
#endif
|
||||
#if defined(CONFIG_BT_LE_50_FEATURE_SUPPORT)
|
||||
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (1)
|
||||
#else
|
||||
|
||||
@@ -227,6 +227,13 @@ config BT_LE_POWER_CONTROL_ENABLED
|
||||
help
|
||||
Set this option to enable the Power Control feature on controller
|
||||
|
||||
config BT_LE_SUBRATE_ENABLED
|
||||
bool "Enable BLE connection subrating"
|
||||
depends on BT_LE_50_FEATURE_SUPPORT && !BT_NIMBLE_ENABLED && !BT_BLUEDROID_ENABLED && SOC_BLE_SUBRATE_SUPPORTED
|
||||
default n
|
||||
help
|
||||
Set this option to enable the Connection Subrating feature on controller
|
||||
|
||||
config BT_LE_CTE_FEATURE_ENABLED
|
||||
bool "Enable Bluetooth LE Direction Finding (AoA/AoD)"
|
||||
depends on BT_LE_50_FEATURE_SUPPORT && SOC_BLE_CTE_SUPPORTED
|
||||
|
||||
@@ -146,6 +146,13 @@ extern "C" {
|
||||
#else
|
||||
#define DEFAULT_BT_LE_POWER_CONTROL_ENABLED (0)
|
||||
#endif
|
||||
#if defined(CONFIG_BT_BLE_FEAT_CONN_SUBRATING)
|
||||
#define DEFAULT_BT_LE_SUBRATE_ENABLED (CONFIG_BT_BLE_FEAT_CONN_SUBRATING)
|
||||
#elif defined(CONFIG_BT_LE_SUBRATE_ENABLED)
|
||||
#define DEFAULT_BT_LE_SUBRATE_ENABLED (CONFIG_BT_LE_SUBRATE_ENABLED)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_SUBRATE_ENABLED (0)
|
||||
#endif
|
||||
#if defined(CONFIG_BT_LE_50_FEATURE_SUPPORT)
|
||||
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (1)
|
||||
#else
|
||||
@@ -167,7 +174,6 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_HCI_UART_RTS_PIN (-1)
|
||||
#endif
|
||||
|
||||
#define DEFAULT_BT_LE_SUBRATE_ENABLED 0
|
||||
#define DEFAULT_BT_ADV_SEND_CONSTANT_DID (0)
|
||||
#define DEFAULT_BT_SCAN_ALLOW_ENH_ADI_FILTER (0)
|
||||
#endif
|
||||
|
||||
@@ -227,6 +227,13 @@ config BT_LE_POWER_CONTROL_ENABLED
|
||||
help
|
||||
Set this option to enable the Power Control feature on controller
|
||||
|
||||
config BT_LE_SUBRATE_ENABLED
|
||||
bool "Enable BLE connection subrating"
|
||||
depends on BT_LE_50_FEATURE_SUPPORT && !BT_NIMBLE_ENABLED && !BT_BLUEDROID_ENABLED && SOC_BLE_SUBRATE_SUPPORTED
|
||||
default n
|
||||
help
|
||||
Set this option to enable the Connection Subrating feature on controller
|
||||
|
||||
config BT_LE_CTE_FEATURE_ENABLED
|
||||
bool "Enable Bluetooth LE Direction Finding (AoA/AoD)"
|
||||
depends on BT_LE_50_FEATURE_SUPPORT && SOC_BLE_CTE_SUPPORTED && !(BT_LE_SECURITY_ENABLE)
|
||||
|
||||
@@ -40,6 +40,7 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_HCI_EVT_HI_BUF_COUNT MYNEWT_VAL(BLE_TRANSPORT_EVT_COUNT)
|
||||
#define DEFAULT_BT_LE_HCI_EVT_LO_BUF_COUNT MYNEWT_VAL(BLE_TRANSPORT_EVT_DISCARDABLE_COUNT)
|
||||
#define DEFAULT_BT_LE_POWER_CONTROL_ENABLED MYNEWT_VAL(BLE_POWER_CONTROL)
|
||||
#define DEFAULT_BT_LE_SUBRATE_ENABLED MYNEWT_VAL(BLE_CONN_SUBRATING)
|
||||
#if defined(CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT)
|
||||
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (1)
|
||||
#else
|
||||
@@ -145,6 +146,13 @@ extern "C" {
|
||||
#else
|
||||
#define DEFAULT_BT_LE_POWER_CONTROL_ENABLED (0)
|
||||
#endif
|
||||
#if defined(CONFIG_BT_BLE_FEAT_CONN_SUBRATING)
|
||||
#define DEFAULT_BT_LE_SUBRATE_ENABLED (CONFIG_BT_BLE_FEAT_CONN_SUBRATING)
|
||||
#elif defined(CONFIG_BT_LE_SUBRATE_ENABLED)
|
||||
#define DEFAULT_BT_LE_SUBRATE_ENABLED (CONFIG_BT_LE_SUBRATE_ENABLED)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_SUBRATE_ENABLED (0)
|
||||
#endif
|
||||
#if defined(CONFIG_BT_LE_50_FEATURE_SUPPORT)
|
||||
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (1)
|
||||
#else
|
||||
|
||||
@@ -1542,7 +1542,7 @@ config BT_BLE_FEAT_CONN_SUBRATING
|
||||
|
||||
config BT_BLE_FEAT_PAWR_EN
|
||||
bool "Enable Periodic Advertisement with Response(PAwR)"
|
||||
depends on (BT_BLE_50_FEATURES_SUPPORTED && ((BT_CONTROLLER_ENABLED && SOC_BLE_PAWR_SUPPORTED) || BT_CONTROLLER_DISABLED)) # NOERROR
|
||||
depends on (BT_BLE_50_FEATURES_SUPPORTED && ((BT_CONTROLLER_ENABLED && SOC_BLE_PERIODIC_ADV_WITH_RESPONSE) || BT_CONTROLLER_DISABLED)) # NOERROR
|
||||
default n
|
||||
help
|
||||
Enable BLE Periodic Advertisement with Response(PAwR) feature
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -379,6 +379,25 @@ esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, e
|
||||
esp_err_t esp_ble_gattc_aux_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, esp_ble_addr_type_t remote_addr_type, bool is_direct);
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
/**
|
||||
* @brief Open an auxiliary connection with PAwR synced parameters
|
||||
*
|
||||
* @param[in] gattc_if GATT Client access interface
|
||||
* @param[in] pawr_conn_params PAwR connection parameters
|
||||
*
|
||||
* @note
|
||||
* 1. This function is used to establish a connection with a device that is synchronized to a PAwR advertiser.
|
||||
* 2. The function always triggers `ESP_GATTC_CONNECT_EVT` and `ESP_GATTC_OPEN_EVT`.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: Success
|
||||
* - ESP_ERR_INVALID_ARG: Invalid argument
|
||||
* - ESP_FAIL: Failure
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_aux_open_with_pawr_synced(esp_gatt_if_t gattc_if, esp_ble_gatt_pawr_conn_params_t *pawr_conn_params);
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
/**
|
||||
* @brief Close the virtual GATT Client connection
|
||||
*
|
||||
|
||||
@@ -1838,7 +1838,7 @@ void BTM_BleSetPaSubeventData(UINT8 adv_handle, UINT8 num_subevents_with_data, u
|
||||
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
|
||||
|
||||
if ((err = btsnd_hcic_ble_set_periodic_adv_subevt_data(adv_handle, num_subevents_with_data, (ble_subevent_params *)subevent_params)) != HCI_SUCCESS) {
|
||||
BTM_TRACE_ERROR("%s cmd err = 0x%x", __func__, err);
|
||||
BTM_TRACE_WARNING("%s cmd err = 0x%x", __func__, err);
|
||||
status = BTM_HCI_ERROR | err;
|
||||
}
|
||||
|
||||
|
||||
@@ -194,6 +194,7 @@ void gatt_free(void)
|
||||
fixed_queue_free(p_tcb->sr_cmd.multi_rsp_q, NULL);
|
||||
p_tcb->sr_cmd.multi_rsp_q = NULL;
|
||||
#endif /* #if (GATTS_INCLUDED == TRUE) */
|
||||
UNUSED(p_tcb);
|
||||
}
|
||||
list_free(gatt_cb.p_tcb_list);
|
||||
list_free(gatt_cb.p_clcb_list);
|
||||
@@ -1001,7 +1002,9 @@ void gatt_data_process (tGATT_TCB *p_tcb, BT_HDR *p_buf)
|
||||
pseudo_op_code = op_code & (~GATT_WRITE_CMD_MASK);
|
||||
|
||||
if (pseudo_op_code < GATT_OP_CODE_MAX) {
|
||||
#if (GATTS_INCLUDED == TRUE) || (GATTC_INCLUDED == TRUE)
|
||||
GATT_TRACE_DEBUG("%s opcode=%x msg_len=%u", __func__, op_code, msg_len);
|
||||
#endif ///(GATTS_INCLUDED == TRUE) || (GATTC_INCLUDED == TRUE)
|
||||
if (op_code == GATT_SIGN_CMD_WRITE) {
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
gatt_verify_signature(p_tcb, p_buf);
|
||||
|
||||
@@ -1374,7 +1374,7 @@ typedef struct {
|
||||
UINT8 data_status;
|
||||
UINT8 data_len;
|
||||
UINT8 *data;
|
||||
} __attribute__((packed)) tBTM_BLE_PA_RSP_DATA_INFO;
|
||||
} tBTM_BLE_PA_RSP_DATA_INFO;
|
||||
|
||||
typedef struct {
|
||||
UINT8 adv_handle;
|
||||
|
||||
@@ -1295,7 +1295,7 @@ UINT8 btsnd_hcic_ble_set_ext_adv_params_v2(UINT8 adv_handle, UINT16 properties,
|
||||
#define HCIC_PARAM_SIZE_CREATE_CONFIG_PARAMS_LEN 28
|
||||
#define HCIC_PARAM_SIZE_REMOVE_CONFIG_PARAMS_LEN 3
|
||||
#define HCIC_PARAM_SIZE_SET_CHANNEL_CLASS_PARAMS_LEN 10
|
||||
#define HCIC_PARAM_SIZE_SET_PROCEDURE_PARAMS_LEN 21
|
||||
#define HCIC_PARAM_SIZE_SET_PROCEDURE_PARAMS_LEN 23
|
||||
#define HCIC_PARAM_SIZE_SET_PROCEDURE_ENABLE_PARAMS_LEN 4
|
||||
|
||||
UINT8 btsnd_hcic_ble_cs_read_local_supported_caps(void);
|
||||
|
||||
@@ -285,7 +285,7 @@ typedef struct {
|
||||
.ignore_wl_for_direct_adv = 0, \
|
||||
.enable_pcl = DEFAULT_BT_LE_POWER_CONTROL_ENABLED, \
|
||||
.csa2_select = DEFAULT_BT_LE_50_FEATURE_SUPPORT, \
|
||||
.enable_csr = 0, \
|
||||
.enable_csr = DEFAULT_BT_LE_SUBRATE_ENABLED, \
|
||||
.ble_aa_check = DEFAULT_BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS, \
|
||||
.ble_llcp_disc_flag = BT_LE_CTRL_LLCP_DISC_FLAG, \
|
||||
.scan_backoff_upperlimitmax = BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX, \
|
||||
|
||||
@@ -353,7 +353,7 @@ typedef struct {
|
||||
.ignore_wl_for_direct_adv = 0, \
|
||||
.enable_pcl = DEFAULT_BT_LE_POWER_CONTROL_ENABLED, \
|
||||
.csa2_select = DEFAULT_BT_LE_50_FEATURE_SUPPORT, \
|
||||
.enable_csr = 0, \
|
||||
.enable_csr = DEFAULT_BT_LE_SUBRATE_ENABLED, \
|
||||
.ble_aa_check = DEFAULT_BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS, \
|
||||
.ble_llcp_disc_flag = BT_LE_CTRL_LLCP_DISC_FLAG, \
|
||||
.scan_backoff_upperlimitmax = BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX, \
|
||||
|
||||
@@ -288,7 +288,7 @@ typedef struct {
|
||||
.ignore_wl_for_direct_adv = 0, \
|
||||
.enable_pcl = DEFAULT_BT_LE_POWER_CONTROL_ENABLED, \
|
||||
.csa2_select = DEFAULT_BT_LE_50_FEATURE_SUPPORT, \
|
||||
.enable_csr = 0, \
|
||||
.enable_csr = DEFAULT_BT_LE_SUBRATE_ENABLED, \
|
||||
.ble_aa_check = DEFAULT_BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS, \
|
||||
.ble_llcp_disc_flag = BT_LE_CTRL_LLCP_DISC_FLAG, \
|
||||
.scan_backoff_upperlimitmax = BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX, \
|
||||
|
||||
Reference in New Issue
Block a user