mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat(nimble): Add support for static passkey
This commit is contained in:
@@ -61,6 +61,14 @@ idf.py menuconfig
|
||||
In the `Example Configuration` menu:
|
||||
|
||||
* Change the `Peer Address` option if needed.
|
||||
* Optional: enable static passkey support via `Component config -> Bluetooth -> NimBLE -> Enable support for Static Passkey`.
|
||||
|
||||
Static passkey mode is useful for demos where you want to avoid interactive passkey entry.
|
||||
When enabled, the example calls `ble_sm_configure_static_passkey(456789, true)` and NimBLE
|
||||
automatically injects the passkey during pairing. Update the passkey in
|
||||
`examples/bluetooth/nimble/blecent/main/main.c` if you want a different value.
|
||||
Both devices must use the same 6-digit passkey, and you should only use a fixed
|
||||
passkey for development or controlled environments.
|
||||
|
||||
### Build and Flash
|
||||
|
||||
|
||||
@@ -1096,6 +1096,10 @@ app_main(void)
|
||||
ble_hs_cfg.store_status_cb = ble_store_util_status_rr;
|
||||
|
||||
#if NIMBLE_BLE_CONNECT
|
||||
#if MYNEWT_VAL(STATIC_PASSKEY)
|
||||
ble_sm_configure_static_passkey(456789, true);
|
||||
#endif
|
||||
|
||||
int rc;
|
||||
/* Initialize data structures to track connected peers. */
|
||||
#if MYNEWT_VAL(BLE_INCL_SVC_DISCOVERY) || MYNEWT_VAL(BLE_GATT_CACHING_INCLUDE_SERVICES)
|
||||
|
||||
Reference in New Issue
Block a user