mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/periodic_adv_enhancement_v5.0' into 'release/v5.0'
Some checks failed
docker / docker (push) Has been cancelled
Some checks failed
docker / docker (push) Has been cancelled
NimBLE : Added periodic Adv Feature Updates in BLE 5.3 (v5.0) See merge request espressif/esp-idf!32078
This commit is contained in:
commit
4780f809f5
@ -567,6 +567,12 @@ if BT_NIMBLE_EXT_ADV
|
|||||||
help
|
help
|
||||||
This enables controller transfer periodic sync events to host
|
This enables controller transfer periodic sync events to host
|
||||||
|
|
||||||
|
config BT_NIMBLE_PERIODIC_ADV_ENH
|
||||||
|
bool "Periodic adv enhancements(adi support)"
|
||||||
|
depends on BT_NIMBLE_ENABLE_PERIODIC_ADV && SOC_BLE_PERIODIC_ADV_ENH_SUPPORTED
|
||||||
|
help
|
||||||
|
Enable the periodic advertising enhancements
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
config BT_NIMBLE_MAX_PERIODIC_SYNCS
|
config BT_NIMBLE_MAX_PERIODIC_SYNCS
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 749a79093753d3df1450e16e45a7ea5a7f12e523
|
Subproject commit 6d147bba6cbfe3e49836781a0a6f90e6f52e5538
|
@ -179,6 +179,11 @@
|
|||||||
#else
|
#else
|
||||||
#define MYNEWT_VAL_BLE_CONN_SUBRATING (CONFIG_BT_NIMBLE_SUBRATE)
|
#define MYNEWT_VAL_BLE_CONN_SUBRATING (CONFIG_BT_NIMBLE_SUBRATE)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef CONFIG_BT_NIMBLE_PERIODIC_ADV_ENH
|
||||||
|
#define MYNEWT_VAL_BLE_PERIODIC_ADV_ENH (0)
|
||||||
|
#else
|
||||||
|
#define MYNEWT_VAL_BLE_PERIODIC_ADV_ENH (CONFIG_BT_NIMBLE_PERIODIC_ADV_ENH)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*** @apache-mynewt-nimble/nimble/controller */
|
/*** @apache-mynewt-nimble/nimble/controller */
|
||||||
/*** @apache-mynewt-nimble/nimble/controller */
|
/*** @apache-mynewt-nimble/nimble/controller */
|
||||||
|
@ -607,6 +607,10 @@ config SOC_BLE_DEVICE_PRIVACY_SUPPORTED
|
|||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
|
|
||||||
|
config SOC_BLE_PERIODIC_ADV_ENH_SUPPORTED
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
|
||||||
config SOC_PHY_IMPROVE_RX_11B
|
config SOC_PHY_IMPROVE_RX_11B
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
|
@ -296,6 +296,7 @@
|
|||||||
#define SOC_ESP_NIMBLE_CONTROLLER (1) /*!< Support BLE EMBEDDED controller V1 */
|
#define SOC_ESP_NIMBLE_CONTROLLER (1) /*!< Support BLE EMBEDDED controller V1 */
|
||||||
#define SOC_BLE_50_SUPPORTED (1) /*!< Support Bluetooth 5.0 */
|
#define SOC_BLE_50_SUPPORTED (1) /*!< Support Bluetooth 5.0 */
|
||||||
#define SOC_BLE_DEVICE_PRIVACY_SUPPORTED (1) /*!< Support BLE device privacy mode */
|
#define SOC_BLE_DEVICE_PRIVACY_SUPPORTED (1) /*!< Support BLE device privacy mode */
|
||||||
|
#define SOC_BLE_PERIODIC_ADV_ENH_SUPPORTED (1) /*!< Support For BLE Periodic Adv Enhancements */
|
||||||
|
|
||||||
/*------------------------------------- PHY CAPS -------------------------------------*/
|
/*------------------------------------- PHY CAPS -------------------------------------*/
|
||||||
#define SOC_PHY_IMPROVE_RX_11B (1)
|
#define SOC_PHY_IMPROVE_RX_11B (1)
|
||||||
|
@ -16,4 +16,12 @@ menu "Example Configuration"
|
|||||||
prompt "Advertise RANDOM Address"
|
prompt "Advertise RANDOM Address"
|
||||||
help
|
help
|
||||||
Use this option to advertise a random address instead of public address
|
Use this option to advertise a random address instead of public address
|
||||||
|
|
||||||
|
config EXAMPLE_PERIODIC_ADV_ENH
|
||||||
|
bool
|
||||||
|
prompt "Enable Periodic Adv Enhancements"
|
||||||
|
depends on SOC_BLE_50_SUPPORTED && SOC_BLE_PERIODIC_ADV_ENH_SUPPORTED
|
||||||
|
select BT_NIMBLE_PERIODIC_ADV_ENH
|
||||||
|
help
|
||||||
|
Use this option to enable periodic advertising enhancements
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
*/
|
*/
|
||||||
@ -53,6 +53,10 @@ start_periodic_adv(void)
|
|||||||
struct os_mbuf *data;
|
struct os_mbuf *data;
|
||||||
uint8_t instance = 1;
|
uint8_t instance = 1;
|
||||||
ble_addr_t addr;
|
ble_addr_t addr;
|
||||||
|
#if MYNEWT_VAL(BLE_PERIODIC_ADV_ENH)
|
||||||
|
struct ble_gap_periodic_adv_enable_params eparams;
|
||||||
|
memset(&eparams, 0, sizeof(eparams));
|
||||||
|
#endif
|
||||||
|
|
||||||
/* For periodic we use instance with non-connectable advertising */
|
/* For periodic we use instance with non-connectable advertising */
|
||||||
memset (¶ms, 0, sizeof(params));
|
memset (¶ms, 0, sizeof(params));
|
||||||
@ -112,11 +116,22 @@ start_periodic_adv(void)
|
|||||||
|
|
||||||
rc = os_mbuf_append(data, periodic_adv_raw_data, sizeof(periodic_adv_raw_data));
|
rc = os_mbuf_append(data, periodic_adv_raw_data, sizeof(periodic_adv_raw_data));
|
||||||
assert(rc == 0);
|
assert(rc == 0);
|
||||||
|
#if MYNEWT_VAL(BLE_PERIODIC_ADV_ENH)
|
||||||
|
rc = ble_gap_periodic_adv_set_data(instance, data, NULL);
|
||||||
|
#else
|
||||||
rc = ble_gap_periodic_adv_set_data(instance, data);
|
rc = ble_gap_periodic_adv_set_data(instance, data);
|
||||||
|
#endif
|
||||||
assert (rc == 0);
|
assert (rc == 0);
|
||||||
|
|
||||||
/* start periodic advertising */
|
/* start periodic advertising */
|
||||||
|
#if MYNEWT_VAL(BLE_PERIODIC_ADV_ENH)
|
||||||
|
#if CONFIG_EXAMPLE_PERIODIC_ADV_ENH
|
||||||
|
eparams.include_adi = 1;
|
||||||
|
#endif
|
||||||
|
rc = ble_gap_periodic_adv_start(instance, &eparams);
|
||||||
|
#else
|
||||||
rc = ble_gap_periodic_adv_start(instance);
|
rc = ble_gap_periodic_adv_start(instance);
|
||||||
|
#endif
|
||||||
assert (rc == 0);
|
assert (rc == 0);
|
||||||
|
|
||||||
/* start advertising */
|
/* start advertising */
|
||||||
|
@ -8,5 +8,13 @@ menu "Example Configuration"
|
|||||||
help
|
help
|
||||||
Use this option to enable extended advertising in the example.
|
Use this option to enable extended advertising in the example.
|
||||||
If this option is disabled, ensure config BT_NIMBLE_EXT_ADV is
|
If this option is disabled, ensure config BT_NIMBLE_EXT_ADV is
|
||||||
also disabled from Nimble stack menuconfig
|
also disabled from NimBLE stack menuconfig
|
||||||
|
|
||||||
|
config EXAMPLE_PERIODIC_ADV_ENH
|
||||||
|
bool
|
||||||
|
prompt "Enable Periodic Adv Enhancements"
|
||||||
|
depends on SOC_BLE_50_SUPPORTED && SOC_BLE_PERIODIC_ADV_ENH_SUPPORTED
|
||||||
|
select BT_NIMBLE_PERIODIC_ADV_ENH
|
||||||
|
help
|
||||||
|
Use this option to enable periodic adv enhancements
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
*/
|
*/
|
||||||
@ -122,6 +122,13 @@ periodic_sync_gap_event(struct ble_gap_event *event, void *arg)
|
|||||||
memcpy(&adv_sid, &disc->sid, sizeof(disc->sid));
|
memcpy(&adv_sid, &disc->sid, sizeof(disc->sid));
|
||||||
params.skip = 10;
|
params.skip = 10;
|
||||||
params.sync_timeout = 1000;
|
params.sync_timeout = 1000;
|
||||||
|
|
||||||
|
#if CONFIG_EXAMPLE_PERIODIC_ADV_ENH
|
||||||
|
/* This way the periodic advertising reports will not be
|
||||||
|
delivered to host unless the advertising data is changed
|
||||||
|
or the Data-Id is updated by the advertiser */
|
||||||
|
params.filter_duplicates = 1;
|
||||||
|
#endif
|
||||||
rc = ble_gap_periodic_adv_sync_create(&addr, adv_sid, ¶ms, periodic_sync_gap_event, NULL);
|
rc = ble_gap_periodic_adv_sync_create(&addr, adv_sid, ¶ms, periodic_sync_gap_event, NULL);
|
||||||
assert(rc == 0);
|
assert(rc == 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user