diff --git a/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h b/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h index 1a072bf933..e35749a105 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h @@ -982,19 +982,27 @@ typedef struct { esp_ble_gap_sync_t filter_policy; /*!< Configures the filter policy for periodic advertising sync: 0: Use Advertising SID, Advertiser Address Type, and Advertiser Address parameters to determine the advertiser to listen to. 1: Use the Periodic Advertiser List to determine the advertiser to listen to. */ - #if (CONFIG_BT_BLE_FEAT_CREATE_SYNC_ENH) +#if (CONFIG_BT_BLE_FEAT_CREATE_SYNC_ENH) esp_ble_gap_sync_t reports_disabled; /*!< Supported only by esp32c2, esp32c6, and esp32h2; can be set by menuconfig: 0: Reporting initially enabled. 1: Reporting initially disabled. */ esp_ble_gap_sync_t filter_duplicates; /*!< Supported only by esp32c2, esp32c6, and esp32h2; can be set by menuconfig: 0: Duplicate filtering initially disabled. 1: Duplicate filtering initially enabled. */ - #endif +#endif // (CONFIG_BT_BLE_FEAT_CREATE_SYNC_ENH) uint8_t sid; /*!< SID of the periodic advertising */ esp_ble_addr_type_t addr_type; /*!< Address type of the periodic advertising */ esp_bd_addr_t addr; /*!< Address of the periodic advertising */ uint16_t skip; /*!< Maximum number of periodic advertising events that can be skipped */ uint16_t sync_timeout; /*!< Synchronization timeout */ +#if (CONFIG_BT_BLE_FEAT_CTE_EN) + uint8_t sync_cte_type; /*!< Whether to only synchronize to periodic advertising with certain types of CTE (Constant Tone Extension) + bit 0: Do not sync to packets with an AoA CTE + bit 1: Do not sync to packets with an AoD CTE with 1 μs slots + bit 2: Do not sync to packets with an AoD CTE with 2 μs slots + bit 3: Do not sync to packets with a type 3 CTE (currently reserved for future use) + bit 4: Do not sync to packets without a CTE */ +#endif // BT_BLE_FEAT_CTE_EN } esp_ble_gap_periodic_adv_sync_params_t; /** diff --git a/components/bt/host/bluedroid/bta/include/bta/bta_api.h b/components/bt/host/bluedroid/bta/include/bta/bta_api.h index b66fb2295f..d087e552ae 100644 --- a/components/bt/host/bluedroid/bta/include/bta/bta_api.h +++ b/components/bt/host/bluedroid/bta/include/bta/bta_api.h @@ -1589,15 +1589,16 @@ typedef struct { typedef struct { UINT8 filter_policy; - #if (CONFIG_BT_BLE_FEAT_CREATE_SYNC_ENH) +#if (BLE_FEAT_CREATE_SYNC_ENH == TRUE) UINT8 reports_disabled; UINT8 filter_duplicates; - #endif +#endif // (BLE_FEAT_CREATE_SYNC_ENH == TRUE) UINT8 sid; tBLE_ADDR_TYPE addr_type; BD_ADDR addr; UINT16 skip; UINT16 sync_timeout; + UINT8 sync_cte_type; } tBTA_DM_BLE_Periodic_Sync_Params; typedef struct { diff --git a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c index c28971c1df..2a0f737b20 100644 --- a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c +++ b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c @@ -2493,10 +2493,13 @@ void btc_gap_ble_call_handler(btc_msg_t *msg) params.addr_type = arg_5->periodic_adv_create_sync.params.addr_type; params.skip = arg_5->periodic_adv_create_sync.params.skip; params.sync_timeout = arg_5->periodic_adv_create_sync.params.sync_timeout; - #if (CONFIG_BT_BLE_FEAT_CREATE_SYNC_ENH) +#if (BLE_FEAT_CTE_EN == TRUE) + params.sync_cte_type = arg_5->periodic_adv_create_sync.params.sync_cte_type; +#endif // #if (BLE_FEAT_CTE_EN == TRUE) +#if (BLE_FEAT_CREATE_SYNC_ENH == TRUE) params.reports_disabled = arg_5->periodic_adv_create_sync.params.reports_disabled; params.filter_duplicates = arg_5->periodic_adv_create_sync.params.filter_duplicates; - #endif +#endif // (BLE_FEAT_CREATE_SYNC_ENH == TRUE) memcpy(params.addr, arg_5->periodic_adv_create_sync.params.addr, sizeof(BD_ADDR)); BTC_TRACE_DEBUG("BTC_GAP_BLE_PERIODIC_ADV_CREATE_SYNC"); diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c b/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c index f2dcad5de6..47941808b6 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c @@ -830,10 +830,10 @@ tBTM_STATUS BTM_BlePeriodicAdvCreateSync(tBTM_BLE_Periodic_Sync_Params *params) if ((params->sync_timeout < 0x0a || params->sync_timeout > 0x4000) || (params->filter_policy > 0x01) - #if (CONFIG_BT_BLE_FEAT_CREATE_SYNC_ENH) +#if (BLE_FEAT_CREATE_SYNC_ENH == TRUE) || (params->reports_disabled > 0x01) || (params->filter_duplicates > 0x01) - #endif +#endif // (BLE_FEAT_CREATE_SYNC_ENH == TRUE) /*If the Periodic Advertiser List is not used, the Advertising_SID, Advertiser Address_Type, and Advertiser Address parameters specify the periodic advertising device to listen to; otherwise they @@ -850,17 +850,17 @@ tBTM_STATUS BTM_BlePeriodicAdvCreateSync(tBTM_BLE_Periodic_Sync_Params *params) SET_BIT(option, 0); } - #if (CONFIG_BT_BLE_FEAT_CREATE_SYNC_ENH) +#if (BLE_FEAT_CREATE_SYNC_ENH == TRUE) if (params->reports_disabled) { SET_BIT(option, 1); } if (params->filter_duplicates) { SET_BIT(option, 2); } - #endif +#endif // (BLE_FEAT_CREATE_SYNC_ENH == TRUE) if (!btsnd_hcic_ble_periodic_adv_create_sync(option, params->sid, params->addr_type, - params->addr, params->sync_timeout, 0)) { + params->addr, params->sync_timeout, params->sync_cte_type)) { BTM_TRACE_ERROR("LE PA CreateSync cmd failed"); status = BTM_ILLEGAL_VALUE; } diff --git a/components/bt/host/bluedroid/stack/hcic/hciblecmds.c b/components/bt/host/bluedroid/stack/hcic/hciblecmds.c index 242ddd1868..5b4822dad9 100644 --- a/components/bt/host/bluedroid/stack/hcic/hciblecmds.c +++ b/components/bt/host/bluedroid/stack/hcic/hciblecmds.c @@ -1642,12 +1642,12 @@ BOOLEAN btsnd_hcic_ble_create_ext_conn(tHCI_CreatExtConn *p_conn) #if (BLE_50_EXTEND_SYNC_EN == TRUE) BOOLEAN btsnd_hcic_ble_periodic_adv_create_sync(UINT8 option, UINT8 adv_sid, UINT8 adv_addr_type, BD_ADDR adv_addr, - UINT16 sync_timeout, UINT8 unused) + UINT16 sync_timeout, UINT8 sync_cte_type) { BT_HDR *p; UINT8 *pp; - HCI_TRACE_EVENT("%s, option = %d, adv_sid = %d, adv_addr_type = %d, sync_timeout = %d, unused = %d", - __func__, option, adv_sid, adv_addr_type, sync_timeout, unused); + HCI_TRACE_EVENT("%s, option = %d, adv_sid = %d, adv_addr_type = %d, sync_timeout = %d, sync_cte_type = %d", + __func__, option, adv_sid, adv_addr_type, sync_timeout, sync_cte_type); HCI_TRACE_EVENT("addr %02x %02x %02x %02x %02x %02x", adv_addr[0], adv_addr[1], adv_addr[2], adv_addr[3], adv_addr[4], adv_addr[5]); uint16_t skip = 0; @@ -1661,7 +1661,7 @@ BOOLEAN btsnd_hcic_ble_periodic_adv_create_sync(UINT8 option, UINT8 adv_sid, BDADDR_TO_STREAM(pp, adv_addr); UINT16_TO_STREAM(pp, skip); UINT16_TO_STREAM(pp, sync_timeout); - UINT8_TO_STREAM(pp, unused); + UINT8_TO_STREAM(pp, sync_cte_type); btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); return TRUE; diff --git a/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h b/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h index fbad343cfb..7ec384ef1b 100644 --- a/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h +++ b/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h @@ -813,15 +813,16 @@ typedef struct { typedef struct { UINT8 filter_policy; - #if (CONFIG_BT_BLE_FEAT_CREATE_SYNC_ENH) +#if (BLE_FEAT_CREATE_SYNC_ENH == TRUE) UINT8 reports_disabled; UINT8 filter_duplicates; - #endif +#endif // (BLE_FEAT_CREATE_SYNC_ENH == TRUE) UINT8 sid; tBLE_ADDR_TYPE addr_type; BD_ADDR addr; UINT16 skip; UINT16 sync_timeout; + UINT8 sync_cte_type; } tBTM_BLE_Periodic_Sync_Params; typedef struct { diff --git a/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h b/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h index 6b7b45c439..4ee07b4d40 100644 --- a/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h +++ b/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h @@ -1034,7 +1034,7 @@ BOOLEAN btsnd_hcic_ble_create_ext_conn(tHCI_CreatExtConn *p_conn); BOOLEAN btsnd_hcic_ble_periodic_adv_create_sync(UINT8 filter_policy, UINT8 adv_sid, UINT8 adv_addr_type, BD_ADDR adv_addr, - UINT16 sync_timeout, UINT8 unused); + UINT16 sync_timeout, UINT8 sync_cte_type); UINT8 btsnd_hcic_ble_periodic_adv_create_sync_cancel(void); diff --git a/examples/bluetooth/bluedroid/ble_50/periodic_sync/tutorial/Periodic_Sync_Example_Walkthrough.md b/examples/bluetooth/bluedroid/ble_50/periodic_sync/tutorial/Periodic_Sync_Example_Walkthrough.md index 8b5924a556..c53b9b3045 100644 --- a/examples/bluetooth/bluedroid/ble_50/periodic_sync/tutorial/Periodic_Sync_Example_Walkthrough.md +++ b/examples/bluetooth/bluedroid/ble_50/periodic_sync/tutorial/Periodic_Sync_Example_Walkthrough.md @@ -243,14 +243,14 @@ typedef struct { esp_ble_gap_sync_t filter_policy; /*!< Configures the filter policy for periodic advertising sync: 0: Use Advertising SID, Advertiser Address Type, and Advertiser Address parameters to determine the advertiser to listen to. 1: Use the Periodic Advertiser List to determine the advertiser to listen to. */ - #if (BLE_FEAT_CREATE_SYNC_ENH) + #if (BLE_FEAT_CREATE_SYNC_ENH == TRUE) esp_ble_gap_sync_t reports_disabled; /*!< Supported only by esp32c2, esp32c6, and esp32h2; can be set by menuconfig: 0: Reporting initially enabled. 1: Reporting initially disabled. */ esp_ble_gap_sync_t filter_duplicates; /*!< Supported only by esp32c2, esp32c6, and esp32h2; can be set by menuconfig: 0: Duplicate filtering initially disabled. 1: Duplicate filtering initially enabled. */ - #endif + #endif // (BLE_FEAT_CREATE_SYNC_ENH == TRUE) uint8_t sid; /*!< SID of the periodic advertising */ esp_ble_addr_type_t addr_type; /*!< Address type of the periodic advertising */ esp_bd_addr_t addr; /*!< Address of the periodic advertising */