drivers/nble: Implement pairing confirm callback
Implement bt_conn_auth_pairing_confirm() callback. Change-Id: I53f7fef05833e204e75aeb644efae8db10553e72 Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
parent
0324f39313
commit
4a2afe4ade
|
@ -384,7 +384,9 @@ int bt_conn_auth_passkey_confirm(struct bt_conn *conn)
|
|||
|
||||
int bt_conn_auth_pairing_confirm(struct bt_conn *conn)
|
||||
{
|
||||
return -ENOSYS;
|
||||
BT_DBG("");
|
||||
|
||||
return bt_smp_auth_pairing_confirm(conn);
|
||||
}
|
||||
|
||||
/* Connection related events */
|
||||
|
|
|
@ -438,6 +438,34 @@ int bt_smp_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_smp_auth_pairing_confirm(struct bt_conn *conn)
|
||||
{
|
||||
struct bt_smp *smp;
|
||||
struct nble_sm_pairing_response_req params;
|
||||
|
||||
BT_DBG("");
|
||||
|
||||
smp = smp_chan_get(conn);
|
||||
if (!smp) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!atomic_test_and_clear_bit(&smp->flags, SMP_FLAG_USER)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (conn->role == BT_CONN_ROLE_MASTER) {
|
||||
/* TODO: handle */
|
||||
} else {
|
||||
/* TODO: io caps, mitm */
|
||||
params.conn = conn;
|
||||
params.conn_handle = conn->handle;
|
||||
nble_sm_pairing_response_req(¶ms);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bt_smp_init(void)
|
||||
{
|
||||
BT_DBG("");
|
||||
|
|
|
@ -18,4 +18,5 @@ void bt_smp_connected(struct bt_conn *conn);
|
|||
void bt_smp_disconnected(struct bt_conn *conn);
|
||||
int bt_smp_init(void);
|
||||
|
||||
int bt_smp_auth_pairing_confirm(struct bt_conn *conn);
|
||||
int bt_smp_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey);
|
||||
|
|
Loading…
Reference in a new issue