mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(bt/bluedroid): Support periodic adv adi feature
This commit is contained in:
parent
997c2fd59c
commit
9c7626fab0
@ -1122,6 +1122,13 @@ config BT_BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER
|
|||||||
help
|
help
|
||||||
This enables BLE periodic advertising sync transfer feature
|
This enables BLE periodic advertising sync transfer feature
|
||||||
|
|
||||||
|
config BT_BLE_FEAT_PERIODIC_ADV_ENH
|
||||||
|
bool "Enable periodic adv enhancements(adi support)"
|
||||||
|
depends on (BT_BLUEDROID_ENABLED && BT_BLE_50_FEATURES_SUPPORTED && SOC_ESP_NIMBLE_CONTROLLER)
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enable the periodic advertising enhancements
|
||||||
|
|
||||||
config BT_BLE_HIGH_DUTY_ADV_INTERVAL
|
config BT_BLE_HIGH_DUTY_ADV_INTERVAL
|
||||||
bool "Enable BLE high duty advertising interval feature"
|
bool "Enable BLE high duty advertising interval feature"
|
||||||
depends on BT_BLUEDROID_ENABLED
|
depends on BT_BLUEDROID_ENABLED
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -1052,8 +1052,13 @@ esp_err_t esp_ble_gap_periodic_adv_set_params(uint8_t instance, const esp_ble_ga
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CONFIG_BT_BLE_FEAT_PERIODIC_ADV_ENH)
|
||||||
|
esp_err_t esp_ble_gap_config_periodic_adv_data_raw(uint8_t instance, uint16_t length,
|
||||||
|
const uint8_t *data, bool only_update_did)
|
||||||
|
#else
|
||||||
esp_err_t esp_ble_gap_config_periodic_adv_data_raw(uint8_t instance, uint16_t length,
|
esp_err_t esp_ble_gap_config_periodic_adv_data_raw(uint8_t instance, uint16_t length,
|
||||||
const uint8_t *data)
|
const uint8_t *data)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
btc_msg_t msg;
|
btc_msg_t msg;
|
||||||
btc_ble_5_gap_args_t arg;
|
btc_ble_5_gap_args_t arg;
|
||||||
@ -1067,13 +1072,22 @@ esp_err_t esp_ble_gap_config_periodic_adv_data_raw(uint8_t instance, uint16_t le
|
|||||||
arg.periodic_adv_cfg_data.instance = instance;
|
arg.periodic_adv_cfg_data.instance = instance;
|
||||||
arg.periodic_adv_cfg_data.len = length;
|
arg.periodic_adv_cfg_data.len = length;
|
||||||
arg.periodic_adv_cfg_data.data = (uint8_t *)data;
|
arg.periodic_adv_cfg_data.data = (uint8_t *)data;
|
||||||
|
#if (CONFIG_BT_BLE_FEAT_PERIODIC_ADV_ENH)
|
||||||
|
arg.periodic_adv_cfg_data.only_update_did = only_update_did;
|
||||||
|
#else
|
||||||
|
arg.periodic_adv_cfg_data.only_update_did = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), btc_gap_ble_arg_deep_copy,
|
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), btc_gap_ble_arg_deep_copy,
|
||||||
btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CONFIG_BT_BLE_FEAT_PERIODIC_ADV_ENH)
|
||||||
|
esp_err_t esp_ble_gap_periodic_adv_start(uint8_t instance,bool include_adi)
|
||||||
|
#else
|
||||||
esp_err_t esp_ble_gap_periodic_adv_start(uint8_t instance)
|
esp_err_t esp_ble_gap_periodic_adv_start(uint8_t instance)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
btc_msg_t msg;
|
btc_msg_t msg;
|
||||||
btc_ble_5_gap_args_t arg;
|
btc_ble_5_gap_args_t arg;
|
||||||
@ -1084,6 +1098,11 @@ esp_err_t esp_ble_gap_periodic_adv_start(uint8_t instance)
|
|||||||
msg.pid = BTC_PID_GAP_BLE;
|
msg.pid = BTC_PID_GAP_BLE;
|
||||||
msg.act = BTC_GAP_BLE_PERIODIC_ADV_START;
|
msg.act = BTC_GAP_BLE_PERIODIC_ADV_START;
|
||||||
|
|
||||||
|
#if (CONFIG_BT_BLE_FEAT_PERIODIC_ADV_ENH)
|
||||||
|
arg.periodic_adv_start.include_adi = include_adi;
|
||||||
|
#else
|
||||||
|
arg.periodic_adv_start.include_adi = false;
|
||||||
|
#endif
|
||||||
arg.periodic_adv_start.instance = instance;
|
arg.periodic_adv_start.instance = instance;
|
||||||
|
|
||||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL)
|
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL)
|
||||||
|
@ -1,16 +1,8 @@
|
|||||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
/*
|
||||||
//
|
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
*
|
||||||
// you may not use this file except in compliance with the License.
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
// You may obtain a copy of the License at
|
*/
|
||||||
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#ifndef __ESP_GAP_BLE_API_H__
|
#ifndef __ESP_GAP_BLE_API_H__
|
||||||
#define __ESP_GAP_BLE_API_H__
|
#define __ESP_GAP_BLE_API_H__
|
||||||
@ -2115,6 +2107,22 @@ esp_err_t esp_ble_gap_ext_adv_set_clear(void);
|
|||||||
*/
|
*/
|
||||||
esp_err_t esp_ble_gap_periodic_adv_set_params(uint8_t instance, const esp_ble_gap_periodic_adv_params_t *params);
|
esp_err_t esp_ble_gap_periodic_adv_set_params(uint8_t instance, const esp_ble_gap_periodic_adv_params_t *params);
|
||||||
|
|
||||||
|
#if (CONFIG_BT_BLE_FEAT_PERIODIC_ADV_ENH)
|
||||||
|
/**
|
||||||
|
* @brief This function is used to set the data used in periodic advertising PDUs.
|
||||||
|
*
|
||||||
|
* @param[in] instance : identifies the advertising set whose periodic advertising parameters are being configured.
|
||||||
|
* @param[in] length : the length of periodic data
|
||||||
|
* @param[in] data : periodic data information
|
||||||
|
* @param[in] only_update_did : If true, only the Advertising DID of the periodic advertising will be updated, and the length and data parameters will be ignored.
|
||||||
|
*
|
||||||
|
* @return - ESP_OK : success
|
||||||
|
* - other : failed
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
esp_err_t esp_ble_gap_config_periodic_adv_data_raw(uint8_t instance, uint16_t length,
|
||||||
|
const uint8_t *data, bool only_update_did);
|
||||||
|
#else
|
||||||
/**
|
/**
|
||||||
* @brief This function is used to set the data used in periodic advertising PDUs.
|
* @brief This function is used to set the data used in periodic advertising PDUs.
|
||||||
*
|
*
|
||||||
@ -2128,6 +2136,21 @@ esp_err_t esp_ble_gap_periodic_adv_set_params(uint8_t instance, const esp_ble_ga
|
|||||||
*/
|
*/
|
||||||
esp_err_t esp_ble_gap_config_periodic_adv_data_raw(uint8_t instance, uint16_t length,
|
esp_err_t esp_ble_gap_config_periodic_adv_data_raw(uint8_t instance, uint16_t length,
|
||||||
const uint8_t *data);
|
const uint8_t *data);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (CONFIG_BT_BLE_FEAT_PERIODIC_ADV_ENH)
|
||||||
|
/**
|
||||||
|
* @brief This function is used to request the Controller to enable the periodic advertising for the advertising set specified
|
||||||
|
*
|
||||||
|
* @param[in] instance : Used to identify an advertising set
|
||||||
|
* @param[in] include_adi : If true, the ADI (Advertising Data Info) field will be included in AUX_SYNC_IND PDUs
|
||||||
|
*
|
||||||
|
* @return - ESP_OK : success
|
||||||
|
* - other : failed
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
esp_err_t esp_ble_gap_periodic_adv_start(uint8_t instance,bool include_adi);
|
||||||
|
#else
|
||||||
/**
|
/**
|
||||||
* @brief This function is used to request the Controller to enable the periodic advertising for the advertising set specified
|
* @brief This function is used to request the Controller to enable the periodic advertising for the advertising set specified
|
||||||
*
|
*
|
||||||
@ -2138,6 +2161,7 @@ esp_err_t esp_ble_gap_config_periodic_adv_data_raw(uint8_t instance, uint16_t le
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
esp_err_t esp_ble_gap_periodic_adv_start(uint8_t instance);
|
esp_err_t esp_ble_gap_periodic_adv_start(uint8_t instance);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function is used to request the Controller to disable the periodic advertising for the advertising set specified
|
* @brief This function is used to request the Controller to disable the periodic advertising for the advertising set specified
|
||||||
|
@ -5714,7 +5714,8 @@ void bta_dm_ble_gap_periodic_adv_cfg_data_raw(tBTA_DM_MSG *p_data)
|
|||||||
|
|
||||||
BTM_BlePeriodicAdvCfgDataRaw(p_data->ble_cfg_periodic_adv_data.instance,
|
BTM_BlePeriodicAdvCfgDataRaw(p_data->ble_cfg_periodic_adv_data.instance,
|
||||||
p_data->ble_cfg_periodic_adv_data.length,
|
p_data->ble_cfg_periodic_adv_data.length,
|
||||||
p_data->ble_cfg_periodic_adv_data.data);
|
p_data->ble_cfg_periodic_adv_data.data,
|
||||||
|
p_data->ble_cfg_periodic_adv_data.only_update_did);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bta_dm_ble_gap_periodic_adv_enable(tBTA_DM_MSG *p_data)
|
void bta_dm_ble_gap_periodic_adv_enable(tBTA_DM_MSG *p_data)
|
||||||
|
@ -2932,7 +2932,7 @@ void BTA_DmBleGapPeriodicAdvSetParams(UINT8 instance,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BTA_DmBleGapPeriodicAdvCfgDataRaw(UINT8 instance, UINT16 length,
|
void BTA_DmBleGapPeriodicAdvCfgDataRaw(UINT8 instance, UINT16 length,
|
||||||
const UINT8 *data)
|
const UINT8 *data,bool only_update_did)
|
||||||
{
|
{
|
||||||
tBTA_DM_API_CFG_PERIODIC_ADV_DATA *p_msg;
|
tBTA_DM_API_CFG_PERIODIC_ADV_DATA *p_msg;
|
||||||
APPL_TRACE_API("%s, Periodic ADV config data raw.", __func__);
|
APPL_TRACE_API("%s, Periodic ADV config data raw.", __func__);
|
||||||
@ -2944,6 +2944,7 @@ void BTA_DmBleGapPeriodicAdvCfgDataRaw(UINT8 instance, UINT16 length,
|
|||||||
p_msg->data = (UINT8 *)(p_msg + 1);
|
p_msg->data = (UINT8 *)(p_msg + 1);
|
||||||
memcpy(p_msg->data, data, length);
|
memcpy(p_msg->data, data, length);
|
||||||
p_msg->data = length != 0 ? (UINT8 *)(p_msg + 1) : NULL;
|
p_msg->data = length != 0 ? (UINT8 *)(p_msg + 1) : NULL;
|
||||||
|
p_msg->only_update_did = only_update_did;
|
||||||
//start sent the msg to the bta system control moudle
|
//start sent the msg to the bta system control moudle
|
||||||
bta_sys_sendmsg(p_msg);
|
bta_sys_sendmsg(p_msg);
|
||||||
} else {
|
} else {
|
||||||
@ -2952,7 +2953,7 @@ void BTA_DmBleGapPeriodicAdvCfgDataRaw(UINT8 instance, UINT16 length,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BTA_DmBleGapPeriodicAdvEnable(BOOLEAN enable, UINT8 instance)
|
void BTA_DmBleGapPeriodicAdvEnable(UINT8 enable, UINT8 instance)
|
||||||
{
|
{
|
||||||
tBTA_DM_API_ENABLE_PERIODIC_ADV *p_msg;
|
tBTA_DM_API_ENABLE_PERIODIC_ADV *p_msg;
|
||||||
APPL_TRACE_API("%s, Periodic ADV %s.", __func__, enable ? "start" : "stop");
|
APPL_TRACE_API("%s, Periodic ADV %s.", __func__, enable ? "start" : "stop");
|
||||||
|
@ -967,12 +967,13 @@ typedef struct {
|
|||||||
UINT8 instance;
|
UINT8 instance;
|
||||||
UINT16 length;
|
UINT16 length;
|
||||||
UINT8 *data;
|
UINT8 *data;
|
||||||
|
BOOLEAN only_update_did;
|
||||||
} tBTA_DM_API_CFG_PERIODIC_ADV_DATA;
|
} tBTA_DM_API_CFG_PERIODIC_ADV_DATA;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
BT_HDR hdr;
|
BT_HDR hdr;
|
||||||
UINT8 instance;
|
UINT8 instance;
|
||||||
BOOLEAN enable;
|
UINT8 enable;
|
||||||
} tBTA_DM_API_ENABLE_PERIODIC_ADV;
|
} tBTA_DM_API_ENABLE_PERIODIC_ADV;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -2994,9 +2994,9 @@ extern void BTA_DmBleGapPeriodicAdvSetParams(UINT8 instance,
|
|||||||
tBTA_DM_BLE_Periodic_Adv_Params *params);
|
tBTA_DM_BLE_Periodic_Adv_Params *params);
|
||||||
|
|
||||||
extern void BTA_DmBleGapPeriodicAdvCfgDataRaw(UINT8 instance, UINT16 length,
|
extern void BTA_DmBleGapPeriodicAdvCfgDataRaw(UINT8 instance, UINT16 length,
|
||||||
const UINT8 *data);
|
const UINT8 *data,BOOLEAN only_update_did);
|
||||||
|
|
||||||
extern void BTA_DmBleGapPeriodicAdvEnable(BOOLEAN enable, UINT8 instance);
|
extern void BTA_DmBleGapPeriodicAdvEnable(UINT8 enable, UINT8 instance);
|
||||||
|
|
||||||
extern void BTA_DmBleGapPeriodicAdvCreateSync(tBTA_DM_BLE_Periodic_Sync_Params *params);
|
extern void BTA_DmBleGapPeriodicAdvCreateSync(tBTA_DM_BLE_Periodic_Sync_Params *params);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -1908,11 +1908,12 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
|||||||
BTC_TRACE_DEBUG("BTC_GAP_BLE_CFG_PERIODIC_ADV_DATA_RAW");
|
BTC_TRACE_DEBUG("BTC_GAP_BLE_CFG_PERIODIC_ADV_DATA_RAW");
|
||||||
BTA_DmBleGapPeriodicAdvCfgDataRaw(arg_5->periodic_adv_cfg_data.instance,
|
BTA_DmBleGapPeriodicAdvCfgDataRaw(arg_5->periodic_adv_cfg_data.instance,
|
||||||
arg_5->periodic_adv_cfg_data.len,
|
arg_5->periodic_adv_cfg_data.len,
|
||||||
(const UINT8 *)arg_5->periodic_adv_cfg_data.data);
|
(const UINT8 *)arg_5->periodic_adv_cfg_data.data,
|
||||||
|
arg_5->periodic_adv_cfg_data.only_update_did);
|
||||||
break;
|
break;
|
||||||
case BTC_GAP_BLE_PERIODIC_ADV_START:
|
case BTC_GAP_BLE_PERIODIC_ADV_START:
|
||||||
BTC_TRACE_DEBUG("BTC_GAP_BLE_PERIODIC_ADV_START");
|
BTC_TRACE_DEBUG("BTC_GAP_BLE_PERIODIC_ADV_START");
|
||||||
BTA_DmBleGapPeriodicAdvEnable(TRUE, arg_5->periodic_adv_start.instance);
|
BTA_DmBleGapPeriodicAdvEnable(((arg_5->periodic_adv_start.include_adi)<<1)|0x01, arg_5->periodic_adv_start.instance);
|
||||||
break;
|
break;
|
||||||
case BTC_GAP_BLE_PERIODIC_ADV_STOP:
|
case BTC_GAP_BLE_PERIODIC_ADV_STOP:
|
||||||
BTC_TRACE_DEBUG("BTC_GAP_BLE_PERIODIC_ADV_STOP");
|
BTC_TRACE_DEBUG("BTC_GAP_BLE_PERIODIC_ADV_STOP");
|
||||||
|
@ -1,16 +1,8 @@
|
|||||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
/*
|
||||||
//
|
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
*
|
||||||
// you may not use this file except in compliance with the License.
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
// You may obtain a copy of the License at
|
*/
|
||||||
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
#ifndef __BTC_GAP_BLE_H__
|
#ifndef __BTC_GAP_BLE_H__
|
||||||
#define __BTC_GAP_BLE_H__
|
#define __BTC_GAP_BLE_H__
|
||||||
@ -304,9 +296,11 @@ typedef union {
|
|||||||
uint8_t instance;
|
uint8_t instance;
|
||||||
uint16_t len;
|
uint16_t len;
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
|
bool only_update_did;
|
||||||
} periodic_adv_cfg_data;
|
} periodic_adv_cfg_data;
|
||||||
|
|
||||||
struct periodic_adv_start_args {
|
struct periodic_adv_start_args {
|
||||||
|
bool include_adi;
|
||||||
uint8_t instance;
|
uint8_t instance;
|
||||||
} periodic_adv_start;
|
} periodic_adv_start;
|
||||||
|
|
||||||
|
@ -117,6 +117,12 @@
|
|||||||
#define UC_BT_BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER FALSE
|
#define UC_BT_BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_BT_BLE_FEAT_PERIODIC_ADV_ENH
|
||||||
|
#define UC_BT_BLE_FEAT_PERIODIC_ADV_ENH CONFIG_BT_BLE_FEAT_PERIODIC_ADV_ENH
|
||||||
|
#else
|
||||||
|
#define UC_BT_BLE_FEAT_PERIODIC_ADV_ENH FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL
|
#ifdef CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL
|
||||||
#define UC_BT_BLE_HIGH_DUTY_ADV_INTERVAL CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL
|
#define UC_BT_BLE_HIGH_DUTY_ADV_INTERVAL CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL
|
||||||
#else
|
#else
|
||||||
|
@ -178,6 +178,12 @@
|
|||||||
#define BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER FALSE
|
#define BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (UC_BT_BLE_FEAT_PERIODIC_ADV_ENH == TRUE)
|
||||||
|
#define BLE_FEAT_PERIODIC_ADV_ENH TRUE
|
||||||
|
#else
|
||||||
|
#define BLE_FEAT_PERIODIC_ADV_ENH FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (UC_BT_BLE_HIGH_DUTY_ADV_INTERVAL == TRUE)
|
#if (UC_BT_BLE_HIGH_DUTY_ADV_INTERVAL == TRUE)
|
||||||
#define BLE_HIGH_DUTY_ADV_INTERVAL TRUE
|
#define BLE_HIGH_DUTY_ADV_INTERVAL TRUE
|
||||||
#else
|
#else
|
||||||
|
@ -701,7 +701,7 @@ end:
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data)
|
tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data,BOOLEAN only_update_did)
|
||||||
{
|
{
|
||||||
tBTM_STATUS status = BTM_SUCCESS;
|
tBTM_STATUS status = BTM_SUCCESS;
|
||||||
tHCI_STATUS err = HCI_SUCCESS;
|
tHCI_STATUS err = HCI_SUCCESS;
|
||||||
@ -709,6 +709,13 @@ tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data
|
|||||||
UINT8 operation = 0;
|
UINT8 operation = 0;
|
||||||
UINT16 data_offset = 0;
|
UINT16 data_offset = 0;
|
||||||
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
|
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
|
||||||
|
if (only_update_did)
|
||||||
|
{
|
||||||
|
len = 0;
|
||||||
|
data = NULL;
|
||||||
|
rem_len = 0;
|
||||||
|
operation = BTM_BLE_ADV_DATA_OP_UNCHANGED_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
if ((status = btm_ble_ext_adv_set_data_validate(instance, len, data)) != BTM_SUCCESS) {
|
if ((status = btm_ble_ext_adv_set_data_validate(instance, len, data)) != BTM_SUCCESS) {
|
||||||
BTM_TRACE_ERROR("%s, invalid extend adv data.", __func__);
|
BTM_TRACE_ERROR("%s, invalid extend adv data.", __func__);
|
||||||
@ -719,7 +726,9 @@ tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data
|
|||||||
UINT8 send_data_len = (rem_len > BTM_BLE_PERIODIC_ADV_DATA_LEN_MAX) ? BTM_BLE_PERIODIC_ADV_DATA_LEN_MAX : rem_len;
|
UINT8 send_data_len = (rem_len > BTM_BLE_PERIODIC_ADV_DATA_LEN_MAX) ? BTM_BLE_PERIODIC_ADV_DATA_LEN_MAX : rem_len;
|
||||||
|
|
||||||
if (len <= BTM_BLE_EXT_ADV_DATA_LEN_MAX) {
|
if (len <= BTM_BLE_EXT_ADV_DATA_LEN_MAX) {
|
||||||
|
if (!only_update_did) {
|
||||||
operation = BTM_BLE_ADV_DATA_OP_COMPLETE;
|
operation = BTM_BLE_ADV_DATA_OP_COMPLETE;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (rem_len == len) {
|
if (rem_len == len) {
|
||||||
operation = BTM_BLE_ADV_DATA_OP_FIRST_FRAG;
|
operation = BTM_BLE_ADV_DATA_OP_FIRST_FRAG;
|
||||||
@ -745,7 +754,7 @@ end:
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
tBTM_STATUS BTM_BlePeriodicAdvEnable(UINT8 instance, BOOLEAN enable)
|
tBTM_STATUS BTM_BlePeriodicAdvEnable(UINT8 instance, UINT8 enable)
|
||||||
{
|
{
|
||||||
tBTM_STATUS status = BTM_SUCCESS;
|
tBTM_STATUS status = BTM_SUCCESS;
|
||||||
tHCI_STATUS err = HCI_SUCCESS;
|
tHCI_STATUS err = HCI_SUCCESS;
|
||||||
|
@ -2667,9 +2667,9 @@ tBTM_STATUS BTM_BleExtAdvSetClear(void);
|
|||||||
|
|
||||||
tBTM_STATUS BTM_BlePeriodicAdvSetParams(UINT8 instance, tBTM_BLE_Periodic_Adv_Params *params);
|
tBTM_STATUS BTM_BlePeriodicAdvSetParams(UINT8 instance, tBTM_BLE_Periodic_Adv_Params *params);
|
||||||
|
|
||||||
tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data);
|
tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data, BOOLEAN only_update_did);
|
||||||
|
|
||||||
tBTM_STATUS BTM_BlePeriodicAdvEnable(UINT8 instance, BOOLEAN enable);
|
tBTM_STATUS BTM_BlePeriodicAdvEnable(UINT8 instance, UINT8 enable);
|
||||||
|
|
||||||
tBTM_STATUS BTM_BlePeriodicAdvCreateSync(tBTM_BLE_Periodic_Sync_Params *params);
|
tBTM_STATUS BTM_BlePeriodicAdvCreateSync(tBTM_BLE_Periodic_Sync_Params *params);
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
Unless required by applicable law or agreed to in writing, this
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
||||||
CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -193,9 +191,24 @@ void app_main(void)
|
|||||||
// start all adv
|
// start all adv
|
||||||
FUNC_SEND_WAIT_SEM(esp_ble_gap_ext_adv_start(NUM_EXT_ADV, &ext_adv[0]), test_sem);
|
FUNC_SEND_WAIT_SEM(esp_ble_gap_ext_adv_start(NUM_EXT_ADV, &ext_adv[0]), test_sem);
|
||||||
|
|
||||||
|
// set periodic adv param
|
||||||
FUNC_SEND_WAIT_SEM(esp_ble_gap_periodic_adv_set_params(EXT_ADV_HANDLE, &periodic_adv_params), test_sem);
|
FUNC_SEND_WAIT_SEM(esp_ble_gap_periodic_adv_set_params(EXT_ADV_HANDLE, &periodic_adv_params), test_sem);
|
||||||
|
|
||||||
|
#if (CONFIG_BT_BLE_FEAT_PERIODIC_ADV_ENH)
|
||||||
|
// set periodic adv raw data
|
||||||
|
FUNC_SEND_WAIT_SEM(esp_ble_gap_config_periodic_adv_data_raw(EXT_ADV_HANDLE, sizeof(periodic_adv_raw_data), &periodic_adv_raw_data[0], false), test_sem);
|
||||||
|
// start periodic adv, include the ADI field in AUX_SYNC_IND PDUs
|
||||||
|
FUNC_SEND_WAIT_SEM(esp_ble_gap_periodic_adv_start(EXT_ADV_HANDLE, true), test_sem);
|
||||||
|
while (1) {
|
||||||
|
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||||
|
// just update the Advertising DID of the periodic advertising, unchanged data
|
||||||
|
FUNC_SEND_WAIT_SEM(esp_ble_gap_config_periodic_adv_data_raw(EXT_ADV_HANDLE, 0, NULL, true), test_sem);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// set periodic adv raw data
|
||||||
FUNC_SEND_WAIT_SEM(esp_ble_gap_config_periodic_adv_data_raw(EXT_ADV_HANDLE, sizeof(periodic_adv_raw_data), &periodic_adv_raw_data[0]), test_sem);
|
FUNC_SEND_WAIT_SEM(esp_ble_gap_config_periodic_adv_data_raw(EXT_ADV_HANDLE, sizeof(periodic_adv_raw_data), &periodic_adv_raw_data[0]), test_sem);
|
||||||
FUNC_SEND_WAIT_SEM(esp_ble_gap_periodic_adv_start(EXT_ADV_HANDLE), test_sem);
|
FUNC_SEND_WAIT_SEM(esp_ble_gap_periodic_adv_start(EXT_ADV_HANDLE), test_sem);
|
||||||
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -95,11 +95,24 @@ a_2m), &raw_ext_adv_data_2m[0]), test_sem);
|
|||||||
// start all adv
|
// start all adv
|
||||||
FUNC_SEND_WAIT_SEM(esp_ble_gap_ext_adv_start(NUM_EXT_ADV, &ext_adv[0]), test_sem);
|
FUNC_SEND_WAIT_SEM(esp_ble_gap_ext_adv_start(NUM_EXT_ADV, &ext_adv[0]), test_sem);
|
||||||
|
|
||||||
FUNC_SEND_WAIT_SEM(esp_ble_gap_periodic_adv_set_params(EXT_ADV_HANDLE, &periodic_adv_params),
|
// set periodic adv param
|
||||||
test_sem);
|
FUNC_SEND_WAIT_SEM(esp_ble_gap_periodic_adv_set_params(EXT_ADV_HANDLE, &periodic_adv_params), test_sem);
|
||||||
FUNC_SEND_WAIT_SEM(esp_ble_gap_config_periodic_adv_data_raw(EXT_ADV_HANDLE, sizeof(periodic_a
|
|
||||||
dv_raw_data), &periodic_adv_raw_data[0]), test_sem);
|
#if (CONFIG_BT_BLE_FEAT_PERIODIC_ADV_ENH)
|
||||||
|
// set periodic adv raw data
|
||||||
|
FUNC_SEND_WAIT_SEM(esp_ble_gap_config_periodic_adv_data_raw(EXT_ADV_HANDLE, sizeof(periodic_adv_raw_data), &periodic_adv_raw_data[0], false), test_sem);
|
||||||
|
// start periodic adv, include the ADI field in AUX_SYNC_IND PDUs
|
||||||
|
FUNC_SEND_WAIT_SEM(esp_ble_gap_periodic_adv_start(EXT_ADV_HANDLE, true), test_sem);
|
||||||
|
while (1) {
|
||||||
|
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||||
|
// just update the Advertising DID of the periodic advertising, unchanged data
|
||||||
|
FUNC_SEND_WAIT_SEM(esp_ble_gap_config_periodic_adv_data_raw(EXT_ADV_HANDLE, 0, NULL, true), test_sem);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// set periodic adv raw data
|
||||||
|
FUNC_SEND_WAIT_SEM(esp_ble_gap_config_periodic_adv_data_raw(EXT_ADV_HANDLE, sizeof(periodic_adv_raw_data), &periodic_adv_raw_data[0]), test_sem);
|
||||||
FUNC_SEND_WAIT_SEM(esp_ble_gap_periodic_adv_start(EXT_ADV_HANDLE), test_sem);
|
FUNC_SEND_WAIT_SEM(esp_ble_gap_periodic_adv_start(EXT_ADV_HANDLE), test_sem);
|
||||||
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user