emulator: Add connect request handling to bthost

This commit is contained in:
Johan Hedberg 2013-05-26 04:24:30 +01:00
parent 3f86576f48
commit d4a0ce5186

View File

@ -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;