From 670d0ed2fd762b5ad2ea6d6a290404b7cd0e37d7 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Sep 2013 21:42:14 +0300 Subject: [PATCH] emulator: Add LE Connection Complete handling to bthost --- emulator/bthost.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/emulator/bthost.c b/emulator/bthost.c index 952faf300..ab055bbf2 100644 --- a/emulator/bthost.c +++ b/emulator/bthost.c @@ -552,15 +552,33 @@ static void evt_num_completed_packets(struct bthost *bthost, const void *data, return; } +static void evt_le_conn_complete(struct bthost *bthost, const void *data, + uint8_t len) +{ + const struct bt_hci_evt_le_conn_complete *ev = data; + + if (len < sizeof(*ev)) + return; + + if (ev->status) + return; + + init_conn(bthost, le16_to_cpu(ev->handle)); +} + static void evt_le_meta_event(struct bthost *bthost, const void *data, uint8_t len) { const uint8_t *event = data; + const void *evt_data = data + 1; if (len < 1) return; switch (*event) { + case BT_HCI_EVT_LE_CONN_COMPLETE: + evt_le_conn_complete(bthost, evt_data, len - 1); + break; default: break; } -- 2.47.3