Bluetooth: Add callback for identity resolution
This callback is called if identity was resolved for remote device that was using Resolvable Private Address while connection. From now on only Identity Address is used. Change-Id: I5976be575a8e4ad8c13f56d7bc274d751ae37511 Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
parent
81c445c02e
commit
393dad0ccf
4 changed files with 26 additions and 0 deletions
|
@ -138,6 +138,9 @@ int bt_conn_security(struct bt_conn *conn, bt_security_t sec);
|
|||
struct bt_conn_cb {
|
||||
void (*connected)(struct bt_conn *conn);
|
||||
void (*disconnected)(struct bt_conn *conn);
|
||||
void (*identity_resolved)(struct bt_conn *conn,
|
||||
const bt_addr_le_t *rpa,
|
||||
const bt_addr_le_t *identity);
|
||||
|
||||
struct bt_conn_cb *_next;
|
||||
};
|
||||
|
|
|
@ -102,6 +102,24 @@ static void bt_conn_disconnected(struct bt_conn *conn)
|
|||
}
|
||||
}
|
||||
|
||||
void bt_conn_identity_resolved(struct bt_conn *conn)
|
||||
{
|
||||
const bt_addr_le_t *rpa;
|
||||
struct bt_conn_cb *cb;
|
||||
|
||||
if (conn->role == BT_HCI_ROLE_MASTER) {
|
||||
rpa = &conn->resp_addr;
|
||||
} else {
|
||||
rpa = &conn->init_addr;
|
||||
}
|
||||
|
||||
for (cb = callback_list; cb; cb = cb->_next) {
|
||||
if (cb->identity_resolved) {
|
||||
cb->identity_resolved(conn, rpa, &conn->dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bt_conn_cb_register(struct bt_conn_cb *cb)
|
||||
{
|
||||
cb->_next = callback_list;
|
||||
|
|
|
@ -128,3 +128,6 @@ int bt_conn_le_conn_update(struct bt_conn *conn, uint16_t min, uint16_t max,
|
|||
|
||||
/* Notify higher layers of a new connection */
|
||||
void bt_conn_connected(struct bt_conn *conn);
|
||||
|
||||
/* Notify higher layers that RPA was resolved */
|
||||
void bt_conn_identity_resolved(struct bt_conn *conn);
|
||||
|
|
|
@ -1029,6 +1029,8 @@ static uint8_t smp_ident_addr_info(struct bt_conn *conn, struct bt_buf *buf)
|
|||
bt_addr_copy(&keys->irk.rpa, (bt_addr_t *)&conn->dst.val);
|
||||
bt_addr_le_copy(&keys->addr, &req->addr);
|
||||
bt_addr_le_copy(&conn->dst, &req->addr);
|
||||
|
||||
bt_conn_identity_resolved(conn);
|
||||
}
|
||||
|
||||
smp->remote_dist &= ~BT_SMP_DIST_ID_KEY;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue