mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
feat(ble/bluedroid): Add bluedroid host PAwR feature
This commit is contained in:
@@ -710,11 +710,20 @@ tBTM_STATUS BTM_BlePeriodicAdvSetParams(UINT8 instance, tBTM_BLE_Periodic_Adv_Pa
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((err= btsnd_hcic_ble_set_periodic_adv_params(instance, params->interval_min,
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
if ((err = btsnd_hcic_ble_set_periodic_adv_params_v2(instance, params->interval_min, params->interval_max,
|
||||
params->properties, params->num_subevents, params->subevent_interval,
|
||||
params->rsp_slot_delay, params->rsp_slot_spacing, params->num_rsp_slots)) != HCI_SUCCESS) {
|
||||
BTM_TRACE_ERROR("LE PA SetParams_V2: cmd err=0x%x", err);
|
||||
status = BTM_HCI_ERROR | err;
|
||||
}
|
||||
#else
|
||||
if ((err = btsnd_hcic_ble_set_periodic_adv_params(instance, params->interval_min,
|
||||
params->interval_max, params->properties)) != HCI_SUCCESS) {
|
||||
BTM_TRACE_ERROR("LE PA SetParams: cmd err=0x%x", err);
|
||||
status = BTM_HCI_ERROR | err;
|
||||
}
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
end:
|
||||
|
||||
@@ -1740,3 +1749,67 @@ tBTM_STATUS BTM_BleSetHostFeature(uint16_t bit_num, uint8_t bit_val)
|
||||
return status;
|
||||
}
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
void BTM_BleSetPaSubeventData(UINT8 adv_handle, UINT8 num_subevents_with_data, uint8_t *subevent_params)
|
||||
{
|
||||
tBTM_STATUS status = BTM_SUCCESS;
|
||||
tHCI_STATUS err = HCI_SUCCESS;
|
||||
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);
|
||||
status = BTM_HCI_ERROR | err;
|
||||
}
|
||||
|
||||
cb_params.pa_subevt_data_evt.status = status;
|
||||
cb_params.pa_subevt_data_evt.adv_handle = adv_handle;
|
||||
|
||||
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_SET_PERIODIC_ADV_SUBEVT_DATA_EVT, &cb_params);
|
||||
}
|
||||
|
||||
void BTM_BleSetPaResponseData(UINT16 sync_handle, UINT16 req_evt, UINT8 req_subevt, UINT8 rsp_subevt, UINT8 rsp_slot, UINT8 rsp_data_len, UINT8 *rsp_data)
|
||||
{
|
||||
tBTM_STATUS status = BTM_SUCCESS;
|
||||
tHCI_STATUS err = HCI_SUCCESS;
|
||||
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
|
||||
|
||||
if ((err = btsnd_hcic_ble_set_periodic_adv_rsp_data(sync_handle, req_evt, req_subevt, rsp_subevt, rsp_slot, rsp_data_len, rsp_data)) != HCI_SUCCESS) {
|
||||
BTM_TRACE_ERROR("%s cmd err = 0x%x", __func__, err);
|
||||
status = BTM_HCI_ERROR | err;
|
||||
}
|
||||
|
||||
cb_params.pa_rsp_data_evt.status = status;
|
||||
cb_params.pa_rsp_data_evt.sync_handle = sync_handle;
|
||||
|
||||
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_SET_PERIODIC_ADV_RESPONSE_DATA_EVT, &cb_params);
|
||||
}
|
||||
|
||||
void BTM_BleSetPaSyncSubevt(UINT16 sync_handle, UINT16 periodic_adv_properties, UINT8 num_subevents_to_sync, UINT8 *subevt)
|
||||
{
|
||||
tBTM_STATUS status = BTM_SUCCESS;
|
||||
tHCI_STATUS err = HCI_SUCCESS;
|
||||
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
|
||||
|
||||
if ((err = btsnd_hcic_ble_set_periodic_sync_subevt(sync_handle, periodic_adv_properties, num_subevents_to_sync, subevt)) != HCI_SUCCESS) {
|
||||
BTM_TRACE_ERROR("%s cmd err = 0x%x", __func__, err);
|
||||
status = BTM_HCI_ERROR | err;
|
||||
}
|
||||
|
||||
cb_params.pa_sync_subevt_evt.status = status;
|
||||
cb_params.pa_sync_subevt_evt.sync_handle = sync_handle;
|
||||
|
||||
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_SET_PERIODIC_SYNC_SUBEVT_EVT, &cb_params);
|
||||
}
|
||||
|
||||
void btm_ble_pa_subevt_data_req_evt(tBTM_BLE_PA_SUBEVT_DATA_REQ_EVT *params)
|
||||
{
|
||||
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_PERIODIC_ADV_SUBEVT_DATA_REQUEST_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)params);
|
||||
}
|
||||
|
||||
void btm_ble_pa_rsp_rpt_evt(tBTM_BLE_PA_RSP_REPORT_EVT *params)
|
||||
{
|
||||
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_PERIODIC_ADV_RESPONSE_REPORT_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)params);
|
||||
}
|
||||
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
@@ -606,6 +606,10 @@ void btm_ble_transmit_power_report_evt(tBTM_BLE_TRANS_POWER_REPORT_EVT *params);
|
||||
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
|
||||
void btm_ble_subrate_change_evt(tBTM_BLE_SUBRATE_CHANGE_EVT *params);
|
||||
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
void btm_ble_pa_subevt_data_req_evt(tBTM_BLE_PA_SUBEVT_DATA_REQ_EVT *params);
|
||||
void btm_ble_pa_rsp_rpt_evt(tBTM_BLE_PA_RSP_REPORT_EVT *params);
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -161,8 +161,8 @@ static void btu_ble_phy_update_complete_evt(UINT8 *p);
|
||||
static void btu_ble_ext_adv_report_evt(UINT8 *p, UINT16 evt_len);
|
||||
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
static void btu_ble_periodic_adv_sync_establish_evt(UINT8 *p);
|
||||
static void btu_ble_periodic_adv_report_evt(UINT8 *p, UINT8 evt_len);
|
||||
static void btu_ble_periodic_adv_sync_establish_evt(UINT8 *p, bool v2_evt);
|
||||
static void btu_ble_periodic_adv_report_evt(UINT8 *p, UINT8 evt_len, bool v2_evt);
|
||||
static void btu_ble_periodic_adv_sync_lost_evt(UINT8 *p);
|
||||
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
|
||||
@@ -202,7 +202,7 @@ static void btu_ble_accept_cis_req_cmd_status(UINT8 status);
|
||||
static void btu_ble_cis_request_evt(UINT8 *p);
|
||||
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
|
||||
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
|
||||
static void btu_ble_cis_established_evt(UINT8 *p);
|
||||
static void btu_ble_cis_established_evt(UINT8 *p, bool v2_evt);
|
||||
static void btu_ble_cis_disconnected(UINT16 handle, UINT8 reason);
|
||||
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
|
||||
|
||||
@@ -228,6 +228,11 @@ static void btu_ble_transmit_power_report_evt(UINT8 *p);
|
||||
static void btu_ble_subrate_change_evt(UINT8 *p);
|
||||
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
static void btu_ble_pa_subevt_data_request_evt(UINT8 *p);
|
||||
static void btu_ble_pa_response_report_evt(UINT8 *p);
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
#if (BLE_42_ADV_EN == TRUE)
|
||||
extern osi_sem_t adv_enable_sem;
|
||||
extern osi_sem_t adv_data_sem;
|
||||
@@ -493,10 +498,16 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
|
||||
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
case HCI_BLE_PERIOD_ADV_SYNC_ESTAB_EVT:
|
||||
btu_ble_periodic_adv_sync_establish_evt(p);
|
||||
btu_ble_periodic_adv_sync_establish_evt(p, false);
|
||||
break;
|
||||
case HCI_BLE_PERIOD_ADV_SYNC_ESTAB_EVT_V2:
|
||||
btu_ble_periodic_adv_sync_establish_evt(p, true);
|
||||
break;
|
||||
case HCI_BLE_PERIOD_ADV_REPORT_EVT:
|
||||
btu_ble_periodic_adv_report_evt(p, hci_evt_len);
|
||||
btu_ble_periodic_adv_report_evt(p, hci_evt_len, false);
|
||||
break;
|
||||
case HCI_BLE_PERIOD_ADV_REPORT_EVT_V2:
|
||||
btu_ble_periodic_adv_report_evt(p, hci_evt_len, true);
|
||||
break;
|
||||
case HCI_BLE_PERIOD_ADV_SYNC_LOST_EVT:
|
||||
btu_ble_periodic_adv_sync_lost_evt(p);
|
||||
@@ -527,8 +538,10 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
|
||||
#if (BLE_FEAT_ISO_EN == TRUE)
|
||||
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
|
||||
case HCI_BLE_CIS_ESTABLISHED_V1_EVT:
|
||||
btu_ble_cis_established_evt(p, false);
|
||||
break;
|
||||
case HCI_BLE_CIS_ESTABLISHED_V2_EVT:
|
||||
btu_ble_cis_established_evt(p);
|
||||
btu_ble_cis_established_evt(p, true);
|
||||
break;
|
||||
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
|
||||
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
|
||||
@@ -586,6 +599,14 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
|
||||
btu_ble_subrate_change_evt(p);
|
||||
break;
|
||||
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
case HCI_BLE_PA_SUBEVT_DATA_REQUEST_EVT:
|
||||
btu_ble_pa_subevt_data_request_evt(p);
|
||||
break;
|
||||
case HCI_BLE_PA_RESPONSE_REPORT_EVT:
|
||||
btu_ble_pa_response_report_evt(p);
|
||||
break;
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
}
|
||||
break;
|
||||
#endif /* BLE_INCLUDED */
|
||||
@@ -2540,7 +2561,7 @@ static void btu_ble_ext_adv_report_evt(UINT8 *p, UINT16 evt_len)
|
||||
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
|
||||
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
static void btu_ble_periodic_adv_sync_establish_evt(UINT8 *p)
|
||||
static void btu_ble_periodic_adv_sync_establish_evt(UINT8 *p, bool v2_evt)
|
||||
{
|
||||
tBTM_BLE_PERIOD_ADV_SYNC_ESTAB sync_estab = {0};
|
||||
|
||||
@@ -2557,15 +2578,24 @@ static void btu_ble_periodic_adv_sync_establish_evt(UINT8 *p)
|
||||
STREAM_TO_UINT8(sync_estab.adv_phy, p);
|
||||
STREAM_TO_UINT16(sync_estab.period_adv_interval, p);
|
||||
STREAM_TO_UINT8(sync_estab.adv_clk_accuracy, p);
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
if (v2_evt) {
|
||||
STREAM_TO_UINT8(sync_estab.num_subevt, p);
|
||||
STREAM_TO_UINT8(sync_estab.subevt_interval, p);
|
||||
STREAM_TO_UINT8(sync_estab.rsp_slot_delay, p);
|
||||
STREAM_TO_UINT8(sync_estab.rsp_slot_spacing, p);
|
||||
}
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
btm_ble_periodic_adv_sync_establish_evt(&sync_estab);
|
||||
}
|
||||
|
||||
static void btu_ble_periodic_adv_report_evt(UINT8 *p, UINT8 evt_len)
|
||||
static void btu_ble_periodic_adv_report_evt(UINT8 *p, UINT8 evt_len, bool v2_evt)
|
||||
{
|
||||
tBTM_PERIOD_ADV_REPORT adv_report = {0};
|
||||
/* This parameter is intended to be used in a future feature. */
|
||||
UINT8 unused = 0;
|
||||
UINT8 min_len = MIN_BLE_PERIODIC_ADV_REPORT_LEN;
|
||||
|
||||
if (!p) {
|
||||
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
|
||||
@@ -2581,10 +2611,17 @@ static void btu_ble_periodic_adv_report_evt(UINT8 *p, UINT8 evt_len)
|
||||
STREAM_TO_UINT8(adv_report.tx_power, p);
|
||||
STREAM_TO_UINT8(adv_report.rssi, p);
|
||||
STREAM_TO_UINT8(adv_report.cte_type, p);
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
if (v2_evt) {
|
||||
STREAM_TO_UINT16(adv_report.periodic_evt_cnt, p);
|
||||
STREAM_TO_UINT8(adv_report.subevt, p);
|
||||
min_len += 3;
|
||||
}
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
STREAM_TO_UINT8(adv_report.data_status, p);
|
||||
STREAM_TO_UINT8(adv_report.data_length, p);
|
||||
|
||||
if ((evt_len - MIN_BLE_PERIODIC_ADV_REPORT_LEN) != adv_report.data_length) {
|
||||
if ((evt_len - min_len) != adv_report.data_length) {
|
||||
HCI_TRACE_ERROR("%s, Invalid ev_len = %d is less than adv len = %d", __func__, evt_len, adv_report.data_length);
|
||||
return;
|
||||
}
|
||||
@@ -2742,7 +2779,7 @@ static void btu_ble_cis_disconnected(UINT16 handle, UINT8 reason)
|
||||
btm_ble_cis_disconnected_evt(&cis_disconnected_evt);
|
||||
}
|
||||
|
||||
static void btu_ble_cis_established_evt(UINT8 *p)
|
||||
static void btu_ble_cis_established_evt(UINT8 *p, bool v2_evt)
|
||||
{
|
||||
HCI_TRACE_DEBUG("%s", __func__);
|
||||
tBTM_BLE_CIS_ESTABLISHED_CMPL cis_estab_evt = {0};
|
||||
@@ -2769,12 +2806,14 @@ static void btu_ble_cis_established_evt(UINT8 *p)
|
||||
STREAM_TO_UINT16(cis_estab_evt.max_pdu_p_to_c, p);
|
||||
STREAM_TO_UINT16(cis_estab_evt.iso_interval, p);
|
||||
#if (BLE_FEAT_ISO_60_EN == TRUE)
|
||||
STREAM_TO_UINT24(cis_estab_evt.sub_interval, p);
|
||||
STREAM_TO_UINT16(cis_estab_evt.max_sdu_c_to_p, p);
|
||||
STREAM_TO_UINT16(cis_estab_evt.max_sdu_p_to_c, p);
|
||||
STREAM_TO_UINT24(cis_estab_evt.sdu_int_c_to_p, p);
|
||||
STREAM_TO_UINT24(cis_estab_evt.sdu_int_p_to_c, p);
|
||||
STREAM_TO_UINT8(cis_estab_evt.framing, p);
|
||||
if (v2_evt) {
|
||||
STREAM_TO_UINT24(cis_estab_evt.sub_interval, p);
|
||||
STREAM_TO_UINT16(cis_estab_evt.max_sdu_c_to_p, p);
|
||||
STREAM_TO_UINT16(cis_estab_evt.max_sdu_p_to_c, p);
|
||||
STREAM_TO_UINT24(cis_estab_evt.sdu_int_c_to_p, p);
|
||||
STREAM_TO_UINT24(cis_estab_evt.sdu_int_p_to_c, p);
|
||||
STREAM_TO_UINT8(cis_estab_evt.framing, p);
|
||||
}
|
||||
#endif // #if (BLE_FEAT_ISO_60_EN == TRUE)
|
||||
|
||||
btm_ble_cis_established_evt(&cis_estab_evt);
|
||||
@@ -3084,6 +3123,74 @@ static void btu_ble_subrate_change_evt(UINT8 *p)
|
||||
}
|
||||
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
static void btu_ble_pa_subevt_data_request_evt(UINT8 *p)
|
||||
{
|
||||
tBTM_BLE_PA_SUBEVT_DATA_REQ_EVT pa_subevt_req_evt = {0};
|
||||
if (!p) {
|
||||
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
STREAM_TO_UINT8(pa_subevt_req_evt.adv_handle, p);
|
||||
STREAM_TO_UINT8(pa_subevt_req_evt.subevt_start, p);
|
||||
STREAM_TO_UINT8(pa_subevt_req_evt.subevt_data_count, p);
|
||||
|
||||
btm_ble_pa_subevt_data_req_evt(&pa_subevt_req_evt);
|
||||
}
|
||||
|
||||
static void btu_ble_pa_response_report_evt(UINT8 *p)
|
||||
{
|
||||
tBTM_BLE_PA_RSP_REPORT_EVT pa_rsp_rpt_evt = {0};
|
||||
if (!p) {
|
||||
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.adv_handle, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.subevt, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.tx_status, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.num_rsp, p);
|
||||
|
||||
pa_rsp_rpt_evt.rsp_data_info = osi_malloc(pa_rsp_rpt_evt.num_rsp * sizeof(tBTM_BLE_PA_RSP_DATA_INFO));
|
||||
if (pa_rsp_rpt_evt.rsp_data_info)
|
||||
{
|
||||
for (UINT8 i = 0; i < pa_rsp_rpt_evt.num_rsp; i++)
|
||||
{
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].tx_power, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].rssi, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].cte_type, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].rsp_slot, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].data_status, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].data_len, p);
|
||||
if (pa_rsp_rpt_evt.rsp_data_info[i].data_len) {
|
||||
pa_rsp_rpt_evt.rsp_data_info[i].data = osi_malloc(pa_rsp_rpt_evt.rsp_data_info[i].data_len);
|
||||
if (pa_rsp_rpt_evt.rsp_data_info[i].data) {
|
||||
STREAM_TO_ARRAY(pa_rsp_rpt_evt.rsp_data_info[i].data, p, pa_rsp_rpt_evt.rsp_data_info[i].data_len);
|
||||
} else {
|
||||
HCI_TRACE_ERROR("%s, no enough memory.", __func__);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
HCI_TRACE_ERROR("%s, no memory.", __func__);
|
||||
}
|
||||
|
||||
btm_ble_pa_rsp_rpt_evt(&pa_rsp_rpt_evt);
|
||||
|
||||
if (pa_rsp_rpt_evt.rsp_data_info)
|
||||
{
|
||||
for (UINT8 i = 0; i < pa_rsp_rpt_evt.num_rsp; i++)
|
||||
{
|
||||
if (pa_rsp_rpt_evt.rsp_data_info[i].data) {
|
||||
osi_free(pa_rsp_rpt_evt.rsp_data_info[i].data);
|
||||
}
|
||||
}
|
||||
osi_free(pa_rsp_rpt_evt.rsp_data_info);
|
||||
}
|
||||
}
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
/**********************************************
|
||||
** End of BLE Events Handler
|
||||
***********************************************/
|
||||
|
||||
@@ -1427,10 +1427,40 @@ UINT8 btsnd_hcic_ble_clear_adv_set(void)
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
|
||||
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
UINT8 btsnd_hcic_ble_set_periodic_adv_params_v2(UINT8 adv_handle, UINT16 interval_min, UINT16 interval_max,
|
||||
UINT16 propertics, UINT8 num_subevents, UINT8 subevent_interval,
|
||||
UINT8 rsp_slot_delay, UINT8 rsp_slot_spacing, UINT8 num_rsp_slots)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
HCI_TRACE_EVENT("%s, adv_handle = %d, interval_min = %d, interval_max = %d, propertics = %d num_subevents = %d subevent_interval = %d rsp_slot_delay %d rsp_slot_spacing %d num_rsp_slots %d",
|
||||
__func__, adv_handle, interval_min, interval_max, propertics, num_subevents, subevent_interval, rsp_slot_delay, rsp_slot_spacing, num_rsp_slots);
|
||||
|
||||
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_PERIODIC_ADV_PARAMS_V2);
|
||||
|
||||
UINT16_TO_STREAM(pp, HCI_BLE_SET_PERIOD_ADV_PARAMS_V2);
|
||||
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_PERIODIC_ADV_PARAMS_V2);
|
||||
|
||||
UINT8_TO_STREAM(pp, adv_handle);
|
||||
UINT16_TO_STREAM(pp, interval_min);
|
||||
UINT16_TO_STREAM(pp, interval_max);
|
||||
UINT16_TO_STREAM(pp, propertics);
|
||||
UINT8_TO_STREAM(pp, num_subevents);
|
||||
UINT8_TO_STREAM(pp, subevent_interval);
|
||||
UINT8_TO_STREAM(pp, rsp_slot_delay);
|
||||
UINT8_TO_STREAM(pp, rsp_slot_spacing);
|
||||
UINT8_TO_STREAM(pp, num_rsp_slots);
|
||||
|
||||
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
UINT8 btsnd_hcic_ble_set_periodic_adv_params(UINT8 adv_handle,
|
||||
UINT16 interval_min,
|
||||
UINT16 interval_max,
|
||||
UINT8 propertics)
|
||||
UINT16 propertics)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
@@ -1451,6 +1481,9 @@ UINT8 btsnd_hcic_ble_set_periodic_adv_params(UINT8 adv_handle,
|
||||
|
||||
}
|
||||
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
|
||||
UINT8 btsnd_hcic_ble_set_periodic_adv_data(UINT8 adv_handle,
|
||||
UINT8 operation,
|
||||
UINT8 len,
|
||||
@@ -2814,3 +2847,114 @@ UINT8 btsnd_hcic_ble_set_host_feature(uint16_t bit_num, uint8_t bit_val)
|
||||
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
}
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
UINT8 btsnd_hcic_ble_set_periodic_adv_subevt_data(UINT8 adv_handle, UINT8 num_subevents_with_data, ble_subevent_params *subevent_params)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
uint8_t param_len = 0;
|
||||
|
||||
HCI_TRACE_DEBUG("hci set PA subevent data, adv_handle %d num_subevents_with_data %d", adv_handle, num_subevents_with_data);
|
||||
|
||||
if (!subevent_params) {
|
||||
HCI_TRACE_ERROR("%s error\n", __func__);
|
||||
return HCI_ERR_ILLEGAL_PARAMETER_FMT;
|
||||
}
|
||||
param_len += HCIC_PARAM_SIZE_SET_PA_SUBEVT_DATA_PARAMS_LEN;
|
||||
|
||||
for (UINT8 i = 0; i < num_subevents_with_data; i++)
|
||||
{
|
||||
HCI_TRACE_DEBUG("subevent_params: subevent %d response_slot_start %d response_slot_count %d subevent_data_len %d",
|
||||
subevent_params[i].subevent, subevent_params[i].response_slot_start, subevent_params[i].response_slot_count,
|
||||
subevent_params[i].subevent_data_len);
|
||||
|
||||
if (subevent_params[i].subevent_data_len) {
|
||||
esp_log_buffer_hex_internal("data", subevent_params[i].data, subevent_params[i].subevent_data_len, ESP_LOG_DEBUG);
|
||||
}
|
||||
|
||||
param_len += (4 + subevent_params->subevent_data_len);
|
||||
}
|
||||
|
||||
HCIC_BLE_CMD_CREATED(p, pp, param_len);
|
||||
|
||||
pp = (UINT8 *)(p + 1);
|
||||
|
||||
UINT16_TO_STREAM(pp, HCI_BLE_SET_PERIOD_ADV_SUBEVT_DATA);
|
||||
UINT8_TO_STREAM(pp, param_len);
|
||||
|
||||
UINT8_TO_STREAM(pp, adv_handle);
|
||||
UINT8_TO_STREAM(pp, num_subevents_with_data);
|
||||
for (UINT8 i = 0; i < num_subevents_with_data; i++)
|
||||
{
|
||||
UINT8_TO_STREAM(pp, subevent_params[i].subevent);
|
||||
UINT8_TO_STREAM(pp, subevent_params[i].response_slot_start);
|
||||
UINT8_TO_STREAM(pp, subevent_params[i].response_slot_count);
|
||||
UINT8_TO_STREAM(pp, subevent_params[i].subevent_data_len);
|
||||
if (subevent_params[i].subevent_data_len) {
|
||||
ARRAY_TO_STREAM(pp, subevent_params[i].data, subevent_params[i].subevent_data_len);
|
||||
}
|
||||
}
|
||||
|
||||
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
}
|
||||
|
||||
UINT8 btsnd_hcic_ble_set_periodic_adv_rsp_data(UINT16 sync_handle, UINT16 req_evt, UINT8 req_subevt, UINT8 rsp_subevt, UINT8 rsp_slot, UINT8 rsp_data_len, UINT8 *rsp_data)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
|
||||
HCI_TRACE_DEBUG("hci set PA rsp data, sync_handle %d req_evt %d req_subevt %d rsp_subevt %d rsp_slot %d rsp_data_len %d",
|
||||
sync_handle, req_evt, req_subevt, rsp_subevt, rsp_slot, rsp_data_len);
|
||||
|
||||
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_PA_RESPONSE_DATA_PARAMS_LEN + rsp_data_len);
|
||||
|
||||
pp = (UINT8 *)(p + 1);
|
||||
|
||||
UINT16_TO_STREAM(pp, HCI_BLE_SET_PERIOD_ADV_RSP_DATA);
|
||||
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_PA_RESPONSE_DATA_PARAMS_LEN + rsp_data_len);
|
||||
|
||||
UINT16_TO_STREAM(pp, sync_handle);
|
||||
UINT16_TO_STREAM(pp, req_evt);
|
||||
UINT8_TO_STREAM(pp, req_subevt);
|
||||
UINT8_TO_STREAM(pp, rsp_subevt);
|
||||
UINT8_TO_STREAM(pp, rsp_slot);
|
||||
UINT8_TO_STREAM(pp, rsp_data_len);
|
||||
|
||||
if (rsp_data) {
|
||||
ARRAY_TO_STREAM(pp, rsp_data, rsp_data_len);
|
||||
}
|
||||
|
||||
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
}
|
||||
|
||||
UINT8 btsnd_hcic_ble_set_periodic_sync_subevt(UINT16 sync_handle, UINT16 periodic_adv_properties, UINT8 num_subevents_to_sync, UINT8 *subevt)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
|
||||
HCI_TRACE_DEBUG("hci set PA sync subevent, sync_handle %d periodic_adv_properties %d num_subevents_to_sync %d",
|
||||
sync_handle, periodic_adv_properties, num_subevents_to_sync);
|
||||
for (UINT8 i = 0; i < num_subevents_to_sync; i++)
|
||||
{
|
||||
HCI_TRACE_DEBUG("subevt[%d] = %d", i, subevt[i]);
|
||||
}
|
||||
|
||||
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_PA_SYNC_SUBEVT_PARAMS_LEN + num_subevents_to_sync);
|
||||
|
||||
pp = (UINT8 *)(p + 1);
|
||||
|
||||
UINT16_TO_STREAM(pp, HCI_BLE_SET_PERIOD_SYNC_SUBEVT);
|
||||
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_PA_SYNC_SUBEVT_PARAMS_LEN + num_subevents_to_sync);
|
||||
|
||||
UINT16_TO_STREAM(pp, sync_handle);
|
||||
UINT16_TO_STREAM(pp, periodic_adv_properties);
|
||||
UINT8_TO_STREAM(pp, num_subevents_to_sync);
|
||||
for (UINT8 i = 0; i < num_subevents_to_sync; i++)
|
||||
{
|
||||
UINT8_TO_STREAM(pp, subevt[i]);
|
||||
}
|
||||
|
||||
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
}
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
@@ -808,7 +808,14 @@ typedef struct {
|
||||
typedef struct {
|
||||
UINT16 interval_min;
|
||||
UINT16 interval_max;
|
||||
UINT8 properties;
|
||||
UINT16 properties;
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
UINT8 num_subevents;
|
||||
UINT8 subevent_interval;
|
||||
UINT8 rsp_slot_delay;
|
||||
UINT8 rsp_slot_spacing;
|
||||
UINT8 num_rsp_slots;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
} tBTM_BLE_Periodic_Adv_Params;
|
||||
|
||||
typedef struct {
|
||||
@@ -1090,7 +1097,14 @@ typedef void (tBTM_SET_VENDOR_EVT_MASK_CBACK) (tBTM_STATUS status);
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#define BTM_BLE_GAP_SET_HOST_FEATURE_EVT 51
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#define BTM_BLE_5_GAP_UNKNOWN_EVT 52
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
#define BTM_BLE_GAP_SET_PERIODIC_ADV_SUBEVT_DATA_EVT 52
|
||||
#define BTM_BLE_GAP_SET_PERIODIC_ADV_RESPONSE_DATA_EVT 53
|
||||
#define BTM_BLE_GAP_SET_PERIODIC_SYNC_SUBEVT_EVT 54
|
||||
#define BTM_BLE_GAP_PERIODIC_ADV_SUBEVT_DATA_REQUEST_EVT 55
|
||||
#define BTM_BLE_GAP_PERIODIC_ADV_RESPONSE_REPORT_EVT 56
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
#define BTM_BLE_5_GAP_UNKNOWN_EVT 57
|
||||
typedef UINT8 tBTM_BLE_5_GAP_EVENT;
|
||||
|
||||
#if (BLE_FEAT_ISO_EN == TRUE)
|
||||
@@ -1332,6 +1346,10 @@ typedef struct {
|
||||
UINT8 tx_power;
|
||||
INT8 rssi;
|
||||
UINT8 cte_type;
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
UINT16 periodic_evt_cnt;
|
||||
UINT8 subevt;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
tBTM_BLE_EXT_ADV_DATA_STATUS data_status;
|
||||
UINT8 data_length;
|
||||
UINT8 *data;
|
||||
@@ -1350,6 +1368,12 @@ typedef struct {
|
||||
UINT8 adv_phy;
|
||||
UINT16 period_adv_interval;
|
||||
UINT8 adv_clk_accuracy;
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
UINT8 num_subevt;
|
||||
UINT8 subevt_interval;
|
||||
UINT8 rsp_slot_delay;
|
||||
UINT8 rsp_slot_spacing;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
} tBTM_BLE_PERIOD_ADV_SYNC_ESTAB;
|
||||
|
||||
typedef struct {
|
||||
@@ -1453,6 +1477,44 @@ typedef struct {
|
||||
} __attribute__((packed)) tBTM_BLE_SUBRATE_CHANGE_EVT;
|
||||
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
typedef struct {
|
||||
UINT8 status;
|
||||
UINT8 adv_handle;
|
||||
} __attribute__((packed)) tBTM_BLE_PA_SUBEVT_DATA_EVT;
|
||||
typedef struct {
|
||||
UINT8 status;
|
||||
UINT16 sync_handle;
|
||||
} __attribute__((packed)) tBTM_BLE_PA_RSP_DATA_EVT;
|
||||
typedef struct {
|
||||
UINT8 status;
|
||||
UINT16 sync_handle;
|
||||
} __attribute__((packed)) tBTM_BLE_PA_SYNC_SUBEVT_DATA_EVT;
|
||||
typedef struct {
|
||||
UINT8 adv_handle;
|
||||
UINT8 subevt_start;
|
||||
UINT8 subevt_data_count;
|
||||
} __attribute__((packed)) tBTM_BLE_PA_SUBEVT_DATA_REQ_EVT;
|
||||
|
||||
typedef struct {
|
||||
INT8 tx_power;
|
||||
INT8 rssi;
|
||||
UINT8 cte_type;
|
||||
UINT8 rsp_slot;
|
||||
UINT8 data_status;
|
||||
UINT8 data_len;
|
||||
UINT8 *data;
|
||||
} __attribute__((packed)) tBTM_BLE_PA_RSP_DATA_INFO;
|
||||
|
||||
typedef struct {
|
||||
UINT8 adv_handle;
|
||||
UINT8 subevt;
|
||||
UINT8 tx_status;
|
||||
UINT8 num_rsp;
|
||||
tBTM_BLE_PA_RSP_DATA_INFO *rsp_data_info;
|
||||
} __attribute__((packed)) tBTM_BLE_PA_RSP_REPORT_EVT;
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
#if (BLE_FEAT_ISO_EN == TRUE)
|
||||
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
|
||||
typedef struct {
|
||||
@@ -1819,6 +1881,13 @@ typedef union {
|
||||
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
|
||||
tBTM_BLE_SUBRATE_CHANGE_EVT subrate_change_evt;
|
||||
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
tBTM_BLE_PA_SUBEVT_DATA_EVT pa_subevt_data_evt;
|
||||
tBTM_BLE_PA_RSP_DATA_EVT pa_rsp_data_evt;
|
||||
tBTM_BLE_PA_SYNC_SUBEVT_DATA_EVT pa_sync_subevt_evt;
|
||||
tBTM_BLE_PA_SUBEVT_DATA_REQ_EVT pa_subevent_data_req_evt;
|
||||
tBTM_BLE_PA_RSP_REPORT_EVT pa_rsp_rpt_evt;
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
} tBTM_BLE_5_GAP_CB_PARAMS;
|
||||
|
||||
typedef struct {
|
||||
@@ -3371,7 +3440,15 @@ void BTM_BleSetDefaultSubrate(UINT16 subrate_min, UINT16 subrate_max, UINT16 max
|
||||
void BTM_BleSubrateRequest(UINT16 conn_handle, UINT16 subrate_min, UINT16 subrate_max,
|
||||
UINT16 max_latency, UINT16 continuation_number, UINT16 supervision_timeout);
|
||||
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
tBTM_STATUS BTM_BleSetHostFeature(uint16_t bit_num, uint8_t bit_val);
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
void BTM_BleSetPaSubeventData(UINT8 adv_handle, UINT8 num_subevents_with_data, uint8_t *subevent_params);
|
||||
void BTM_BleSetPaResponseData(UINT16 sync_handle, UINT16 req_evt, UINT8 req_subevt, UINT8 rsp_subevt, UINT8 rsp_slot, UINT8 rsp_data_len, UINT8 *rsp_data);
|
||||
void BTM_BleSetPaSyncSubevt(UINT16 sync_handle, UINT16 periodic_adv_properties, UINT8 num_subevents_to_sync, UINT8 *subevt);
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -443,6 +443,13 @@
|
||||
#define HCI_BLE_SUBRATE_REQUEST (0x007E | HCI_GRP_BLE_CMDS)
|
||||
#endif // #if (BLE_FEAT_CONN_SUBRATING == 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)
|
||||
#define HCI_BLE_SET_PERIOD_SYNC_SUBEVT (0x0084 | HCI_GRP_BLE_CMDS)
|
||||
#define HCI_BLE_SET_PERIOD_ADV_PARAMS_V2 (0x0086 | HCI_GRP_BLE_CMDS)
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
// Vendor OGF define
|
||||
#define HCI_VENDOR_OGF 0x3F
|
||||
|
||||
@@ -918,6 +925,14 @@
|
||||
#define HCI_BLE_SUBRATE_CHANGE_EVT 0x23
|
||||
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
|
||||
|
||||
#define HCI_BLE_PERIOD_ADV_SYNC_ESTAB_EVT_V2 0x24
|
||||
#define HCI_BLE_PERIOD_ADV_REPORT_EVT_V2 0x25
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
#define HCI_BLE_PA_SUBEVT_DATA_REQUEST_EVT 0x27
|
||||
#define HCI_BLE_PA_RESPONSE_REPORT_EVT 0x28
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
/* Definitions for LE Channel Map */
|
||||
#define HCI_BLE_CHNL_MAP_SIZE 5
|
||||
|
||||
|
||||
@@ -1013,7 +1013,7 @@ UINT8 btsnd_hcic_ble_clear_adv_set(void);
|
||||
UINT8 btsnd_hcic_ble_set_periodic_adv_params(UINT8 adv_handle,
|
||||
UINT16 interval_min,
|
||||
UINT16 interval_max,
|
||||
UINT8 propertics);
|
||||
UINT16 propertics);
|
||||
|
||||
UINT8 btsnd_hcic_ble_set_periodic_adv_data(UINT8 adv_handle,
|
||||
UINT8 operation,
|
||||
@@ -1243,4 +1243,26 @@ UINT8 btsnd_hcic_ble_subrate_request(UINT16 conn_handle, UINT16 subrate_min, UIN
|
||||
UINT8 btsnd_hcic_ble_set_host_feature(uint16_t bit_num, uint8_t bit_val);
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
typedef struct {
|
||||
uint8_t subevent;
|
||||
uint8_t response_slot_start;
|
||||
uint8_t response_slot_count;
|
||||
uint8_t subevent_data_len;
|
||||
uint8_t data[251];
|
||||
} ble_subevent_params;
|
||||
|
||||
#define HCIC_PARAM_SIZE_SET_PA_SUBEVT_DATA_PARAMS_LEN 2
|
||||
#define HCIC_PARAM_SIZE_SET_PA_RESPONSE_DATA_PARAMS_LEN 8
|
||||
#define HCIC_PARAM_SIZE_SET_PA_SYNC_SUBEVT_PARAMS_LEN 5
|
||||
|
||||
#define HCIC_PARAM_SIZE_SET_PERIODIC_ADV_PARAMS_V2 12
|
||||
UINT8 btsnd_hcic_ble_set_periodic_adv_params_v2(UINT8 adv_handle, UINT16 interval_min, UINT16 interval_max,
|
||||
UINT16 propertics, UINT8 num_subevents, UINT8 subevent_interval,
|
||||
UINT8 rsp_slot_delay, UINT8 rsp_slot_spacing, UINT8 num_rsp_slots);
|
||||
UINT8 btsnd_hcic_ble_set_periodic_adv_subevt_data(UINT8 adv_handle, UINT8 num_subevents_with_data, ble_subevent_params *subevent_params);
|
||||
UINT8 btsnd_hcic_ble_set_periodic_adv_rsp_data(UINT16 sync_handle, UINT16 req_evt, UINT8 req_subevt, UINT8 rsp_subevt, UINT8 rsp_slot, UINT8 rsp_data_len, UINT8 *rsp_data);
|
||||
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)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user