hfp test: write user commands to the log file

This commit is contained in:
Milanka Ringwald 2015-12-04 16:49:21 +01:00
parent 3723a70091
commit c926bcaeb6
3 changed files with 102 additions and 42 deletions

View File

@ -74,6 +74,13 @@ with open (infile, 'rb') as fin:
print separator+spaces+"\""+cmd+"\"",
separator = ",\n"
else:
parts = re.match('USER:\'(.*)\'.*',packet)
if parts:
cmd = 'USER:'+parts.groups()[0]
print separator+spaces+"\""+cmd+"\"",
separator = ",\n"
except TypeError:
print "\n};\n"

View File

@ -354,38 +354,38 @@ static int stdin_process(struct data_source *ds){
switch (cmd){
case 'a':
memcpy(device_addr, pts_addr, 6);
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Establish HFP service level connection to PTS module %s...\n", bd_addr_to_str(device_addr));
hfp_ag_establish_service_level_connection(device_addr);
break;
case 'A':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Release HFP service level connection.\n");
hfp_ag_release_service_level_connection(device_addr);
break;
case 'z':
memcpy(device_addr, speaker_addr, 6);
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Establish HFP service level connection to %s...\n", bd_addr_to_str(device_addr));
hfp_ag_establish_service_level_connection(device_addr);
break;
case 'Z':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Release HFP service level connection to %s...\n", bd_addr_to_str(device_addr));
hfp_ag_release_service_level_connection(device_addr);
break;
case 'b':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Establish Audio connection %s...\n", bd_addr_to_str(device_addr));
hfp_ag_establish_audio_connection(device_addr);
break;
case 'B':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Release Audio connection.\n");
hfp_ag_release_audio_connection(device_addr);
break;
case 'c':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Simulate incoming call from 1234567\n");
current_call_exists_a = 1;
current_call_status_a = HFP_ENHANCED_CALL_STATUS_INCOMING;
@ -394,7 +394,7 @@ static int stdin_process(struct data_source *ds){
hfp_ag_incoming_call();
break;
case 'm':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Simulate incoming call from 7654321\n");
current_call_exists_b = 1;
current_call_status_b = HFP_ENHANCED_CALL_STATUS_INCOMING;
@ -403,17 +403,17 @@ static int stdin_process(struct data_source *ds){
hfp_ag_incoming_call();
break;
case 'C':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Simulate terminate call\n");
hfp_ag_call_dropped();
break;
case 'd':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Report AG failure\n");
hfp_ag_report_extended_audio_gateway_error_result_code(device_addr, HFP_CME_ERROR_AG_FAILURE);
break;
case 'e':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Answer call on AG\n");
if (current_call_status_a == HFP_ENHANCED_CALL_STATUS_INCOMING){
current_call_status_a = HFP_ENHANCED_CALL_STATUS_ACTIVE;
@ -424,142 +424,142 @@ static int stdin_process(struct data_source *ds){
hfp_ag_answer_incoming_call();
break;
case 'E':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Reject call on AG\n");
hfp_ag_terminate_call();
break;
case 'f':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Disable cellular network\n");
hfp_ag_set_registration_status(0);
break;
case 'F':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Enable cellular network\n");
hfp_ag_set_registration_status(1);
break;
case 'g':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Set signal strength to 0\n");
hfp_ag_set_signal_strength(0);
break;
case 'G':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Set signal strength to 5\n");
hfp_ag_set_signal_strength(5);
break;
case 'h':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Disable roaming\n");
hfp_ag_set_roaming_status(0);
break;
case 'H':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Enable roaming\n");
hfp_ag_set_roaming_status(1);
break;
case 'i':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Set battery level to 3\n");
hfp_ag_set_battery_level(3);
break;
case 'I':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Set battery level to 5\n");
hfp_ag_set_battery_level(5);
break;
case 'j':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Answering call on remote side\n");
hfp_ag_outgoing_call_established();
break;
case 'r':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Disable in-band ring tone\n");
hfp_ag_set_use_in_band_ring_tone(0);
break;
case 'k':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Memory 1 cleared\n");
memory_1_enabled = 0;
break;
case 'K':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Memory 1 set\n");
memory_1_enabled = 1;
break;
case 'l':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Last dialed number cleared\n");
last_number_exists = 0;
break;
case 'L':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Last dialed number set\n");
last_number_exists = 1;
break;
case 'n':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Disable Voice Recognition\n");
hfp_ag_activate_voice_recognition(device_addr, 0);
break;
case 'N':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Enable Voice Recognition\n");
hfp_ag_activate_voice_recognition(device_addr, 1);
break;
case 'o':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Set speaker gain to 0 (minimum)\n");
hfp_ag_set_speaker_gain(device_addr, 0);
break;
case 'O':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Set speaker gain to 9 (default)\n");
hfp_ag_set_speaker_gain(device_addr, 9);
break;
case 'p':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Set speaker gain to 12 (higher)\n");
hfp_ag_set_speaker_gain(device_addr, 12);
break;
case 'P':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Set speaker gain to 15 (maximum)\n");
hfp_ag_set_speaker_gain(device_addr, 15);
break;
case 'q':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Set microphone gain to 0\n");
hfp_ag_set_microphone_gain(device_addr, 0);
break;
case 'Q':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Set microphone gain to 9\n");
hfp_ag_set_microphone_gain(device_addr, 9);
break;
case 's':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Set microphone gain to 12\n");
hfp_ag_set_microphone_gain(device_addr, 12);
break;
case 'S':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Set microphone gain to 15\n");
hfp_ag_set_microphone_gain(device_addr, 15);
break;
case 'R':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Enable in-band ring tone\n");
hfp_ag_set_use_in_band_ring_tone(1);
break;
case 't':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Terminate HCI connection.\n");
gap_disconnect(handle);
break;
case 'u':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("Join held call\n");
current_call_mpty = HFP_ENHANCED_CALL_MPTY_CONFERENCE_CALL;
hfp_ag_join_held_call();
@ -568,17 +568,17 @@ static int stdin_process(struct data_source *ds){
start_scan();
break;
case 'w':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("AG: Put incoming call on hold (Response and Hold)\n");
hfp_ag_hold_incoming_call();
break;
case 'x':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("AG: Accept held incoming call (Response and Hold)\n");
hfp_ag_accept_held_incoming_call();
break;
case 'X':
printf("USER:%c ", cmd);
log_info("USER:\'%c\'", cmd);
printf("AG: Reject held incoming call (Response and Hold)\n");
hfp_ag_reject_held_incoming_call();
break;

View File

@ -187,213 +187,266 @@ static int stdin_process(struct data_source *ds){
case '-':
case '+':
case '*':
log_info("USER:\'%c\'", cmd);
printf("DTMF Code: %c\n", cmd);
hfp_hf_send_dtmf_code(device_addr, cmd);
break;
case 'a':
log_info("USER:\'%c\'", cmd);
printf("Establish Service level connection to device with Bluetooth address %s...\n", bd_addr_to_str(device_addr));
hfp_hf_establish_service_level_connection(device_addr);
break;
case 'A':
log_info("USER:\'%c\'", cmd);
printf("Release Service level connection.\n");
hfp_hf_release_service_level_connection(device_addr);
break;
case 'b':
log_info("USER:\'%c\'", cmd);
printf("Establish Audio connection to device with Bluetooth address %s...\n", bd_addr_to_str(device_addr));
hfp_hf_establish_audio_connection(device_addr);
break;
case 'B':
log_info("USER:\'%c\'", cmd);
printf("Release Audio service level connection.\n");
hfp_hf_release_audio_connection(device_addr);
break;
case 'C':
log_info("USER:\'%c\'", cmd);
printf("Enable registration status update for all AG indicators.\n");
hfp_hf_enable_status_update_for_all_ag_indicators(device_addr);
case 'c':
log_info("USER:\'%c\'", cmd);
printf("Disable registration status update for all AG indicators.\n");
hfp_hf_disable_status_update_for_all_ag_indicators(device_addr);
break;
case 'D':
log_info("USER:\'%c\'", cmd);
printf("Set HFP AG registration status update for individual indicators (0111111).\n");
hfp_hf_set_status_update_for_individual_ag_indicators(device_addr, 63);
break;
case 'd':
log_info("USER:\'%c\'", cmd);
printf("Query network operator.\n");
hfp_hf_query_operator_selection(device_addr);
break;
case 'E':
log_info("USER:\'%c\'", cmd);
printf("Enable reporting of the extended AG error result code.\n");
hfp_hf_enable_report_extended_audio_gateway_error_result_code(device_addr);
break;
case 'e':
log_info("USER:\'%c\'", cmd);
printf("Disable reporting of the extended AG error result code.\n");
hfp_hf_disable_report_extended_audio_gateway_error_result_code(device_addr);
break;
case 'f':
log_info("USER:\'%c\'", cmd);
printf("Answer incoming call.\n");
hfp_hf_answer_incoming_call(device_addr);
break;
case 'F':
log_info("USER:\'%c\'", cmd);
printf("Hangup call.\n");
hfp_hf_terminate_call(device_addr);
break;
case 'G':
log_info("USER:\'%c\'", cmd);
printf("Reject call.\n");
hfp_hf_reject_call(device_addr);
break;
case 'g':
log_info("USER:\'%c\'", cmd);
printf("Query operator.\n");
hfp_hf_query_operator_selection(device_addr);
break;
case 't':
log_info("USER:\'%c\'", cmd);
printf("Terminate HCI connection.\n");
gap_disconnect(handle);
break;
case 'i':
log_info("USER:\'%c\'", cmd);
printf("Dial 1234567\n");
hfp_hf_dial_number(device_addr, "1234567");
break;
case 'I':
log_info("USER:\'%c\'", cmd);
printf("Dial 7654321\n");
hfp_hf_dial_number(device_addr, "7654321");
break;
case 'j':
log_info("USER:\'%c\'", cmd);
printf("Dial #1\n");
hfp_hf_dial_memory(device_addr,"1");
break;
case 'J':
log_info("USER:\'%c\'", cmd);
printf("Dial #99\n");
hfp_hf_dial_memory(device_addr,"99");
break;
case 'k':
log_info("USER:\'%c\'", cmd);
printf("Deactivate call waiting notification\n");
hfp_hf_deactivate_call_waiting_notification(device_addr);
break;
case 'K':
log_info("USER:\'%c\'", cmd);
printf("Activate call waiting notification\n");
hfp_hf_activate_call_waiting_notification(device_addr);
break;
case 'l':
log_info("USER:\'%c\'", cmd);
printf("Deactivate calling line notification\n");
hfp_hf_deactivate_calling_line_notification(device_addr);
break;
case 'L':
log_info("USER:\'%c\'", cmd);
printf("Activate calling line notification\n");
hfp_hf_activate_calling_line_notification(device_addr);
break;
case 'm':
log_info("USER:\'%c\'", cmd);
printf("Deactivate echo canceling and noise reduction\n");
hfp_hf_deactivate_echo_canceling_and_noise_reduction(device_addr);
break;
case 'M':
log_info("USER:\'%c\'", cmd);
printf("Activate echo canceling and noise reduction\n");
hfp_hf_activate_echo_canceling_and_noise_reduction(device_addr);
break;
case 'n':
log_info("USER:\'%c\'", cmd);
printf("Deactivate voice recognition\n");
hfp_hf_deactivate_voice_recognition_notification(device_addr);
break;
case 'N':
log_info("USER:\'%c\'", cmd);
printf("Activate voice recognition\n");
hfp_hf_activate_voice_recognition_notification(device_addr);
break;
case 'o':
log_info("USER:\'%c\'", cmd);
printf("Set speaker gain to 0 (minimum)\n");
hfp_hf_set_speaker_gain(device_addr, 0);
break;
case 'O':
log_info("USER:\'%c\'", cmd);
printf("Set speaker gain to 9 (default)\n");
hfp_hf_set_speaker_gain(device_addr, 9);
break;
case 'p':
log_info("USER:\'%c\'", cmd);
printf("Set speaker gain to 12 (higher)\n");
hfp_hf_set_speaker_gain(device_addr, 12);
break;
case 'P':
log_info("USER:\'%c\'", cmd);
printf("Set speaker gain to 15 (maximum)\n");
hfp_hf_set_speaker_gain(device_addr, 15);
break;
case 'q':
log_info("USER:\'%c\'", cmd);
printf("Set microphone gain to 0\n");
hfp_hf_set_microphone_gain(device_addr, 0);
break;
case 'Q':
log_info("USER:\'%c\'", cmd);
printf("Set microphone gain to 9\n");
hfp_hf_set_microphone_gain(device_addr, 9);
break;
case 's':
log_info("USER:\'%c\'", cmd);
printf("Set microphone gain to 12\n");
hfp_hf_set_microphone_gain(device_addr, 12);
break;
case 'S':
log_info("USER:\'%c\'", cmd);
printf("Set microphone gain to 15\n");
hfp_hf_set_microphone_gain(device_addr, 15);
break;
case 'u':
log_info("USER:\'%c\'", cmd);
printf("Send 'user busy' (Three-Way Call 0)\n");
hfp_hf_user_busy(device_addr);
break;
case 'U':
log_info("USER:\'%c\'", cmd);
printf("End active call and accept waiting/held call (Three-Way Call 1)\n");
hfp_hf_end_active_and_accept_other(device_addr);
break;
case 'v':
log_info("USER:\'%c\'", cmd);
printf("Swap active call and hold/waiting call (Three-Way Call 2)\n");
hfp_hf_swap_calls(device_addr);
break;
case 'V':
log_info("USER:\'%c\'", cmd);
printf("Join hold call (Three-Way Call 3)\n");
hfp_hf_join_held_call(device_addr);
break;
case 'w':
log_info("USER:\'%c\'", cmd);
printf("Connect calls (Three-Way Call 4)\n");
hfp_hf_connect_calls(device_addr);
break;
case 'W':
log_info("USER:\'%c\'", cmd);
printf("Redial\n");
hfp_hf_redial_last_number(device_addr);
break;
case 'x':
log_info("USER:\'%c\'", cmd);
printf("Request phone number for voice tag\n");
hfp_hf_request_phone_number_for_voice_tag(device_addr);
break;
case 'X':
log_info("USER:\'%c\'", cmd);
printf("Query current call status\n");
hfp_hf_query_current_call_status(device_addr);
break;
case 'y':
log_info("USER:\'%c\'", cmd);
printf("Release call with index 2\n");
hfp_hf_release_call_with_index(device_addr, 2);
break;
case 'Y':
log_info("USER:\'%c\'", cmd);
printf("Private consulation with call 2\n");
hfp_hf_private_consultation_with_call(device_addr, 2);
break;
case 'z':
memcpy(device_addr, phone_addr, 6);
log_info("USER:\'%c\'", cmd);
printf("Use iPhone %s as Audiogateway.\n", bd_addr_to_str(device_addr));
break;
case '[':
log_info("USER:\'%c\'", cmd);
printf("Query Response and Hold status (RHH ?)\n");
hfp_hf_rrh_query_status(device_addr);
break;
case ']':
log_info("USER:\'%c\'", cmd);
printf("Place call in a response and held state (RHH 0)\n");
hfp_hf_rrh_hold_call(device_addr);
break;
case '{':
log_info("USER:\'%c\'", cmd);
printf("Accept held call (RHH 1)\n");
hfp_hf_rrh_accept_held_call(device_addr);
break;
case '}':
log_info("USER:\'%c\'", cmd);
printf("Reject held call (RHH 2)\n");
hfp_hf_rrh_reject_held_call(device_addr);
break;
case '?':
log_info("USER:\'%c\'", cmd);
printf("Query Subscriber Number\n");
hfp_hf_query_subscriber_number(device_addr);
break;
case '!':
log_info("USER:\'%c\'", cmd);
printf("Update HF indicator with assigned number 1 (HFI)\n");
hfp_hf_set_hf_indicator(device_addr, 1, 1);
break;