static void test_client(const void *test_data) { struct test_data *data = tester_get_data(); const struct smp_data *smp = data->test_data; struct mgmt_cp_pair_device cp; struct bthost *bthost; init_bdaddr(data); bthost = hciemu_client_get_host(data->hciemu); bthost_set_connect_cb(bthost, smp_new_conn, data); test_add_condition(data); if (smp->expect_hci_command) { tester_print("Registering HCI command callback"); hciemu_add_master_post_command_hook(data->hciemu, command_hci_callback, data); test_add_condition(data); } memcpy(&cp.addr.bdaddr, data->ra, sizeof(data->ra)); cp.addr.type = BDADDR_LE_PUBLIC; if (smp->mitm) cp.io_cap = 0x04; /* KeyboardDisplay */ else cp.io_cap = 0x03; /* NoInputNoOutput */ mgmt_send(data->mgmt, MGMT_OP_PAIR_DEVICE, data->mgmt_index, sizeof(cp), &cp, pair_device_complete, NULL, NULL); tester_print("Pairing in progress"); }
static void test_server(const void *test_data) { struct test_data *data = tester_get_data(); struct bthost *bthost; data->out = true; init_bdaddr(data); bthost = hciemu_client_get_host(data->hciemu); bthost_set_connect_cb(bthost, smp_new_conn, data); bthost_hci_connect(bthost, data->ra, BDADDR_LE_PUBLIC); }
static void test_server(const void *test_data) { struct test_data *data = tester_get_data(); const struct smp_data *smp = data->test_data; struct bthost *bthost; data->out = true; init_bdaddr(data); bthost = hciemu_client_get_host(data->hciemu); bthost_set_connect_cb(bthost, smp_new_conn, data); test_add_condition(data); bthost_hci_connect(bthost, data->ra, BDADDR_LE_PUBLIC); if (smp->expect_hci_command) { tester_print("Registering HCI command callback"); hciemu_add_master_post_command_hook(data->hciemu, command_hci_callback, data); test_add_condition(data); } }