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:
Andrei Emeltchenko 2016-05-30 10:24:48 +03:00 committed by Johan Hedberg
parent 0324f39313
commit 4a2afe4ade
3 changed files with 32 additions and 1 deletions

View file

@ -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 */

View file

@ -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(&params);
}
return 0;
}
int bt_smp_init(void)
{
BT_DBG("");

View file

@ -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);