poll_register_fd(fd_stack[fd_stack_pointer - 1], POLLIN, stdin_handler); } static void source_p(int argc, const char **argv) { if (argc < 2) { haltest_error("No file specified"); return; } process_file(argv[1]); } /* Commands available without interface */ static struct method commands[] = { STD_METHODCH(help, "[<interface>]"), STD_METHOD(quit), METHOD("exit", quit_p, NULL, NULL), STD_METHODH(source, "<file>"), END_METHOD }; /* Gets comman by name */ struct method *get_command(const char *name) { return get_method(commands, name); } /* Function to enumerate interface names */ const char *interface_name(void *v, int i) {
return; } command = atoi(argv[2]); VERIFY_ADDR_ARG(3, &bd_addr); VERIFY_UUID(4, &uuid); for (i = 5; i < argc; i++) VERIFY_TEST_ARG(i, *u++); EXEC(if_gatt->client->test_command, command, ¶ms); } static struct method client_methods[] = { STD_METHODH(register_client, "[<uuid>]"), STD_METHODCH(unregister_client, "<client_if>"), STD_METHODCH(scan, "<client_if> [1|0]"), STD_METHODCH(connect, "<client_if> <addr> [<is_direct>]"), STD_METHODCH(disconnect, "<client_if> <addr> <conn_id>"), STD_METHODCH(refresh, "<client_if> <addr>"), STD_METHODCH(search_service, "<conn_id> [<uuid>]"), STD_METHODCH(get_included_service, "<conn_id> <srvc_id>"), STD_METHODCH(get_characteristic, "<conn_id> <srvc_id>"), STD_METHODCH(get_descriptor, "<conn_id> <srvc_id> <char_id>"), STD_METHODCH(read_characteristic, "<conn_id> <srvc_id> <char_id> [<auth_req>]"), STD_METHODCH(write_characteristic, "<conn_id> <srvc_id> <char_id> <write_type> <hex_value> [<auth_req>]"), STD_METHODCH(read_descriptor, "<conn_id> <srvc_id> <char_id> <descr_id> [<auth_req>]"), STD_METHODCH(write_descriptor,
EXEC(if_rc->register_notification_rsp, event_id, type, ®); } /* cleanup */ static void cleanup_p(int argc, const char **argv) { RETURN_IF_NULL(if_rc); EXECV(if_rc->cleanup); if_rc = NULL; } static struct method methods[] = { STD_METHOD(init), STD_METHODCH(get_play_status_rsp, "<play_status> <song_len> <song_pos>"), STD_METHODCH(get_element_attr_rsp, "<num_attr> <attrs_id> <value>"), STD_METHODCH(set_player_app_value_rsp, "<rsp_status>"), STD_METHODCH(set_volume, "<volume>"), STD_METHODCH(register_notification_rsp, "<event_id> <type> <respective_data...>\n" "BTRC_EVT_PLAY_STATUS_CHANGED <type> <play_status>\n" "BTRC_EVT_TRACK_CHANGE <type> <track>\n" "BTRC_EVT_TRACK_REACHED_END <type>\n" "BTRC_EVT_TRACK_REACHED_START <type>\n" "BTRC_EVT_PLAY_POS_CHANGED <type> <song_pos>\n"), STD_METHOD(cleanup), END_METHOD }; const struct interface rc_if = {
bt_bdaddr_t addr; RETURN_IF_NULL(if_hh); VERIFY_ADDR_ARG(2, &addr); EXEC(if_av->disconnect, &addr); } /* cleanup */ static void cleanup_p(int argc, const char **argv) { RETURN_IF_NULL(if_av); EXECV(if_av->cleanup); if_av = NULL; } static struct method methods[] = { STD_METHOD(init), STD_METHODCH(connect, "<addr>"), STD_METHODCH(disconnect, "<addr>"), STD_METHOD(cleanup), END_METHOD }; const struct interface av_if = { .name = "av", .methods = methods };
EXEC(if_hh->send_data, &addr, (char *) argv[3]); } /* cleanup */ static void cleanup_p(int argc, const char **argv) { RETURN_IF_NULL(if_hh); EXECV(if_hh->cleanup); } /* Methods available in bthh_interface_t */ static struct method methods[] = { STD_METHOD(init), STD_METHODCH(connect, "<addr>"), STD_METHODCH(disconnect, "<addr>"), STD_METHODCH(virtual_unplug, "<addr>"), STD_METHOD(set_info), STD_METHODCH(get_protocol, "<addr> <mode>"), STD_METHODCH(set_protocol, "<addr> <mode>"), STD_METHODCH(get_report, "<addr> <type> <report_id> <size>"), STD_METHODCH(set_report, "<addr> <type> <hex_encoded_report>"), STD_METHODCH(send_data, "<addr> <hex_encoded_data>"), STD_METHOD(cleanup), END_METHOD }; const struct interface hh_if = { .name = "hidhost", .methods = methods
haltest_error("No mode specified\n"); return; } mode = strtol(argv[2], NULL, 0); EXEC(if_bluetooth->config_hci_snoop_log, mode); } static struct method methods[] = { STD_METHOD(init), STD_METHOD(cleanup), STD_METHOD(enable), STD_METHOD(disable), STD_METHOD(get_adapter_properties), STD_METHODCH(get_adapter_property, "<prop_type>"), STD_METHODCH(set_adapter_property, "<prop_type> <prop_value>"), STD_METHODCH(get_remote_device_properties, "<addr>"), STD_METHODCH(get_remote_device_property, "<addr> <property_type>"), STD_METHODCH(set_remote_device_property, "<addr> <property_type> <value>"), STD_METHODCH(get_remote_service_record, "<addr> <uuid>"), STD_METHODCH(get_remote_services, "<addr>"), STD_METHOD(start_discovery), STD_METHOD(cancel_discovery), STD_METHODCH(create_bond, "<addr>"), STD_METHODCH(remove_bond, "<addr>"), STD_METHODCH(cancel_bond, "<addr>"), STD_METHODCH(pin_reply, "<address> [<pin>]"), STD_METHODCH(ssp_reply, "<address> <ssp_veriant> 1|0 [<passkey>]"), STD_METHODCH(get_profile_interface, "<profile id>"),
RETURN_IF_NULL(if_sock); EXEC(if_sock->connect, &addr, type, &uuid.uu[0], channel, &sock_fd, flags); if (sock_fd > 0) { int channel = 0; int ret = read(sock_fd, &channel, 4); if (ret != 4) haltest_info("Read channel failed\n"); haltest_info("Channel returned from first read %d\n", channel); listen_fd[listen_fd_count++] = sock_fd; poll_register_fd(sock_fd, POLLIN, receive_sock_connect_signal); } } /* Methods available in btsock_interface_t */ static struct method methods[] = { STD_METHODCH(listen, "<sock_type> <srvc_name> <uuid> [<channel>] [<flags>]"), STD_METHODCH(connect, "<addr> <sock_type> <uuid> <channel> [<flags>]"), END_METHOD }; const struct interface sock_if = { .name = "socket", .methods = methods };
RETURN_IF_NULL(if_pan); VERIFY_ADDR_ARG(2, &addr); EXEC(if_pan->disconnect, &addr); } /* cleanup */ static void cleanup_p(int argc, const char **argv) { RETURN_IF_NULL(if_pan); EXECV(if_pan->cleanup); if_pan = NULL; } static struct method methods[] = { STD_METHOD(init), STD_METHODCH(connect, "<addr> <local_role> <remote_role>"), STD_METHODCH(enable, "<local_role>"), STD_METHOD(get_local_role), STD_METHODCH(disconnect, "<addr>"), STD_METHOD(cleanup), END_METHOD }; const struct interface pan_if = { .name = "pan", .methods = methods };
EXEC(if_hf_client->request_last_voice_tag_number); } /* Closes the interface. */ static void cleanup_p(int argc, const char **argv) { RETURN_IF_NULL(if_hf_client); EXECV(if_hf_client->cleanup); if_hf_client = NULL; } static struct method methods[] = { STD_METHOD(init), STD_METHODCH(connect, "<addr>"), STD_METHODCH(disconnect, "<addr>"), STD_METHODCH(connect_audio, "<addr>"), STD_METHODCH(disconnect_audio, "<addr>"), STD_METHOD(start_voice_recognition), STD_METHOD(stop_voice_recognition), STD_METHODCH(volume_control, "<volume_type> <value>"), STD_METHODH(dial, "<destination_number>"), STD_METHODH(dial_memory, "<memory_location>"), STD_METHODCH(handle_call_action, "<call_action> <call_index>"), STD_METHOD(query_current_calls), STD_METHOD(query_current_operator_name), STD_METHOD(retrieve_subscriber_info), STD_METHODH(send_dtmf, "<code>"), STD_METHOD(request_last_voice_tag_number), STD_METHOD(cleanup),
number, type); } /* cleanup */ static void cleanup_p(int argc, const char **argv) { RETURN_IF_NULL(if_hf); EXECV(if_hf->cleanup); if_hf = NULL; } static struct method methods[] = { STD_METHOD(init), STD_METHODCH(connect, "<addr>"), STD_METHODCH(disconnect, "<addr>"), STD_METHODCH(connect_audio, "<addr>"), STD_METHODCH(disconnect_audio, "<addr>"), STD_METHOD(start_voice_recognition), STD_METHOD(stop_voice_recognition), STD_METHODCH(volume_control, "<vol_type> <volume>"), STD_METHODCH(device_status_notification, "<ntk_state> <svt_type> <signal> <batt_chg>"), STD_METHODH(cops_response, "<cops string>"), STD_METHODCH(cind_response, "<svc> <num_active> <num_held> <setup_state> <signal> <roam> <batt_chg>"), STD_METHODH(formatted_at_response, "<at_response>"), STD_METHODCH(at_response, "<response_code> [<error_code>]"), STD_METHODCH(clcc_response, "<index> <direction> <state> <mode> <mpty> <number> <type>"),
enum_func *enum_func, void **user) { if (argc == 3) { *user = NULL; *enum_func = enum_devices; } } /* search for MAS instances on remote device */ static void get_remote_mas_instances_p(int argc, const char **argv) { bt_bdaddr_t addr; RETURN_IF_NULL(if_mce); VERIFY_ADDR_ARG(2, &addr); EXEC(if_mce->get_remote_mas_instances, &addr); } static struct method methods[] = { STD_METHOD(init), STD_METHODCH(get_remote_mas_instances, "<addr>"), END_METHOD }; const struct interface mce_if = { .name = "mce", .methods = methods };