feat(ble/bluedroid): Add BLE SMP support for multi-ADV with static random addresses

(cherry picked from commit 7986e2faa8)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
This commit is contained in:
Zhang Hai Peng
2026-06-18 10:24:49 +08:00
parent 43cc865e97
commit 68e37183f1
6 changed files with 276 additions and 20 deletions
@@ -624,6 +624,14 @@ typedef struct {
BOOLEAN directed;
BOOLEAN scannable;
BOOLEAN connetable;
/* Per-set on-air address policy, captured at BTM_BleSetExtendedAdvParams()
* time. For now we only consider CONTROLLER_RPA_LIST_ENABLE == TRUE;
* CONTROLLER_RPA_LIST_ENABLE == FALSE is out of scope temporarily. The global
* addr_mgnt_cb is a single slot shared across all sets, so in multi-ADV
* it does not necessarily reflect the policy used for a given connection. */
tBLE_ADDR_TYPE own_addr_type;
BOOLEAN rand_addr_set;
BD_ADDR rand_addr;
} tBTM_BLE_EXTENDED_INST;
typedef struct {
@@ -631,6 +639,10 @@ typedef struct {
UINT8 scan_duplicate;
} tBTM_BLE_EXTENDED_CB;
/* Defined in btm_ble_5_gap.c. Exposed for per-set address lookup from
* SMP / BTM at LE connection complete. */
extern tBTM_BLE_EXTENDED_CB extend_adv_cb;
#define BTM_BLE_GAP_SET_EXT_ADV_PROP_CONNECTABLE (1 << 0)
#define BTM_BLE_GAP_SET_EXT_ADV_PROP_SCANNABLE (1 << 1)
#define BTM_BLE_GAP_SET_EXT_ADV_PROP_DIRECTED (1 << 2)
@@ -3052,6 +3064,20 @@ tBTM_STATUS BTM_BleExtAdvSetRemove(UINT8 instance);
tBTM_STATUS BTM_BleExtAdvSetClear(void);
/*******************************************************************************
**
** Function BTM_BleGetExtAdvInstByConHandle
**
** Description Map an LE connection handle to the ext-adv instance
** that produced it.
**
** Returns Instance index on success, 0xFF if no match (e.g.
** initiator role or legacy advertising).
**
*******************************************************************************/
UINT8 BTM_BleGetExtAdvInstByConHandle(UINT16 con_handle);
tBTM_STATUS BTM_BlePeriodicAdvSetParams(UINT8 instance, tBTM_BLE_Periodic_Adv_Params *params);
tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data, BOOLEAN only_update_did);