From d4a0ce51860b290cc67f0cb10933091a6a973be0 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sun, 26 May 2013 04:24:30 +0100 Subject: [PATCH] emulator: Add connect request handling to bthost --- emulator/bthost.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/emulator/bthost.c b/emulator/bthost.c index af7f7df3f..312eb2988 100644 --- a/emulator/bthost.c +++ b/emulator/bthost.c @@ -255,6 +255,22 @@ static void evt_cmd_status(struct bthost *bthost, const void *data, next_cmd(bthost); } +static void evt_conn_request(struct bthost *bthost, const void *data, + uint8_t len) +{ + const struct bt_hci_evt_conn_request *ev = data; + struct bt_hci_cmd_accept_conn_request cmd; + + if (len < sizeof(*ev)) + return; + + memset(&cmd, 0, sizeof(cmd)); + memcpy(cmd.bdaddr, ev->bdaddr, sizeof(ev->bdaddr)); + + send_command(bthost, BT_HCI_CMD_ACCEPT_CONN_REQUEST, &cmd, + sizeof(cmd)); +} + static void process_evt(struct bthost *bthost, const void *data, uint16_t len) { const struct bt_hci_evt_hdr *hdr = data; @@ -277,6 +293,10 @@ static void process_evt(struct bthost *bthost, const void *data, uint16_t len) evt_cmd_status(bthost, param, hdr->plen); break; + case BT_HCI_EVT_CONN_REQUEST: + evt_conn_request(bthost, param, hdr->plen); + break; + default: printf("Unsupported event 0x%2.2x\n", hdr->evt); break; -- 2.47.3