Bluetooth: shell: Add bond_deleted callback

Add the bond_deleted callback to the bluetooth shell.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2020-07-15 12:33:01 +02:00 committed by Carles Cufí
commit d6b526a038
2 changed files with 16 additions and 0 deletions

View file

@ -2649,9 +2649,11 @@ static void unpair(uint8_t id, const bt_addr_le_t *addr)
bt_gatt_clear(id, addr); bt_gatt_clear(id, addr);
#if defined(CONFIG_BT_SMP) || defined(CONFIG_BT_BREDR)
if (bt_auth && bt_auth->bond_deleted) { if (bt_auth && bt_auth->bond_deleted) {
bt_auth->bond_deleted(id, addr); bt_auth->bond_deleted(id, addr);
} }
#endif /* defined(CONFIG_BT_SMP) || defined(CONFIG_BT_BREDR) */
} }
static void unpair_remote(const struct bt_bond_info *info, void *data) static void unpair_remote(const struct bt_bond_info *info, void *data)

View file

@ -2055,6 +2055,14 @@ enum bt_security_err pairing_accept(
} }
#endif /* CONFIG_BT_SMP_APP_PAIRING_ACCEPT */ #endif /* CONFIG_BT_SMP_APP_PAIRING_ACCEPT */
void bond_deleted(uint8_t id, const bt_addr_le_t *peer)
{
char addr[BT_ADDR_STR_LEN];
bt_addr_le_to_str(peer, addr, sizeof(addr));
shell_print(ctx_shell, "Bond deleted for %s, id %u", addr, id);
}
static struct bt_conn_auth_cb auth_cb_display = { static struct bt_conn_auth_cb auth_cb_display = {
.passkey_display = auth_passkey_display, .passkey_display = auth_passkey_display,
.passkey_entry = NULL, .passkey_entry = NULL,
@ -2070,6 +2078,7 @@ static struct bt_conn_auth_cb auth_cb_display = {
#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT) #if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
.pairing_accept = pairing_accept, .pairing_accept = pairing_accept,
#endif #endif
.bond_deleted = bond_deleted,
}; };
static struct bt_conn_auth_cb auth_cb_display_yes_no = { static struct bt_conn_auth_cb auth_cb_display_yes_no = {
@ -2087,6 +2096,7 @@ static struct bt_conn_auth_cb auth_cb_display_yes_no = {
#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT) #if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
.pairing_accept = pairing_accept, .pairing_accept = pairing_accept,
#endif #endif
.bond_deleted = bond_deleted,
}; };
static struct bt_conn_auth_cb auth_cb_input = { static struct bt_conn_auth_cb auth_cb_input = {
@ -2104,6 +2114,7 @@ static struct bt_conn_auth_cb auth_cb_input = {
#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT) #if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
.pairing_accept = pairing_accept, .pairing_accept = pairing_accept,
#endif #endif
.bond_deleted = bond_deleted,
}; };
static struct bt_conn_auth_cb auth_cb_confirm = { static struct bt_conn_auth_cb auth_cb_confirm = {
@ -2118,6 +2129,7 @@ static struct bt_conn_auth_cb auth_cb_confirm = {
#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT) #if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
.pairing_accept = pairing_accept, .pairing_accept = pairing_accept,
#endif #endif
.bond_deleted = bond_deleted,
}; };
static struct bt_conn_auth_cb auth_cb_all = { static struct bt_conn_auth_cb auth_cb_all = {
@ -2135,6 +2147,7 @@ static struct bt_conn_auth_cb auth_cb_all = {
#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT) #if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
.pairing_accept = pairing_accept, .pairing_accept = pairing_accept,
#endif #endif
.bond_deleted = bond_deleted,
}; };
static struct bt_conn_auth_cb auth_cb_oob = { static struct bt_conn_auth_cb auth_cb_oob = {
@ -2152,6 +2165,7 @@ static struct bt_conn_auth_cb auth_cb_oob = {
#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT) #if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
.pairing_accept = pairing_accept, .pairing_accept = pairing_accept,
#endif #endif
.bond_deleted = bond_deleted,
}; };