mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat(ble/bluedroid): Add bluedroid host Advertising Coding Selection feature
This commit is contained in:
@@ -401,7 +401,18 @@ tBTM_STATUS BTM_BleSetExtendedAdvParams(UINT8 instance, tBTM_BLE_GAP_EXT_ADV_PAR
|
||||
#else
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = params->own_addr_type;
|
||||
#endif
|
||||
|
||||
#if (BT_BLE_FEAT_ADV_CODING_SELECTION == TRUE)
|
||||
if ((err = btsnd_hcic_ble_set_ext_adv_params_v2(instance, params->type, params->interval_min, params->interval_max,
|
||||
params->channel_map, params->own_addr_type, params->peer_addr_type,
|
||||
params->peer_addr, params->filter_policy, params->tx_power,
|
||||
params->primary_phy, params->max_skip,
|
||||
params->secondary_phy, params->sid, params->scan_req_notif,
|
||||
params->primary_adv_phy_options, params->secondary_adv_phy_options)) != HCI_SUCCESS) {
|
||||
BTM_TRACE_ERROR("LE EA SetParams: cmd err=0x%x", err);
|
||||
status = BTM_HCI_ERROR | err;
|
||||
goto end;
|
||||
}
|
||||
#else
|
||||
if ((err = btsnd_hcic_ble_set_ext_adv_params(instance, params->type, params->interval_min, params->interval_max,
|
||||
params->channel_map, params->own_addr_type, params->peer_addr_type,
|
||||
params->peer_addr, params->filter_policy, params->tx_power,
|
||||
@@ -411,6 +422,7 @@ tBTM_STATUS BTM_BleSetExtendedAdvParams(UINT8 instance, tBTM_BLE_GAP_EXT_ADV_PAR
|
||||
status = BTM_HCI_ERROR | err;
|
||||
goto end;
|
||||
}
|
||||
#endif // (BT_BLE_FEAT_ADV_CODING_SELECTION == TRUE)
|
||||
|
||||
extend_adv_cb.inst[instance].configured = true;
|
||||
|
||||
@@ -692,7 +704,6 @@ tBTM_STATUS BTM_BlePeriodicAdvSetParams(UINT8 instance, tBTM_BLE_Periodic_Adv_Pa
|
||||
tBTM_STATUS status = BTM_SUCCESS;
|
||||
tHCI_STATUS err = HCI_SUCCESS;
|
||||
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
|
||||
//ext_adv_flag = true;
|
||||
|
||||
if (instance >= MAX_BLE_ADV_INSTANCE) {
|
||||
status = BTM_ILLEGAL_VALUE;
|
||||
|
||||
@@ -1221,7 +1221,55 @@ UINT8 btsnd_hcic_ble_set_extend_rand_address(UINT8 adv_handle, BD_ADDR rand_addr
|
||||
return btu_hcif_send_cmd_sync (LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
|
||||
}
|
||||
#if (BT_BLE_FEAT_ADV_CODING_SELECTION == TRUE)
|
||||
UINT8 btsnd_hcic_ble_set_ext_adv_params_v2(UINT8 adv_handle, UINT16 properties, UINT32 interval_min,
|
||||
UINT32 interval_max, UINT8 channel_map, UINT8 own_addr_type,
|
||||
UINT8 peer_addr_type, BD_ADDR peer_addr,
|
||||
UINT8 adv_filter_policy, INT8 adv_tx_power,
|
||||
UINT8 primary_adv_phy, UINT8 secondary_adv_max_skip,
|
||||
UINT8 secondary_adv_phy,
|
||||
UINT8 adv_sid, UINT8 scan_req_ntf_enable,
|
||||
UINT8 primary_adv_phy_options, UINT8 secondary_adv_phy_options)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
|
||||
|
||||
HCI_TRACE_EVENT("%s, adv_handle = %d, properties = %d, interval_min = %d, interval_max = %d, channel_map = %d,\n\
|
||||
own_addr_type = %d, peer_addr_type = %d, adv_filter_policy = %d,\n\
|
||||
adv_tx_power = %d, primary_adv_phy = %d, secondary_adv_max_skip = %d, secondary_adv_phy = %d,\n\
|
||||
adv_sid = %d, scan_req_ntf_enable = %d, primary_phy_options %d secondary_phy_options %d", __func__, adv_handle, properties, interval_min, interval_max,
|
||||
channel_map, own_addr_type, peer_addr_type, adv_filter_policy, adv_tx_power,
|
||||
primary_adv_phy, secondary_adv_max_skip, secondary_adv_phy, adv_sid, scan_req_ntf_enable,
|
||||
primary_adv_phy_options, secondary_adv_phy_options);
|
||||
|
||||
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_EXT_ADV_SET_PARAMS + 2);
|
||||
|
||||
UINT16_TO_STREAM(pp, HCI_BLE_SET_EXT_ADV_PARAM_V2);
|
||||
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_EXT_ADV_SET_PARAMS + 2);
|
||||
|
||||
UINT8_TO_STREAM(pp, adv_handle);
|
||||
UINT16_TO_STREAM(pp, properties);
|
||||
UINT24_TO_STREAM(pp, interval_min);
|
||||
UINT24_TO_STREAM(pp, interval_max);
|
||||
UINT8_TO_STREAM(pp, channel_map);
|
||||
UINT8_TO_STREAM(pp, own_addr_type);
|
||||
UINT8_TO_STREAM(pp, peer_addr_type);
|
||||
BDADDR_TO_STREAM (pp, peer_addr);
|
||||
UINT8_TO_STREAM(pp, adv_filter_policy);
|
||||
INT8_TO_STREAM(pp, adv_tx_power);
|
||||
UINT8_TO_STREAM(pp, primary_adv_phy);
|
||||
UINT8_TO_STREAM(pp, secondary_adv_max_skip);
|
||||
UINT8_TO_STREAM(pp, secondary_adv_phy);
|
||||
UINT8_TO_STREAM(pp, adv_sid);
|
||||
UINT8_TO_STREAM(pp, scan_req_ntf_enable);
|
||||
UINT8_TO_STREAM(pp, primary_adv_phy_options);
|
||||
UINT8_TO_STREAM(pp, secondary_adv_phy_options);
|
||||
|
||||
return btu_hcif_send_cmd_sync (LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
}
|
||||
|
||||
#else
|
||||
UINT8 btsnd_hcic_ble_set_ext_adv_params(UINT8 adv_handle, UINT16 properties, UINT32 interval_min,
|
||||
UINT32 interval_max, UINT8 channel_map, UINT8 own_addr_type,
|
||||
UINT8 peer_addr_type, BD_ADDR peer_addr,
|
||||
@@ -1264,8 +1312,7 @@ UINT8 btsnd_hcic_ble_set_ext_adv_params(UINT8 adv_handle, UINT16 properties, UIN
|
||||
|
||||
return btu_hcif_send_cmd_sync (LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
}
|
||||
|
||||
bool ext_adv_flag = false;
|
||||
#endif // #if (BT_BLE_FEAT_ADV_CODING_SELECTION == TRUE)
|
||||
|
||||
UINT8 btsnd_hcic_ble_set_ext_adv_data(UINT8 adv_handle,
|
||||
UINT8 operation, UINT8 fragment_prefrence,
|
||||
@@ -1275,7 +1322,6 @@ UINT8 btsnd_hcic_ble_set_ext_adv_data(UINT8 adv_handle,
|
||||
UINT8 *pp;
|
||||
HCI_TRACE_EVENT("%s, adv_handle = %d, operation = %d, fragment_prefrence = %d,\
|
||||
data_len = %d", __func__, adv_handle, operation, fragment_prefrence, data_len);
|
||||
ext_adv_flag = true;
|
||||
|
||||
HCIC_BLE_CMD_CREATED(p, pp, data_len + 4);
|
||||
UINT16_TO_STREAM(pp, HCI_BLE_SET_EXT_ADV_DATA);
|
||||
|
||||
@@ -781,6 +781,10 @@ typedef struct {
|
||||
tBTM_BLE_GAP_PHY secondary_phy;
|
||||
UINT8 sid;
|
||||
BOOLEAN scan_req_notif;
|
||||
#if (BT_BLE_FEAT_ADV_CODING_SELECTION == TRUE)
|
||||
UINT8 primary_adv_phy_options;
|
||||
UINT8 secondary_adv_phy_options;
|
||||
#endif // (BT_BLE_FEAT_ADV_CODING_SELECTION == TRUE)
|
||||
} tBTM_BLE_GAP_EXT_ADV_PARAMS;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -443,6 +443,10 @@
|
||||
#define HCI_BLE_SUBRATE_REQUEST (0x007E | HCI_GRP_BLE_CMDS)
|
||||
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_ADV_CODING_SELECTION == TRUE)
|
||||
#define HCI_BLE_SET_EXT_ADV_PARAM_V2 (0x007F | HCI_GRP_BLE_CMDS)
|
||||
#endif // (BT_BLE_FEAT_ADV_CODING_SELECTION == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
#define HCI_BLE_SET_PERIOD_ADV_SUBEVT_DATA (0x0082 | HCI_GRP_BLE_CMDS)
|
||||
#define HCI_BLE_SET_PERIOD_ADV_RSP_DATA (0x0083 | HCI_GRP_BLE_CMDS)
|
||||
|
||||
@@ -1265,4 +1265,15 @@ UINT8 btsnd_hcic_ble_set_periodic_adv_rsp_data(UINT16 sync_handle, UINT16 req_ev
|
||||
UINT8 btsnd_hcic_ble_set_periodic_sync_subevt(UINT16 sync_handle, UINT16 periodic_adv_properties, UINT8 num_subevents_to_sync, UINT8 *subevt);
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_ADV_CODING_SELECTION == TRUE)
|
||||
UINT8 btsnd_hcic_ble_set_ext_adv_params_v2(UINT8 adv_handle, UINT16 properties, UINT32 interval_min,
|
||||
UINT32 interval_max, UINT8 channel_map, UINT8 own_addr_type,
|
||||
UINT8 peer_addr_type, BD_ADDR peer_addr,
|
||||
UINT8 adv_filter_policy, INT8 adv_tx_power,
|
||||
UINT8 primary_adv_phy, UINT8 secondary_adv_max_skip,
|
||||
UINT8 secondary_adv_phy,
|
||||
UINT8 adv_sid, UINT8 scan_req_ntf_enable,
|
||||
UINT8 primary_adv_phy_options, UINT8 secondary_adv_phy_options);
|
||||
#endif // (BT_BLE_FEAT_ADV_CODING_SELECTION == TRUE)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user