static void setup_powered_client_callback(uint8_t status, uint16_t length, const void *param, void *user_data) { struct test_data *data = tester_get_data(); const struct l2cap_data *l2data = data->test_data; struct bthost *bthost; if (status != MGMT_STATUS_SUCCESS) { tester_setup_failed(); return; } tester_print("Controller powered on"); bthost = hciemu_client_get_host(data->hciemu); bthost_set_cmd_complete_cb(bthost, client_cmd_complete, user_data); if (data->hciemu_type == HCIEMU_TYPE_LE) { if (!l2data || !l2data->server_not_advertising) bthost_set_adv_enable(bthost, 0x01); else tester_setup_complete(); } else { bthost_write_scan_enable(bthost, 0x03); } }
static gboolean enable_advertising(gpointer args) { struct test_data *data = tester_get_data(); struct bthost *bthost = hciemu_client_get_host(data->hciemu); bthost_set_adv_enable(bthost, 0x01); return FALSE; }
static gboolean test_close_socket_2_part_2(gpointer arg) { struct test_data *data = tester_get_data(); struct bthost *bthost = hciemu_client_get_host(data->hciemu); /* Make sure CMD_LE_CREATE_CONN will not immediately result in * BT_HCI_EVT_CONN_COMPLETE. */ hciemu_add_hook(data->hciemu, HCIEMU_HOOK_PRE_EVT, BT_HCI_CMD_LE_CREATE_CONN, test_close_socket_cc_hook, NULL); /* Advertise once. After that, kernel should stop scanning, and trigger * BT_HCI_CMD_LE_CREATE_CONN_CANCEL. */ bthost_set_adv_enable(bthost, 0x01); bthost_set_adv_enable(bthost, 0x00); return FALSE; }
static void setup_powered_client_callback(uint8_t status, uint16_t length, const void *param, void *user_data) { struct test_data *data = tester_get_data(); struct bthost *bthost; if (status != MGMT_STATUS_SUCCESS) { tester_setup_failed(); return; } tester_print("Controller powered on"); bthost = hciemu_client_get_host(data->hciemu); bthost_set_cmd_complete_cb(bthost, client_connectable_complete, data); bthost_set_adv_enable(bthost, 0x01, 0x00); }