Bluetooth: Fix not calling connected callback on connect failed

If LE Create Connection fails notify application that connection
failed.

Change-Id: I3993bcb1bf3f8bd8fc08546e1fe683326b47db5b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2016-02-17 11:36:41 +01:00 committed by Gerrit Code Review
commit 4dfb50e514
3 changed files with 7 additions and 0 deletions

View file

@ -68,6 +68,7 @@ static inline void bt_addr_le_copy(bt_addr_le_t *dst, const bt_addr_le_t *src)
#define BT_HCI_ERR_REMOTE_USER_TERM_CONN 0x13
#define BT_HCI_ERR_UNSUPP_REMOTE_FEATURE 0x1a
#define BT_HCI_ERR_INVALID_LL_PARAMS 0x1e
#define BT_HCI_ERR_UNSPECIFIED 0x1f
#define BT_HCI_ERR_PAIRING_NOT_SUPPORTED 0x29
#define BT_HCI_ERR_UNACCEPT_CONN_PARAMS 0x3b

View file

@ -673,6 +673,9 @@ void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state)
} else if (old_state == BT_CONN_CONNECT) {
/* conn->err will be set in this case */
notify_connected(conn);
} else if (old_state == BT_CONN_CONNECT_SCAN && conn->err) {
/* this indicate LE Create Connection failed */
notify_connected(conn);
}
/* Release the reference we took for the very first

View file

@ -746,6 +746,9 @@ static void check_pending_conn(const bt_addr_le_t *id_addr,
bt_addr_le_copy(&conn->le.resp_addr, addr);
if (hci_le_create_conn(conn)) {
conn->err = BT_HCI_ERR_UNSPECIFIED;
bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
bt_le_scan_update(false);
goto done;
}