drivers/nble: Cancel connect req when receiving disconnect cmd

Cancel ongoing connect request when we receive disconnect command.

Change-Id: I12f1c1326c4b13672879b8f2dbe457cae395b486
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
Andrei Emeltchenko 2016-02-17 12:07:38 +02:00
commit 1138996744

View file

@ -136,7 +136,7 @@ int bt_conn_disconnect(struct bt_conn *conn, uint8_t reason)
switch (conn->state) { switch (conn->state) {
case BT_CONN_CONNECT: case BT_CONN_CONNECT:
/* TODO: Cancel connecting */ nble_gap_cancel_connect_req(conn);
return 0; return 0;
case BT_CONN_CONNECTED: case BT_CONN_CONNECTED:
break; break;
@ -168,6 +168,16 @@ void on_nble_gap_disconnect_rsp(const struct nble_response *rsp)
BT_DBG("conn %p", rsp->user_data); BT_DBG("conn %p", rsp->user_data);
} }
void on_nble_gap_cancel_connect_rsp(const struct nble_response *rsp)
{
if (rsp->status) {
BT_ERR("Cancel connect failed, status %d", rsp->status);
return;
}
BT_DBG("conn %p", rsp->user_data);
}
static inline bool bt_le_conn_params_valid(uint16_t min, uint16_t max, static inline bool bt_le_conn_params_valid(uint16_t min, uint16_t max,
uint16_t latency, uint16_t timeout) uint16_t latency, uint16_t timeout)
{ {