diff options
author | Marcin Kraglak <marcin.kraglak@tieto.com> | 2014-01-10 10:18:27 +0100 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-01-16 12:23:15 +0200 |
commit | c64b9baa9998acec5c11aad02fc0bf10528bec78 (patch) | |
tree | 08ec4b517e097ec0111c85194472c6afdb1b5df7 | |
parent | 37a1b0fa3de57c903c6abd164bad5f8eb1dd25e3 (diff) |
emulator/bthost: Call rfcomm_connect_cb when connected
This will call connect callback when connected or failed to connect.
-rw-r--r-- | emulator/bthost.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/emulator/bthost.c b/emulator/bthost.c index ec6f6aa52..b66d25322 100644 --- a/emulator/bthost.c +++ b/emulator/bthost.c @@ -1586,6 +1586,15 @@ static void rfcomm_ua_recv(struct bthost *bthost, struct btconn *conn, rfcomm_fcs(buf); send_acl(bthost, conn->handle, l2conn->dcid, buf, sizeof(buf)); + } else if (bthost->rfcomm_conn_data && + bthost->rfcomm_conn_data->channel == channel) { + if (bthost->rfcomm_conn_data->cb) + bthost->rfcomm_conn_data->cb(conn->handle, + l2conn->scid, channel, + bthost->rfcomm_conn_data->user_data, + true); + free(bthost->rfcomm_conn_data); + bthost->rfcomm_conn_data = NULL; } } @@ -1593,6 +1602,19 @@ static void rfcomm_dm_recv(struct bthost *bthost, struct btconn *conn, struct l2conn *l2conn, const void *data, uint16_t len) { + const struct rfcomm_cmd *hdr = data; + uint8_t channel = RFCOMM_GET_CHANNEL(hdr->address); + + if (bthost->rfcomm_conn_data && + bthost->rfcomm_conn_data->channel == channel) { + if (bthost->rfcomm_conn_data->cb) + bthost->rfcomm_conn_data->cb(conn->handle, + l2conn->scid, channel, + bthost->rfcomm_conn_data->user_data, + false); + free(bthost->rfcomm_conn_data); + bthost->rfcomm_conn_data = NULL; + } } static void rfcomm_msc_recv(struct bthost *bthost, struct btconn *conn, |