} static void avrcp_get_element_attributes_rsp(void) { struct test_data *data = tester_get_data(); struct step *step = g_new0(struct step, 1); step->action_status = data->if_avrcp->get_element_attr_rsp(2, ele_attrs); schedule_action_verification(step); } static struct test_case test_cases[] = { TEST_CASE_BREDRLE("AVRCP Init", ACTION_SUCCESS(dummy_action, NULL), ), TEST_CASE_BREDRLE("AVRCP Connect - Success", ACTION_SUCCESS(bluetooth_enable_action, NULL), CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON), ACTION_SUCCESS(emu_setup_powered_remote_action, NULL), ACTION_SUCCESS(emu_set_ssp_mode_action, NULL), ACTION_SUCCESS(set_default_ssp_request_handler, NULL), ACTION_SUCCESS(emu_add_l2cap_server_action, &sdp_setup_data), ACTION_SUCCESS(emu_add_l2cap_server_action, &a2dp_setup_data), ACTION_SUCCESS(emu_add_l2cap_server_action, &avrcp_setup_data), ACTION_SUCCESS(avrcp_connect_action, NULL), CALLBACK_AV_CONN_STATE(CB_A2DP_CONN_STATE, BTAV_CONNECTION_STATE_CONNECTING), CALLBACK_AV_CONN_STATE(CB_A2DP_CONN_STATE, BTAV_CONNECTION_STATE_CONNECTED),
static void conn_cb(uint16_t handle, void *user_data) { struct test_data *data = tester_get_data(); struct bthost *bthost = hciemu_client_get_host(data->hciemu); tester_print("New connection with handle 0x%04x", handle); test_conn_handle = handle; bthost_request_auth(bthost, handle); } static struct test_case test_cases[] = { TEST_CASE_BREDRLE("Bluetooth Init", ACTION_SUCCESS(dummy_action, NULL), ), TEST_CASE_BREDRLE("Bluetooth Enable - Success", ACTION_SUCCESS(bluetooth_enable_action, NULL), CALLBACK_ADAPTER_PROPS(prop_emu_default_set, 8), CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON), ), TEST_CASE_BREDRLE("Bluetooth Enable - Success 2", ACTION_SUCCESS(bluetooth_enable_action, NULL), CALLBACK_ADAPTER_PROPS(prop_emu_default_set, 8), CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON), ACTION_SUCCESS(bluetooth_enable_action, NULL), ), TEST_CASE_BREDRLE("Bluetooth Disable - Success", ACTION_SUCCESS(bluetooth_enable_action, NULL), CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #include <stdbool.h> #include "emulator/bthost.h" #include "tester-main.h" static struct queue *list; /* List of gatt test cases */ static struct test_case test_cases[] = { TEST_CASE_BREDRLE("Gatt Init", ACTION_SUCCESS(dummy_action, NULL), ), }; struct queue *get_gatt_tests(void) { uint16_t i = 0; list = queue_new(); for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i) if (!queue_push_tail(list, &test_cases[i])) return NULL; return list; }
static void map_client_get_instances_action(void) { struct test_data *data = tester_get_data(); struct step *current_data_step = queue_peek_head(data->steps); bt_bdaddr_t *bd_addr = current_data_step->set_data; struct step *step = g_new0(struct step, 1); step->action_status = data->if_map_client->get_remote_mas_instances(bd_addr); schedule_action_verification(step); } static struct test_case test_cases[] = { TEST_CASE_BREDRLE("MAP Client Init", ACTION_SUCCESS(dummy_action, NULL), ), TEST_CASE_BREDRLE("MAP Client - Get mas instances success", ACTION_SUCCESS(bluetooth_enable_action, NULL), CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON), ACTION_SUCCESS(emu_setup_powered_remote_action, NULL), ACTION_SUCCESS(emu_add_l2cap_server_action, &l2cap_sdp_setup_data), ACTION_SUCCESS(emu_set_connect_cb_action, map_client_conn_cb), ACTION_SUCCESS(map_client_get_instances_action, &emu_remote_bdaddr_val), CALLBACK_MAP_CLIENT_REMOTE_MAS_INSTANCE(BT_STATUS_SUCCESS, NULL, 2, remote_map_inst_sms_mms_email_val), ACTION_SUCCESS(bluetooth_disable_action, NULL), CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF), ),
return; } ctrl_cid_data.cid = 0x40; ctrl_cid_data.handle = handle; tester_print("Sending L2CAP Request from remote"); bthost_l2cap_req(bthost, handle, 0x02, con_req.iov_base, con_req.iov_len, client_l2cap_rsp, &ctrl_cid_data); } static struct test_case test_cases[] = { TEST_CASE_BREDRLE("HidHost Init", ACTION_SUCCESS(dummy_action, NULL), ), TEST_CASE_BREDRLE("HidHost Connect Success", ACTION_SUCCESS(bluetooth_enable_action, NULL), CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON), ACTION_SUCCESS(emu_setup_powered_remote_action, NULL), ACTION_SUCCESS(emu_set_ssp_mode_action, NULL), ACTION_SUCCESS(emu_add_l2cap_server_action, &l2cap_setup_sdp_data), ACTION_SUCCESS(emu_add_l2cap_server_action, &l2cap_setup_cc_data), ACTION_SUCCESS(emu_add_l2cap_server_action, &l2cap_setup_ic_data), ACTION_SUCCESS(hidhost_connect_action, NULL), CALLBACK_STATE(CB_HH_CONNECTION_STATE, BTHH_CONN_STATE_CONNECTED),