mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-17 07:09:37 +00:00
feat(bt/bluedroid): Support ble create sync report disable and filter duplicate
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <string.h>
|
||||
#include "l2c_int.h"
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#define SET_BIT(t, n) (t |= 1UL << (n))
|
||||
tBTM_BLE_EXTENDED_CB extend_adv_cb;
|
||||
|
||||
tBTM_BLE_5_HCI_CBACK ble_5_hci_cb;
|
||||
@@ -786,14 +787,32 @@ tBTM_STATUS BTM_BlePeriodicAdvCreateSync(tBTM_BLE_Periodic_Sync_Params *params)
|
||||
}
|
||||
|
||||
if ((params->sync_timeout < 0x0a || params->sync_timeout > 0x4000)
|
||||
|| (params->filter_policy > 0x01) || (params->addr_type > 0x01) ||
|
||||
|| (params->filter_policy > 0x01)
|
||||
#if (CONFIG_BT_BLE_FEAT_CREATE_SYNC_ENH)
|
||||
|| (params->reports_disabled > 0x01)
|
||||
|| (params->filter_duplicates > 0x01)
|
||||
#endif
|
||||
|| (params->addr_type > 0x01) ||
|
||||
(params->sid > 0xf) || (params->skip > 0x01F3)) {
|
||||
status = BTM_ILLEGAL_VALUE;
|
||||
BTM_TRACE_ERROR("%s, The sync parameters is invalid.", __func__);
|
||||
goto end;
|
||||
}
|
||||
uint8_t option = 0x00;
|
||||
if (params->filter_policy) {
|
||||
SET_BIT(option, 0);
|
||||
}
|
||||
|
||||
if (!btsnd_hcic_ble_periodic_adv_create_sync(params->filter_policy, params->sid, params->addr_type,
|
||||
#if (CONFIG_BT_BLE_FEAT_CREATE_SYNC_ENH)
|
||||
if (params->reports_disabled) {
|
||||
SET_BIT(option, 1);
|
||||
}
|
||||
if (params->filter_duplicates) {
|
||||
SET_BIT(option, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!btsnd_hcic_ble_periodic_adv_create_sync(option, params->sid, params->addr_type,
|
||||
params->addr, params->sync_timeout, 0)) {
|
||||
BTM_TRACE_ERROR("LE PA CreateSync cmd failed");
|
||||
status = BTM_ILLEGAL_VALUE;
|
||||
|
@@ -1623,14 +1623,14 @@ 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,
|
||||
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)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
HCI_TRACE_EVENT("%s, filter_policy = %d, adv_sid = %d, adv_addr_type = %d, sync_timeout = %d, unused = %d",
|
||||
__func__, filter_policy, adv_sid, adv_addr_type, sync_timeout, unused);
|
||||
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("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;
|
||||
@@ -1638,7 +1638,7 @@ BOOLEAN btsnd_hcic_ble_periodic_adv_create_sync(UINT8 filter_policy, UINT8 adv_s
|
||||
|
||||
UINT16_TO_STREAM(pp, HCI_BLE_PERIOD_ADV_CREATE_SYNC);
|
||||
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_PERIODIC_ADV_CREATE_SYNC + 2);
|
||||
UINT8_TO_STREAM(pp, filter_policy);
|
||||
UINT8_TO_STREAM(pp, option);
|
||||
UINT8_TO_STREAM(pp, adv_sid);
|
||||
UINT8_TO_STREAM(pp, adv_addr_type);
|
||||
BDADDR_TO_STREAM(pp, adv_addr);
|
||||
|
@@ -809,6 +809,10 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
UINT8 filter_policy;
|
||||
#if (CONFIG_BT_BLE_FEAT_CREATE_SYNC_ENH)
|
||||
UINT8 reports_disabled;
|
||||
UINT8 filter_duplicates;
|
||||
#endif
|
||||
UINT8 sid;
|
||||
tBLE_ADDR_TYPE addr_type;
|
||||
BD_ADDR addr;
|
||||
|
Reference in New Issue
Block a user