} 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 interfaces[i] ? interfaces[i]->name : NULL;
EXEC(if_gatt->init, &gatt_cbacks); } /* cleanup */ static void cleanup_p(int argc, const char **argv) { RETURN_IF_NULL(if_gatt); EXECV(if_gatt->cleanup); if_gatt = NULL; } static struct method methods[] = { STD_METHOD(init), STD_METHOD(cleanup), END_METHOD }; const struct interface gatt_if = { .name = "gatt", .methods = methods }; /* register_client */ static void register_client_p(int argc, const char **argv) { bt_uuid_t uuid;
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",
uint8_t mode; RETURN_IF_NULL(if_bluetooth); if (argc <= 2) { 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>"),
if (argc < 3) return; stream_out->common.set_sample_rate(&stream_out->common, atoi(argv[2])); } static void init_check_p(int argc, const char **argv) { RETURN_IF_NULL(if_audio); haltest_info("Init check result: %d\n", if_audio->init_check(if_audio)); } static struct method methods[] = { STD_METHOD(init), STD_METHOD(cleanup), STD_METHOD(open_output_stream), STD_METHOD(close_output_stream), STD_METHODH(play, "<path to pcm file>"), STD_METHOD(stop), STD_METHOD(suspend), STD_METHOD(resume), STD_METHOD(get_latency), STD_METHOD(get_buffer_size), STD_METHOD(get_channels), STD_METHOD(get_format), STD_METHOD(get_sample_rate), STD_METHODH(get_parameters, "<A2dpSuspended;closing>"), STD_METHODH(set_parameters, "<A2dpSuspended=value;closing=value>"), STD_METHODH(set_sample_rate, "<sample rate>"),
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 };
RETURN_IF_NULL(if_hf_client); 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),
EXEC(if_hf->phone_state_change, num_active, num_held, call_setup_state, 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,
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 };