Bluetooth: shell: Add support for pairing accept callback
Add pairing support callback to print remote pairing features when this option is enabled. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
2685a94c02
commit
9dc4eed622
1 changed files with 33 additions and 0 deletions
|
@ -1391,6 +1391,21 @@ static void auth_pincode_entry(struct bt_conn *conn, bool highsec)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
|
||||
enum bt_security_err pairing_accept(
|
||||
struct bt_conn *conn, const struct bt_conn_pairing_feat *const feat)
|
||||
{
|
||||
shell_print(ctx_shell, "Remote pairing features: "
|
||||
"IO: 0x%02x, OOB: %d, AUTH: 0x%02x, Key: %d, "
|
||||
"Init Kdist: 0x%02x, Resp Kdist: 0x%02x",
|
||||
feat->io_capability, feat->oob_data_flag,
|
||||
feat->auth_req, feat->max_enc_key_size,
|
||||
feat->init_key_dist, feat->resp_key_dist);
|
||||
|
||||
return BT_SECURITY_ERR_SUCCESS;
|
||||
}
|
||||
#endif /* CONFIG_BT_SMP_APP_PAIRING_ACCEPT */
|
||||
|
||||
static struct bt_conn_auth_cb auth_cb_display = {
|
||||
.passkey_display = auth_passkey_display,
|
||||
.passkey_entry = NULL,
|
||||
|
@ -1403,6 +1418,9 @@ static struct bt_conn_auth_cb auth_cb_display = {
|
|||
.pairing_confirm = auth_pairing_confirm,
|
||||
.pairing_failed = auth_pairing_failed,
|
||||
.pairing_complete = auth_pairing_complete,
|
||||
#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
|
||||
.pairing_accept = pairing_accept,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct bt_conn_auth_cb auth_cb_display_yes_no = {
|
||||
|
@ -1417,6 +1435,9 @@ static struct bt_conn_auth_cb auth_cb_display_yes_no = {
|
|||
.pairing_confirm = auth_pairing_confirm,
|
||||
.pairing_failed = auth_pairing_failed,
|
||||
.pairing_complete = auth_pairing_complete,
|
||||
#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
|
||||
.pairing_accept = pairing_accept,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct bt_conn_auth_cb auth_cb_input = {
|
||||
|
@ -1431,6 +1452,9 @@ static struct bt_conn_auth_cb auth_cb_input = {
|
|||
.pairing_confirm = auth_pairing_confirm,
|
||||
.pairing_failed = auth_pairing_failed,
|
||||
.pairing_complete = auth_pairing_complete,
|
||||
#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
|
||||
.pairing_accept = pairing_accept,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct bt_conn_auth_cb auth_cb_confirm = {
|
||||
|
@ -1442,6 +1466,9 @@ static struct bt_conn_auth_cb auth_cb_confirm = {
|
|||
.pairing_confirm = auth_pairing_confirm,
|
||||
.pairing_failed = auth_pairing_failed,
|
||||
.pairing_complete = auth_pairing_complete,
|
||||
#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
|
||||
.pairing_accept = pairing_accept,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct bt_conn_auth_cb auth_cb_all = {
|
||||
|
@ -1456,6 +1483,9 @@ static struct bt_conn_auth_cb auth_cb_all = {
|
|||
.pairing_confirm = auth_pairing_confirm,
|
||||
.pairing_failed = auth_pairing_failed,
|
||||
.pairing_complete = auth_pairing_complete,
|
||||
#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
|
||||
.pairing_accept = pairing_accept,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct bt_conn_auth_cb auth_cb_oob = {
|
||||
|
@ -1470,6 +1500,9 @@ static struct bt_conn_auth_cb auth_cb_oob = {
|
|||
.pairing_confirm = NULL,
|
||||
.pairing_failed = auth_pairing_failed,
|
||||
.pairing_complete = auth_pairing_complete,
|
||||
#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
|
||||
.pairing_accept = pairing_accept,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue