Merge branch 'bugfix/IDFGH-9552_v4.4' into 'release/v4.4'

NimBLE : Added configurable option for resolving peer address in bleprph example. (v4.4)

See merge request espressif/esp-idf!22992
This commit is contained in:
Jiang Jiang Jian
2023-03-31 13:59:15 +08:00
2 changed files with 16 additions and 7 deletions

View File

@@ -53,4 +53,11 @@ menu "Example Configuration"
prompt "Enable Link Encryption" prompt "Enable Link Encryption"
help help
This adds Encrypted Read and Write permissions in the custom GATT server. This adds Encrypted Read and Write permissions in the custom GATT server.
config EXAMPLE_RESOLVE_PEER_ADDR
bool
prompt "Enable resolving peer address"
help
Use this option to enable resolving peer's address.
endmenu endmenu

View File

@@ -362,6 +362,11 @@ app_main(void)
ble_hs_cfg.sm_io_cap = CONFIG_EXAMPLE_IO_TYPE; ble_hs_cfg.sm_io_cap = CONFIG_EXAMPLE_IO_TYPE;
#ifdef CONFIG_EXAMPLE_BONDING #ifdef CONFIG_EXAMPLE_BONDING
ble_hs_cfg.sm_bonding = 1; ble_hs_cfg.sm_bonding = 1;
/* Enable the appropriate bit masks to make sure the keys
* that are needed are exchanged
*/
ble_hs_cfg.sm_our_key_dist |= BLE_SM_PAIR_KEY_DIST_ENC;
ble_hs_cfg.sm_their_key_dist |= BLE_SM_PAIR_KEY_DIST_ENC;
#endif #endif
#ifdef CONFIG_EXAMPLE_MITM #ifdef CONFIG_EXAMPLE_MITM
ble_hs_cfg.sm_mitm = 1; ble_hs_cfg.sm_mitm = 1;
@@ -371,15 +376,12 @@ app_main(void)
#else #else
ble_hs_cfg.sm_sc = 0; ble_hs_cfg.sm_sc = 0;
#endif #endif
#ifdef CONFIG_EXAMPLE_BONDING #ifdef CONFIG_EXAMPLE_RESOLVE_PEER_ADDR
/* Enable the appropriate bit masks to make sure the keys /* Stores the IRK */
* that are needed are exchanged ble_hs_cfg.sm_our_key_dist |= BLE_SM_PAIR_KEY_DIST_ID;
*/ ble_hs_cfg.sm_their_key_dist |= BLE_SM_PAIR_KEY_DIST_ID;
ble_hs_cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC;
ble_hs_cfg.sm_their_key_dist = BLE_SM_PAIR_KEY_DIST_ENC;
#endif #endif
rc = gatt_svr_init(); rc = gatt_svr_init();
assert(rc == 0); assert(rc == 0);