tests: bluetooth: tester: Add support for pairing failed event
This event is sent if pairing failed. Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
This commit is contained in:
parent
47ac14282d
commit
7e0502ebe3
2 changed files with 21 additions and 0 deletions
|
@ -373,6 +373,13 @@ struct gap_bond_lost_ev {
|
|||
uint8_t address[6];
|
||||
} __packed;
|
||||
|
||||
#define GAP_EV_PAIRING_FAILED 0x8c
|
||||
struct gap_bond_pairing_failed_ev {
|
||||
uint8_t address_type;
|
||||
uint8_t address[6];
|
||||
uint8_t reason;
|
||||
} __packed;
|
||||
|
||||
/* GATT Service */
|
||||
/* commands */
|
||||
#define GATT_READ_SUPPORTED_COMMANDS 0x01
|
||||
|
|
|
@ -825,6 +825,19 @@ enum bt_security_err auth_pairing_accept(struct bt_conn *conn,
|
|||
return BT_SECURITY_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
void auth_pairing_failed(struct bt_conn *conn, enum bt_security_err reason)
|
||||
{
|
||||
struct gap_bond_pairing_failed_ev ev;
|
||||
const bt_addr_le_t *addr = bt_conn_get_dst(conn);
|
||||
|
||||
memcpy(ev.address, addr->a.val, sizeof(ev.address));
|
||||
ev.address_type = addr->type;
|
||||
ev.reason = reason;
|
||||
|
||||
tester_send(BTP_SERVICE_ID_GAP, GAP_EV_PAIRING_FAILED, CONTROLLER_INDEX,
|
||||
(uint8_t *)&ev, sizeof(ev));
|
||||
}
|
||||
|
||||
static void set_io_cap(const uint8_t *data, uint16_t len)
|
||||
{
|
||||
const struct gap_set_io_cap_cmd *cmd = (void *) data;
|
||||
|
@ -862,6 +875,7 @@ static void set_io_cap(const uint8_t *data, uint16_t len)
|
|||
}
|
||||
|
||||
cb.pairing_accept = auth_pairing_accept;
|
||||
cb.pairing_failed = auth_pairing_failed;
|
||||
|
||||
if (bt_conn_auth_cb_register(&cb)) {
|
||||
status = BTP_STATUS_FAILED;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue