@@ -47,12 +47,22 @@ static void pairing_confirm(struct bt_conn *conn)
4747 printk ("Pairing confirmed: %s\n" , addr );
4848}
4949
50+ #if defined(CONFIG_BT_APP_PASSKEY )
51+ static uint32_t app_passkey (struct bt_conn * conn )
52+ {
53+ return bt_mesh_le_pair_resp_passkey_get ();
54+ }
55+ #endif /* CONFIG_BT_APP_PASSKEY */
56+
5057static struct bt_conn_auth_cb auth_cb = {
5158 /* Enable passkey_display callback to enable the display capability. */
5259 .passkey_display = passkey_display ,
5360 /* These 2 callbacks are required for passkey_display callback. */
5461 .cancel = cancel ,
5562 .pairing_confirm = pairing_confirm ,
63+ #if defined(CONFIG_BT_APP_PASSKEY )
64+ .app_passkey = app_passkey ,
65+ #endif /* CONFIG_BT_APP_PASSKEY */
5666};
5767
5868static void pairing_complete (struct bt_conn * conn , bool bonded )
@@ -63,8 +73,10 @@ static void pairing_complete(struct bt_conn *conn, bool bonded)
6373
6474 printk ("Pairing completed: %s, bonded: %d\n" , addr , bonded );
6575
76+ #if defined(CONFIG_BT_FIXED_PASSKEY )
6677 /* Invalidate the previously used passkey. */
6778 bt_mesh_le_pair_resp_passkey_invalidate ();
79+ #endif /* CONFIG_BT_FIXED_PASSKEY */
6880}
6981
7082static void pairing_failed (struct bt_conn * conn , enum bt_security_err reason )
@@ -75,8 +87,10 @@ static void pairing_failed(struct bt_conn *conn, enum bt_security_err reason)
7587
7688 printk ("Pairing failed: %s, reason %d\n" , addr , reason );
7789
90+ #if defined(CONFIG_BT_FIXED_PASSKEY )
7891 /* Invalidate the previously used passkey. */
7992 bt_mesh_le_pair_resp_passkey_invalidate ();
93+ #endif /* CONFIG_BT_FIXED_PASSKEY */
8094}
8195
8296static struct bt_conn_auth_info_cb conn_auth_info_callbacks = {
0 commit comments