hfp hf api change: use acl_handle instead of device addr

This commit is contained in:
Milanka Ringwald 2016-07-27 14:47:57 +02:00
parent d97d752d32
commit c862649892
4 changed files with 263 additions and 297 deletions

View File

@ -75,7 +75,7 @@ static bd_addr_t device_addr = {0x80,0xbe,0x05,0xd5,0x28,0x48};
// prototypes
static void show_usage(void);
#endif
static uint16_t handle = -1;
static hci_con_handle_t acl_handle = -1;
static hci_con_handle_t sco_handle;
static uint8_t codecs[] = {HFP_CODEC_CVSD, HFP_CODEC_MSBC};
static uint16_t indicators[1] = {0x01};
@ -177,7 +177,7 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac
if (cmd >= '0' && cmd <= '9'){
printf("DTMF Code: %c\n", cmd);
hfp_hf_send_dtmf_code(device_addr, cmd);
hfp_hf_send_dtmf_code(acl_handle, cmd);
return;
}
@ -188,7 +188,7 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac
case '*':
log_info("USER:\'%c\'", cmd);
printf("DTMF Code: %c\n", cmd);
hfp_hf_send_dtmf_code(device_addr, cmd);
hfp_hf_send_dtmf_code(acl_handle, cmd);
break;
case 'a':
log_info("USER:\'%c\'", cmd);
@ -198,251 +198,251 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac
case 'A':
log_info("USER:\'%c\'", cmd);
printf("Release Service level connection.\n");
hfp_hf_release_service_level_connection(device_addr);
hfp_hf_release_service_level_connection(acl_handle);
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);
hfp_hf_establish_audio_connection(acl_handle);
break;
case 'B':
log_info("USER:\'%c\'", cmd);
printf("Release Audio service level connection.\n");
hfp_hf_release_audio_connection(device_addr);
hfp_hf_release_audio_connection(acl_handle);
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);
hfp_hf_enable_status_update_for_all_ag_indicators(acl_handle);
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);
hfp_hf_disable_status_update_for_all_ag_indicators(acl_handle);
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);
hfp_hf_set_status_update_for_individual_ag_indicators(acl_handle, 63);
break;
case 'd':
log_info("USER:\'%c\'", cmd);
printf("Query network operator.\n");
hfp_hf_query_operator_selection(device_addr);
hfp_hf_query_operator_selection(acl_handle);
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);
hfp_hf_enable_report_extended_audio_gateway_error_result_code(acl_handle);
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);
hfp_hf_disable_report_extended_audio_gateway_error_result_code(acl_handle);
break;
case 'f':
log_info("USER:\'%c\'", cmd);
printf("Answer incoming call.\n");
hfp_hf_answer_incoming_call(device_addr);
hfp_hf_answer_incoming_call(acl_handle);
break;
case 'F':
log_info("USER:\'%c\'", cmd);
printf("Hangup call.\n");
hfp_hf_terminate_call(device_addr);
hfp_hf_terminate_call(acl_handle);
break;
case 'G':
log_info("USER:\'%c\'", cmd);
printf("Reject incoming call.\n");
hfp_hf_reject_incoming_call(device_addr);
hfp_hf_reject_incoming_call(acl_handle);
break;
case 'g':
log_info("USER:\'%c\'", cmd);
printf("Query operator.\n");
hfp_hf_query_operator_selection(device_addr);
hfp_hf_query_operator_selection(acl_handle);
break;
case 't':
log_info("USER:\'%c\'", cmd);
printf("Terminate HCI connection.\n");
gap_disconnect(handle);
gap_disconnect(acl_handle);
break;
case 'i':
log_info("USER:\'%c\'", cmd);
printf("Dial 1234567\n");
hfp_hf_dial_number(device_addr, "1234567");
hfp_hf_dial_number(acl_handle, "1234567");
break;
case 'I':
log_info("USER:\'%c\'", cmd);
printf("Dial 7654321\n");
hfp_hf_dial_number(device_addr, "7654321");
hfp_hf_dial_number(acl_handle, "7654321");
break;
case 'j':
log_info("USER:\'%c\'", cmd);
printf("Dial #1\n");
hfp_hf_dial_memory(device_addr,1);
hfp_hf_dial_memory(acl_handle,1);
break;
case 'J':
log_info("USER:\'%c\'", cmd);
printf("Dial #99\n");
hfp_hf_dial_memory(device_addr,99);
hfp_hf_dial_memory(acl_handle,99);
break;
case 'k':
log_info("USER:\'%c\'", cmd);
printf("Deactivate call waiting notification\n");
hfp_hf_deactivate_call_waiting_notification(device_addr);
hfp_hf_deactivate_call_waiting_notification(acl_handle);
break;
case 'K':
log_info("USER:\'%c\'", cmd);
printf("Activate call waiting notification\n");
hfp_hf_activate_call_waiting_notification(device_addr);
hfp_hf_activate_call_waiting_notification(acl_handle);
break;
case 'l':
log_info("USER:\'%c\'", cmd);
printf("Deactivate calling line notification\n");
hfp_hf_deactivate_calling_line_notification(device_addr);
hfp_hf_deactivate_calling_line_notification(acl_handle);
break;
case 'L':
log_info("USER:\'%c\'", cmd);
printf("Activate calling line notification\n");
hfp_hf_activate_calling_line_notification(device_addr);
hfp_hf_activate_calling_line_notification(acl_handle);
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);
hfp_hf_deactivate_echo_canceling_and_noise_reduction(acl_handle);
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);
hfp_hf_activate_echo_canceling_and_noise_reduction(acl_handle);
break;
case 'n':
log_info("USER:\'%c\'", cmd);
printf("Deactivate voice recognition\n");
hfp_hf_deactivate_voice_recognition_notification(device_addr);
hfp_hf_deactivate_voice_recognition_notification(acl_handle);
break;
case 'N':
log_info("USER:\'%c\'", cmd);
printf("Activate voice recognition %s\n", bd_addr_to_str(device_addr));
hfp_hf_activate_voice_recognition_notification(device_addr);
hfp_hf_activate_voice_recognition_notification(acl_handle);
break;
case 'o':
log_info("USER:\'%c\'", cmd);
printf("Set speaker gain to 0 (minimum)\n");
hfp_hf_set_speaker_gain(device_addr, 0);
hfp_hf_set_speaker_gain(acl_handle, 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);
hfp_hf_set_speaker_gain(acl_handle, 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);
hfp_hf_set_speaker_gain(acl_handle, 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);
hfp_hf_set_speaker_gain(acl_handle, 15);
break;
case 'q':
log_info("USER:\'%c\'", cmd);
printf("Set microphone gain to 0\n");
hfp_hf_set_microphone_gain(device_addr, 0);
hfp_hf_set_microphone_gain(acl_handle, 0);
break;
case 'Q':
log_info("USER:\'%c\'", cmd);
printf("Set microphone gain to 9\n");
hfp_hf_set_microphone_gain(device_addr, 9);
hfp_hf_set_microphone_gain(acl_handle, 9);
break;
case 's':
log_info("USER:\'%c\'", cmd);
printf("Set microphone gain to 12\n");
hfp_hf_set_microphone_gain(device_addr, 12);
hfp_hf_set_microphone_gain(acl_handle, 12);
break;
case 'S':
log_info("USER:\'%c\'", cmd);
printf("Set microphone gain to 15\n");
hfp_hf_set_microphone_gain(device_addr, 15);
hfp_hf_set_microphone_gain(acl_handle, 15);
break;
case 'u':
log_info("USER:\'%c\'", cmd);
printf("Send 'user busy' (Three-Way Call 0)\n");
hfp_hf_user_busy(device_addr);
hfp_hf_user_busy(acl_handle);
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);
hfp_hf_end_active_and_accept_other(acl_handle);
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);
hfp_hf_swap_calls(acl_handle);
break;
case 'V':
log_info("USER:\'%c\'", cmd);
printf("Join hold call (Three-Way Call 3)\n");
hfp_hf_join_held_call(device_addr);
hfp_hf_join_held_call(acl_handle);
break;
case 'w':
log_info("USER:\'%c\'", cmd);
printf("Connect calls (Three-Way Call 4)\n");
hfp_hf_connect_calls(device_addr);
hfp_hf_connect_calls(acl_handle);
break;
case 'W':
log_info("USER:\'%c\'", cmd);
printf("Redial\n");
hfp_hf_redial_last_number(device_addr);
hfp_hf_redial_last_number(acl_handle);
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);
hfp_hf_request_phone_number_for_voice_tag(acl_handle);
break;
case 'X':
log_info("USER:\'%c\'", cmd);
printf("Query current call status\n");
hfp_hf_query_current_call_status(device_addr);
hfp_hf_query_current_call_status(acl_handle);
break;
case 'y':
log_info("USER:\'%c\'", cmd);
printf("Release call with index 2\n");
hfp_hf_release_call_with_index(device_addr, 2);
hfp_hf_release_call_with_index(acl_handle, 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);
hfp_hf_private_consultation_with_call(acl_handle, 2);
break;
case '[':
log_info("USER:\'%c\'", cmd);
printf("Query Response and Hold status (RHH ?)\n");
hfp_hf_rrh_query_status(device_addr);
hfp_hf_rrh_query_status(acl_handle);
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);
hfp_hf_rrh_hold_call(acl_handle);
break;
case '{':
log_info("USER:\'%c\'", cmd);
printf("Accept held call (RHH 1)\n");
hfp_hf_rrh_accept_held_call(device_addr);
hfp_hf_rrh_accept_held_call(acl_handle);
break;
case '}':
log_info("USER:\'%c\'", cmd);
printf("Reject held call (RHH 2)\n");
hfp_hf_rrh_reject_held_call(device_addr);
hfp_hf_rrh_reject_held_call(acl_handle);
break;
case '?':
log_info("USER:\'%c\'", cmd);
printf("Query Subscriber Number\n");
hfp_hf_query_subscriber_number(device_addr);
hfp_hf_query_subscriber_number(acl_handle);
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);
hfp_hf_set_hf_indicator(acl_handle, 1, 1);
break;
default:
@ -475,7 +475,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
break;
case HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED:
handle = hfp_subevent_service_level_connection_established_get_con_handle(event);
acl_handle = hfp_subevent_service_level_connection_established_get_con_handle(event);
hfp_subevent_service_level_connection_established_get_bd_addr(event, device_addr);
printf("Service level connection established %s.\n\n", bd_addr_to_str(device_addr));
break;
@ -549,7 +549,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
switch (event[2]) {
case HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED:
handle = hfp_subevent_service_level_connection_established_get_con_handle(event);
acl_handle = hfp_subevent_service_level_connection_established_get_con_handle(event);
printf("Service level connection established.\n\n");
break;
case HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED:

View File

@ -1141,15 +1141,14 @@ void hfp_hf_establish_service_level_connection(bd_addr_t bd_addr){
hfp_establish_service_level_connection(bd_addr, SDP_HandsfreeAudioGateway);
}
void hfp_hf_release_service_level_connection(bd_addr_t bd_addr){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
void hfp_hf_release_service_level_connection(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_release_service_level_connection(hfp_connection);
hfp_run_for_context(hfp_connection);
}
static void hfp_hf_set_status_update_for_all_ag_indicators(bd_addr_t bd_addr, uint8_t enable){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
static void hfp_hf_set_status_update_for_all_ag_indicators(hci_con_handle_t acl_handle, uint8_t enable){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (!hfp_connection){
log_error("HFP HF: hfp_connection doesn't exist.");
return;
@ -1158,18 +1157,17 @@ static void hfp_hf_set_status_update_for_all_ag_indicators(bd_addr_t bd_addr, ui
hfp_run_for_context(hfp_connection);
}
void hfp_hf_enable_status_update_for_all_ag_indicators(bd_addr_t bd_addr){
hfp_hf_set_status_update_for_all_ag_indicators(bd_addr, 1);
void hfp_hf_enable_status_update_for_all_ag_indicators(hci_con_handle_t acl_handle){
hfp_hf_set_status_update_for_all_ag_indicators(acl_handle, 1);
}
void hfp_hf_disable_status_update_for_all_ag_indicators(bd_addr_t bd_addr){
hfp_hf_set_status_update_for_all_ag_indicators(bd_addr, 0);
void hfp_hf_disable_status_update_for_all_ag_indicators(hci_con_handle_t acl_handle){
hfp_hf_set_status_update_for_all_ag_indicators(acl_handle, 0);
}
// TODO: returned ERROR - wrong format
void hfp_hf_set_status_update_for_individual_ag_indicators(bd_addr_t bd_addr, uint32_t indicators_status_bitmap){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
void hfp_hf_set_status_update_for_individual_ag_indicators(hci_con_handle_t acl_handle, uint32_t indicators_status_bitmap){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (!hfp_connection){
log_error("HFP HF: hfp_connection doesn't exist.");
return;
@ -1179,9 +1177,8 @@ void hfp_hf_set_status_update_for_individual_ag_indicators(bd_addr_t bd_addr, ui
hfp_run_for_context(hfp_connection);
}
void hfp_hf_query_operator_selection(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
void hfp_hf_query_operator_selection(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (!hfp_connection){
log_error("HFP HF: hfp_connection doesn't exist.");
return;
@ -1199,9 +1196,8 @@ void hfp_hf_query_operator_selection(bd_addr_t bd_addr){
hfp_run_for_context(hfp_connection);
}
static void hfp_hf_set_report_extended_audio_gateway_error_result_code(bd_addr_t bd_addr, uint8_t enable){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
static void hfp_hf_set_report_extended_audio_gateway_error_result_code(hci_con_handle_t acl_handle, uint8_t enable){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (!hfp_connection){
log_error("HFP HF: hfp_connection doesn't exist.");
return;
@ -1211,18 +1207,17 @@ static void hfp_hf_set_report_extended_audio_gateway_error_result_code(bd_addr_t
}
void hfp_hf_enable_report_extended_audio_gateway_error_result_code(bd_addr_t bd_addr){
hfp_hf_set_report_extended_audio_gateway_error_result_code(bd_addr, 1);
void hfp_hf_enable_report_extended_audio_gateway_error_result_code(hci_con_handle_t acl_handle){
hfp_hf_set_report_extended_audio_gateway_error_result_code(acl_handle, 1);
}
void hfp_hf_disable_report_extended_audio_gateway_error_result_code(bd_addr_t bd_addr){
hfp_hf_set_report_extended_audio_gateway_error_result_code(bd_addr, 0);
void hfp_hf_disable_report_extended_audio_gateway_error_result_code(hci_con_handle_t acl_handle){
hfp_hf_set_report_extended_audio_gateway_error_result_code(acl_handle, 0);
}
void hfp_hf_establish_audio_connection(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
void hfp_hf_establish_audio_connection(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->establish_audio_connection = 0;
if (hfp_connection->state == HFP_AUDIO_CONNECTION_ESTABLISHED) return;
@ -1245,15 +1240,14 @@ void hfp_hf_establish_audio_connection(bd_addr_t bd_addr){
hfp_run_for_context(hfp_connection);
}
void hfp_hf_release_audio_connection(bd_addr_t bd_addr){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
void hfp_hf_release_audio_connection(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_release_audio_connection(hfp_connection);
hfp_run_for_context(hfp_connection);
}
void hfp_hf_answer_incoming_call(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
void hfp_hf_answer_incoming_call(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
hfp_connection->hf_answer_incoming_call = 1;
@ -1263,17 +1257,14 @@ void hfp_hf_answer_incoming_call(bd_addr_t bd_addr){
}
}
void hfp_hf_terminate_call(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
void hfp_hf_terminate_call(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_send_chup = 1;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_reject_incoming_call(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
void hfp_hf_reject_incoming_call(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
hfp_connection->hf_send_chup = 1;
@ -1281,9 +1272,8 @@ void hfp_hf_reject_incoming_call(bd_addr_t bd_addr){
}
}
void hfp_hf_user_busy(bd_addr_t addr){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_user_busy(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
hfp_connection->hf_send_chld_0 = 1;
@ -1291,9 +1281,8 @@ void hfp_hf_user_busy(bd_addr_t addr){
}
}
void hfp_hf_end_active_and_accept_other(bd_addr_t addr){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_end_active_and_accept_other(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS ||
hfp_call_status == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
@ -1302,9 +1291,8 @@ void hfp_hf_end_active_and_accept_other(bd_addr_t addr){
}
}
void hfp_hf_swap_calls(bd_addr_t addr){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_swap_calls(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS ||
hfp_call_status == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
@ -1313,9 +1301,8 @@ void hfp_hf_swap_calls(bd_addr_t addr){
}
}
void hfp_hf_join_held_call(bd_addr_t addr){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_join_held_call(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS ||
hfp_call_status == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
@ -1324,9 +1311,8 @@ void hfp_hf_join_held_call(bd_addr_t addr){
}
}
void hfp_hf_connect_calls(bd_addr_t addr){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_connect_calls(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS ||
hfp_call_status == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
@ -1335,9 +1321,8 @@ void hfp_hf_connect_calls(bd_addr_t addr){
}
}
void hfp_hf_release_call_with_index(bd_addr_t addr, int index){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_release_call_with_index(hci_con_handle_t acl_handle, int index){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS ||
hfp_call_status == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
@ -1347,9 +1332,8 @@ void hfp_hf_release_call_with_index(bd_addr_t addr, int index){
}
}
void hfp_hf_private_consultation_with_call(bd_addr_t addr, int index){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_private_consultation_with_call(hci_con_handle_t acl_handle, int index){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS ||
hfp_call_status == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
@ -1359,103 +1343,92 @@ void hfp_hf_private_consultation_with_call(bd_addr_t addr, int index){
}
}
void hfp_hf_dial_number(bd_addr_t bd_addr, char * number){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
hfp_connection->hf_initiate_outgoing_call = 1;
void hfp_hf_dial_number(hci_con_handle_t acl_handle, char * number){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_initiate_outgoing_call = 1;
snprintf(phone_number, sizeof(phone_number), "%s", number);
hfp_run_for_context(hfp_connection);
}
void hfp_hf_dial_memory(bd_addr_t bd_addr, int memory_id){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
hfp_connection->hf_initiate_memory_dialing = 1;
void hfp_hf_dial_memory(hci_con_handle_t acl_handle, int memory_id){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_initiate_memory_dialing = 1;
hfp_connection->memory_id = memory_id;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_redial_last_number(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
hfp_connection->hf_initiate_redial_last_number = 1;
void hfp_hf_redial_last_number(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_initiate_redial_last_number = 1;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_activate_call_waiting_notification(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
hfp_connection->hf_activate_call_waiting_notification = 1;
void hfp_hf_activate_call_waiting_notification(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_activate_call_waiting_notification = 1;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_deactivate_call_waiting_notification(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
hfp_connection->hf_deactivate_call_waiting_notification = 1;
void hfp_hf_deactivate_call_waiting_notification(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_deactivate_call_waiting_notification = 1;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_activate_calling_line_notification(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
hfp_connection->hf_activate_calling_line_notification = 1;
void hfp_hf_activate_calling_line_notification(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_activate_calling_line_notification = 1;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_deactivate_calling_line_notification(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
hfp_connection->hf_deactivate_calling_line_notification = 1;
void hfp_hf_deactivate_calling_line_notification(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_deactivate_calling_line_notification = 1;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_activate_echo_canceling_and_noise_reduction(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
hfp_connection->hf_activate_echo_canceling_and_noise_reduction = 1;
void hfp_hf_activate_echo_canceling_and_noise_reduction(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_activate_echo_canceling_and_noise_reduction = 1;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_deactivate_echo_canceling_and_noise_reduction(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
hfp_connection->hf_deactivate_echo_canceling_and_noise_reduction = 1;
void hfp_hf_deactivate_echo_canceling_and_noise_reduction(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_deactivate_echo_canceling_and_noise_reduction = 1;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_activate_voice_recognition_notification(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
hfp_connection->hf_activate_voice_recognition_notification = 1;
void hfp_hf_activate_voice_recognition_notification(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_activate_voice_recognition_notification = 1;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_deactivate_voice_recognition_notification(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
hfp_connection->hf_deactivate_voice_recognition_notification = 1;
void hfp_hf_deactivate_voice_recognition_notification(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_deactivate_voice_recognition_notification = 1;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_set_microphone_gain(bd_addr_t bd_addr, int gain){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
void hfp_hf_set_microphone_gain(hci_con_handle_t acl_handle, int gain){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (hfp_connection->microphone_gain == gain) return;
if (gain < 0 || gain > 15){
log_info("Valid range for a gain is [0..15]. Currently sent: %d", gain);
@ -1466,9 +1439,9 @@ void hfp_hf_set_microphone_gain(bd_addr_t bd_addr, int gain){
hfp_run_for_context(hfp_connection);
}
void hfp_hf_set_speaker_gain(bd_addr_t bd_addr, int gain){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
void hfp_hf_set_speaker_gain(hci_con_handle_t acl_handle, int gain){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
if (hfp_connection->speaker_gain == gain) return;
if (gain < 0 || gain > 15){
log_info("Valid range for a gain is [0..15]. Currently sent: %d", gain);
@ -1479,70 +1452,61 @@ void hfp_hf_set_speaker_gain(bd_addr_t bd_addr, int gain){
hfp_run_for_context(hfp_connection);
}
void hfp_hf_send_dtmf_code(bd_addr_t addr, char code){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_send_dtmf_code(hci_con_handle_t acl_handle, char code){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_send_dtmf_code = code;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_request_phone_number_for_voice_tag(bd_addr_t addr){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_request_phone_number_for_voice_tag(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_send_binp = 1;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_query_current_call_status(bd_addr_t addr){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_query_current_call_status(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_send_clcc = 1;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_rrh_query_status(bd_addr_t addr){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_rrh_query_status(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_send_rrh = 1;
hfp_connection->hf_send_rrh_command = '?';
hfp_run_for_context(hfp_connection);
}
void hfp_hf_rrh_hold_call(bd_addr_t addr){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_rrh_hold_call(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_send_rrh = 1;
hfp_connection->hf_send_rrh_command = '0';
hfp_run_for_context(hfp_connection);
}
void hfp_hf_rrh_accept_held_call(bd_addr_t addr){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_rrh_accept_held_call(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_send_rrh = 1;
hfp_connection->hf_send_rrh_command = '1';
hfp_run_for_context(hfp_connection);
}
void hfp_hf_rrh_reject_held_call(bd_addr_t addr){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_rrh_reject_held_call(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_send_rrh = 1;
hfp_connection->hf_send_rrh_command = '2';
hfp_run_for_context(hfp_connection);
}
void hfp_hf_query_subscriber_number(bd_addr_t addr){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_query_subscriber_number(hci_con_handle_t acl_handle){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
hfp_connection->hf_send_cnum = 1;
hfp_run_for_context(hfp_connection);
}
void hfp_hf_set_hf_indicator(bd_addr_t addr, int assigned_number, int value){
hfp_hf_establish_service_level_connection(addr);
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(addr);
void hfp_hf_set_hf_indicator(hci_con_handle_t acl_handle, int assigned_number, int value){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_acl_handle(acl_handle);
// find index for assigned number
int i;
for (i = 0; i < hfp_indicators_nr ; i++){

View File

@ -121,7 +121,7 @@ void hfp_hf_establish_service_level_connection(bd_addr_t bd_addr);
*
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_release_service_level_connection(bd_addr_t bd_addr);
void hfp_hf_release_service_level_connection(hci_con_handle_t acl_handle);
/**
* @brief Enable status update for all indicators in the AG.
@ -130,14 +130,14 @@ void hfp_hf_release_service_level_connection(bd_addr_t bd_addr);
*
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_enable_status_update_for_all_ag_indicators(bd_addr_t bd_addr);
void hfp_hf_enable_status_update_for_all_ag_indicators(hci_con_handle_t acl_handle);
/**
* @brief Disable status update for all indicators in the AG.
* The status field of the HFP_SUBEVENT_COMPLETE reports if the command was accepted.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_disable_status_update_for_all_ag_indicators(bd_addr_t bd_addr);
void hfp_hf_disable_status_update_for_all_ag_indicators(hci_con_handle_t acl_handle);
/**
* @brief Enable or disable status update for the individual indicators in the AG using bitmap.
@ -147,7 +147,7 @@ void hfp_hf_disable_status_update_for_all_ag_indicators(bd_addr_t bd_addr);
* @param bd_addr Bluetooth address of the AG
* @param indicators_status_bitmap 32-bit bitmap, 0 - indicator is disabled, 1 - indicator is enabled
*/
void hfp_hf_set_status_update_for_individual_ag_indicators(bd_addr_t bd_addr, uint32_t indicators_status_bitmap);
void hfp_hf_set_status_update_for_individual_ag_indicators(hci_con_handle_t acl_handle, uint32_t indicators_status_bitmap);
/**
* @brief Query the name of the currently selected Network operator by AG.
@ -159,7 +159,7 @@ void hfp_hf_set_status_update_for_individual_ag_indicators(bd_addr_t bd_addr, ui
*
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_query_operator_selection(bd_addr_t bd_addr);
void hfp_hf_query_operator_selection(hci_con_handle_t acl_handle);
/**
* @brief Enable Extended Audio Gateway Error result codes in the AG.
@ -169,14 +169,14 @@ void hfp_hf_query_operator_selection(bd_addr_t bd_addr);
*
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_enable_report_extended_audio_gateway_error_result_code(bd_addr_t bd_addr);
void hfp_hf_enable_report_extended_audio_gateway_error_result_code(hci_con_handle_t acl_handle);
/**
* @brief Disable Extended Audio Gateway Error result codes in the AG.
*
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_disable_report_extended_audio_gateway_error_result_code(bd_addr_t bd_addr);
void hfp_hf_disable_report_extended_audio_gateway_error_result_code(hci_con_handle_t acl_handle);
/**
* @brief Establish audio connection.
@ -184,7 +184,7 @@ void hfp_hf_enable_report_extended_audio_gateway_error_result_code(bd_addr_t bd_
* HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_establish_audio_connection(bd_addr_t bd_addr);
void hfp_hf_establish_audio_connection(hci_con_handle_t acl_handle);
/**
* @brief Release audio connection.
@ -193,77 +193,77 @@ void hfp_hf_establish_audio_connection(bd_addr_t bd_addr);
*
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_release_audio_connection(bd_addr_t bd_addr);
void hfp_hf_release_audio_connection(hci_con_handle_t acl_handle);
/**
* @brief Answer incoming call.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_answer_incoming_call(bd_addr_t bd_addr);
void hfp_hf_answer_incoming_call(hci_con_handle_t acl_handle);
/**
* @brief Reject incoming call.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_reject_incoming_call(bd_addr_t bd_addr);
void hfp_hf_reject_incoming_call(hci_con_handle_t acl_handle);
/**
* @brief Release all held calls or sets User Determined User Busy (UDUB) for a waiting call.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_user_busy(bd_addr_t addr);
void hfp_hf_user_busy(hci_con_handle_t acl_handle);
/**
* @brief Release all active calls (if any exist) and accepts the other (held or waiting) call.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_end_active_and_accept_other(bd_addr_t addr);
void hfp_hf_end_active_and_accept_other(hci_con_handle_t acl_handle);
/**
* @brief Place all active calls (if any exist) on hold and accepts the other (held or waiting) call.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_swap_calls(bd_addr_t addr);
void hfp_hf_swap_calls(hci_con_handle_t acl_handle);
/**
* @brief Add a held call to the conversation.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_join_held_call(bd_addr_t addr);
void hfp_hf_join_held_call(hci_con_handle_t acl_handle);
/**
* @brief Connect the two calls and disconnects the subscriber from both calls (Explicit Call
Transfer).
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_connect_calls(bd_addr_t addr);
void hfp_hf_connect_calls(hci_con_handle_t acl_handle);
/**
* @brief Terminate an incoming or an outgoing call.
* HFP_SUBEVENT_CALL_TERMINATED is sent upon call termination.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_terminate_call(bd_addr_t bd_addr);
void hfp_hf_terminate_call(hci_con_handle_t acl_handle);
/**
* @brief Initiate outgoing voice call by providing the destination phone number to the AG.
* @param bd_addr Bluetooth address of the AG
* @param number
*/
void hfp_hf_dial_number(bd_addr_t bd_addr, char * number);
void hfp_hf_dial_number(hci_con_handle_t acl_handle, char * number);
/**
* @brief Initiate outgoing voice call using the memory dialing feature of the AG.
* @param bd_addr Bluetooth address of the AG
* @param memory_id
*/
void hfp_hf_dial_memory(bd_addr_t bd_addr, int memory_id);
void hfp_hf_dial_memory(hci_con_handle_t acl_handle, int memory_id);
/**
* @brief Initiate outgoing voice call by recalling the last number dialed by the AG.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_redial_last_number(bd_addr_t bd_addr);
void hfp_hf_redial_last_number(hci_con_handle_t acl_handle);
/*
* @brief Enable the Call Waiting notification function in the AG.
@ -273,13 +273,13 @@ void hfp_hf_redial_last_number(bd_addr_t bd_addr);
*
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_activate_call_waiting_notification(bd_addr_t bd_addr);
void hfp_hf_activate_call_waiting_notification(hci_con_handle_t acl_handle);
/*
* @brief Disable the Call Waiting notification function in the AG.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_deactivate_call_waiting_notification(bd_addr_t bd_addr);
void hfp_hf_deactivate_call_waiting_notification(hci_con_handle_t acl_handle);
/*
* @brief Enable the Calling Line Identification notification function in the AG.
@ -288,13 +288,13 @@ void hfp_hf_deactivate_call_waiting_notification(bd_addr_t bd_addr);
* the HFP_SUBEVENT_CALLING_LINE_INDETIFICATION_NOTIFICATION is emitted.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_activate_calling_line_notification(bd_addr_t bd_addr);
void hfp_hf_activate_calling_line_notification(hci_con_handle_t acl_handle);
/*
* @brief Disable the Calling Line Identification notification function in the AG.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_deactivate_calling_line_notification(bd_addr_t bd_addr);
void hfp_hf_deactivate_calling_line_notification(hci_con_handle_t acl_handle);
/*
@ -305,45 +305,45 @@ void hfp_hf_deactivate_calling_line_notification(bd_addr_t bd_addr);
* it shall respond with the ERROR indicator (TODO)
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_activate_echo_canceling_and_noise_reduction(bd_addr_t bd_addr);
void hfp_hf_activate_echo_canceling_and_noise_reduction(hci_con_handle_t acl_handle);
/*
* @brief Deactivate echo canceling and noise reduction in the AG.
*/
void hfp_hf_deactivate_echo_canceling_and_noise_reduction(bd_addr_t bd_addr);
void hfp_hf_deactivate_echo_canceling_and_noise_reduction(hci_con_handle_t acl_handle);
/*
* @brief Activate voice recognition function.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_activate_voice_recognition_notification(bd_addr_t bd_addr);
void hfp_hf_activate_voice_recognition_notification(hci_con_handle_t acl_handle);
/*
* @brief Dectivate voice recognition function.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_deactivate_voice_recognition_notification(bd_addr_t bd_addr);
void hfp_hf_deactivate_voice_recognition_notification(hci_con_handle_t acl_handle);
/*
* @brief Set microphone gain.
* @param bd_addr Bluetooth address of the AG
* @param gain Valid range: [0,15]
*/
void hfp_hf_set_microphone_gain(bd_addr_t bd_addr, int gain);
void hfp_hf_set_microphone_gain(hci_con_handle_t acl_handle, int gain);
/*
* @brief Set speaker gain.
* @param bd_addr Bluetooth address of the AG
* @param gain Valid range: [0,15]
*/
void hfp_hf_set_speaker_gain(bd_addr_t bd_addr, int gain);
void hfp_hf_set_speaker_gain(hci_con_handle_t acl_handle, int gain);
/*
* @brief Instruct the AG to transmit a DTMF code.
* @param bd_addr Bluetooth address of the AG
* @param dtmf_code
*/
void hfp_hf_send_dtmf_code(bd_addr_t bd_addr, char code);
void hfp_hf_send_dtmf_code(hci_con_handle_t acl_handle, char code);
/*
* @brief Read numbers from the AG for the purpose of creating
@ -352,21 +352,21 @@ void hfp_hf_send_dtmf_code(bd_addr_t bd_addr, char code);
* The number is reported via HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_request_phone_number_for_voice_tag(bd_addr_t addr);
void hfp_hf_request_phone_number_for_voice_tag(hci_con_handle_t acl_handle);
/*
* @brief Query the list of current calls in AG.
* The result is received via HFP_SUBEVENT_ENHANCED_CALL_STATUS.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_query_current_call_status(bd_addr_t addr);
void hfp_hf_query_current_call_status(hci_con_handle_t acl_handle);
/*
* @brief Release a call with index in the AG.
* @param bd_addr Bluetooth address of the AG
* @param index
*/
void hfp_hf_release_call_with_index(bd_addr_t addr, int index);
void hfp_hf_release_call_with_index(hci_con_handle_t acl_handle, int index);
/*
* @brief Place all parties of a multiparty call on hold with the
@ -374,39 +374,39 @@ void hfp_hf_release_call_with_index(bd_addr_t addr, int index);
* @param bd_addr Bluetooth address of the AG
* @param index
*/
void hfp_hf_private_consultation_with_call(bd_addr_t addr, int index);
void hfp_hf_private_consultation_with_call(hci_con_handle_t acl_handle, int index);
/*
* @brief Query the status of the Response and Hold state of the AG.
* The result is reported via HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_rrh_query_status(bd_addr_t addr);
void hfp_hf_rrh_query_status(hci_con_handle_t acl_handle);
/*
* @brief Put an incoming call on hold in the AG.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_rrh_hold_call(bd_addr_t addr);
void hfp_hf_rrh_hold_call(hci_con_handle_t acl_handle);
/*
* @brief Accept held incoming call in the AG.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_rrh_accept_held_call(bd_addr_t addr);
void hfp_hf_rrh_accept_held_call(hci_con_handle_t acl_handle);
/*
* @brief Reject held incoming call in the AG.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_rrh_reject_held_call(bd_addr_t addr);
void hfp_hf_rrh_reject_held_call(hci_con_handle_t acl_handle);
/*
* @brief Query the AG subscriber number.
* The result is reported via HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION.
* @param bd_addr Bluetooth address of the AG
*/
void hfp_hf_query_subscriber_number(bd_addr_t addr);
void hfp_hf_query_subscriber_number(hci_con_handle_t acl_handle);
/*
* @brief Set HF indicator.
@ -414,7 +414,7 @@ void hfp_hf_query_subscriber_number(bd_addr_t addr);
* @param assigned_number
* @param value
*/
void hfp_hf_set_hf_indicator(bd_addr_t addr, int assigned_number, int value);
void hfp_hf_set_hf_indicator(hci_con_handle_t acl_handle, int assigned_number, int value);
/* API_END */

View File

@ -64,6 +64,7 @@
#include "mock.h"
#include "test_sequences.h"
#include "btstack.h"
const uint8_t rfcomm_channel_nr = 1;
@ -81,7 +82,7 @@ static uint8_t call_termiated = 0;
static int supported_features_with_codec_negotiation = 438;
static uint16_t handle = -1;
static uint16_t acl_handle = -1;
char * get_next_hfp_hf_command(void){
return get_next_hfp_command(0,2);
@ -98,7 +99,7 @@ static void user_command(char cmd){
case '+':
case '*':
printf("DTMF Code: %c\n", cmd);
hfp_hf_send_dtmf_code(device_addr, cmd);
hfp_hf_send_dtmf_code(acl_handle, cmd);
break;
case 'a':
printf("Establish Service level connection to device with Bluetooth address %s...\n", bd_addr_to_str(device_addr));
@ -106,202 +107,202 @@ static void user_command(char cmd){
break;
case 'A':
printf("Release Service level connection.\n");
hfp_hf_release_service_level_connection(device_addr);
hfp_hf_release_service_level_connection(acl_handle);
break;
case 'b':
printf("Establish Audio connection to device with Bluetooth address %s...\n", bd_addr_to_str(device_addr));
hfp_hf_establish_audio_connection(device_addr);
hfp_hf_establish_audio_connection(acl_handle);
break;
case 'B':
printf("Release Audio service level connection.\n");
hfp_hf_release_audio_connection(device_addr);
hfp_hf_release_audio_connection(acl_handle);
break;
case 'C':
printf("Enable registration status update for all AG indicators.\n");
hfp_hf_enable_status_update_for_all_ag_indicators(device_addr);
hfp_hf_enable_status_update_for_all_ag_indicators(acl_handle);
case 'c':
printf("Disable registration status update for all AG indicators.\n");
hfp_hf_disable_status_update_for_all_ag_indicators(device_addr);
hfp_hf_disable_status_update_for_all_ag_indicators(acl_handle);
break;
case 'D':
printf("Set HFP AG registration status update for individual indicators (0111111).\n");
hfp_hf_set_status_update_for_individual_ag_indicators(device_addr, 63);
hfp_hf_set_status_update_for_individual_ag_indicators(acl_handle, 63);
break;
case 'd':
printf("Query network operator.\n");
hfp_hf_query_operator_selection(device_addr);
hfp_hf_query_operator_selection(acl_handle);
break;
case 'E':
printf("Enable reporting of the extended AG error result code.\n");
hfp_hf_enable_report_extended_audio_gateway_error_result_code(device_addr);
hfp_hf_enable_report_extended_audio_gateway_error_result_code(acl_handle);
break;
case 'e':
printf("Disable reporting of the extended AG error result code.\n");
hfp_hf_disable_report_extended_audio_gateway_error_result_code(device_addr);
hfp_hf_disable_report_extended_audio_gateway_error_result_code(acl_handle);
break;
case 'f':
printf("Answer incoming call.\n");
hfp_hf_answer_incoming_call(device_addr);
hfp_hf_answer_incoming_call(acl_handle);
break;
case 'F':
printf("Hangup call.\n");
hfp_hf_terminate_call(device_addr);
hfp_hf_terminate_call(acl_handle);
break;
case 'G':
printf("Reject incoming call.\n");
hfp_hf_reject_incoming_call(device_addr);
hfp_hf_reject_incoming_call(acl_handle);
break;
case 'g':
printf("Query operator.\n");
hfp_hf_query_operator_selection(device_addr);
hfp_hf_query_operator_selection(acl_handle);
break;
case 't':
printf("Terminate HCI connection.\n");
gap_disconnect(handle);
gap_disconnect(acl_handle);
break;
case 'i':
printf("Dial 1234567\n");
hfp_hf_dial_number(device_addr, (char *)"1234567");
hfp_hf_dial_number(acl_handle, (char *)"1234567");
break;
case 'I':
printf("Dial 7654321\n");
hfp_hf_dial_number(device_addr, (char *)"7654321");
hfp_hf_dial_number(acl_handle, (char *)"7654321");
break;
case 'j':
printf("Dial #1\n");
hfp_hf_dial_memory(device_addr, 1);
hfp_hf_dial_memory(acl_handle, 1);
break;
case 'J':
printf("Dial #99\n");
hfp_hf_dial_memory(device_addr, 99);
hfp_hf_dial_memory(acl_handle, 99);
break;
case 'k':
printf("Deactivate call waiting notification\n");
hfp_hf_deactivate_call_waiting_notification(device_addr);
hfp_hf_deactivate_call_waiting_notification(acl_handle);
break;
case 'K':
printf("Activate call waiting notification\n");
hfp_hf_activate_call_waiting_notification(device_addr);
hfp_hf_activate_call_waiting_notification(acl_handle);
break;
case 'l':
printf("Deactivate calling line notification\n");
hfp_hf_deactivate_calling_line_notification(device_addr);
hfp_hf_deactivate_calling_line_notification(acl_handle);
break;
case 'L':
printf("Activate calling line notification\n");
hfp_hf_activate_calling_line_notification(device_addr);
hfp_hf_activate_calling_line_notification(acl_handle);
break;
case 'm':
printf("Deactivate echo canceling and noise reduction\n");
hfp_hf_deactivate_echo_canceling_and_noise_reduction(device_addr);
hfp_hf_deactivate_echo_canceling_and_noise_reduction(acl_handle);
break;
case 'M':
printf("Activate echo canceling and noise reduction\n");
hfp_hf_activate_echo_canceling_and_noise_reduction(device_addr);
hfp_hf_activate_echo_canceling_and_noise_reduction(acl_handle);
break;
case 'n':
printf("Deactivate voice recognition\n");
hfp_hf_deactivate_voice_recognition_notification(device_addr);
hfp_hf_deactivate_voice_recognition_notification(acl_handle);
break;
case 'N':
printf("Activate voice recognition\n");
hfp_hf_activate_voice_recognition_notification(device_addr);
hfp_hf_activate_voice_recognition_notification(acl_handle);
break;
case 'o':
printf("Set speaker gain to 0 (minimum)\n");
hfp_hf_set_speaker_gain(device_addr, 0);
hfp_hf_set_speaker_gain(acl_handle, 0);
break;
case 'O':
printf("Set speaker gain to 9 (default)\n");
hfp_hf_set_speaker_gain(device_addr, 9);
hfp_hf_set_speaker_gain(acl_handle, 9);
break;
case 'p':
printf("Set speaker gain to 12 (higher)\n");
hfp_hf_set_speaker_gain(device_addr, 12);
hfp_hf_set_speaker_gain(acl_handle, 12);
break;
case 'P':
printf("Set speaker gain to 15 (maximum)\n");
hfp_hf_set_speaker_gain(device_addr, 15);
hfp_hf_set_speaker_gain(acl_handle, 15);
break;
case 'q':
printf("Set microphone gain to 0\n");
hfp_hf_set_microphone_gain(device_addr, 0);
hfp_hf_set_microphone_gain(acl_handle, 0);
break;
case 'Q':
printf("Set microphone gain to 9\n");
hfp_hf_set_microphone_gain(device_addr, 9);
hfp_hf_set_microphone_gain(acl_handle, 9);
break;
case 's':
printf("Set microphone gain to 12\n");
hfp_hf_set_microphone_gain(device_addr, 12);
hfp_hf_set_microphone_gain(acl_handle, 12);
break;
case 'S':
printf("Set microphone gain to 15\n");
hfp_hf_set_microphone_gain(device_addr, 15);
hfp_hf_set_microphone_gain(acl_handle, 15);
break;
case 'u':
printf("Send 'user busy' (Three-Way Call 0)\n");
hfp_hf_user_busy(device_addr);
hfp_hf_user_busy(acl_handle);
break;
case 'U':
printf("End active call and accept waiting/held call (Three-Way Call 1)\n");
hfp_hf_end_active_and_accept_other(device_addr);
hfp_hf_end_active_and_accept_other(acl_handle);
break;
case 'v':
printf("Swap active call and hold/waiting call (Three-Way Call 2)\n");
hfp_hf_swap_calls(device_addr);
hfp_hf_swap_calls(acl_handle);
break;
case 'V':
printf("Join hold call (Three-Way Call 3)\n");
hfp_hf_join_held_call(device_addr);
hfp_hf_join_held_call(acl_handle);
break;
case 'w':
printf("Connect calls (Three-Way Call 4)\n");
hfp_hf_connect_calls(device_addr);
hfp_hf_connect_calls(acl_handle);
break;
case 'W':
printf("Redial\n");
hfp_hf_redial_last_number(device_addr);
hfp_hf_redial_last_number(acl_handle);
break;
case 'x':
printf("Request phone number for voice tag\n");
hfp_hf_request_phone_number_for_voice_tag(device_addr);
hfp_hf_request_phone_number_for_voice_tag(acl_handle);
break;
case 'X':
printf("Query current call status\n");
hfp_hf_query_current_call_status(device_addr);
hfp_hf_query_current_call_status(acl_handle);
break;
case 'y':
printf("Release call with index 2\n");
hfp_hf_release_call_with_index(device_addr, 2);
hfp_hf_release_call_with_index(acl_handle, 2);
break;
case 'Y':
printf("Private consulation with call 2\n");
hfp_hf_private_consultation_with_call(device_addr, 2);
hfp_hf_private_consultation_with_call(acl_handle, 2);
break;
case '[':
printf("Query Response and Hold status (RHH ?)\n");
hfp_hf_rrh_query_status(device_addr);
hfp_hf_rrh_query_status(acl_handle);
break;
case ']':
printf("Place call in a response and held state (RHH 0)\n");
hfp_hf_rrh_hold_call(device_addr);
hfp_hf_rrh_hold_call(acl_handle);
break;
case '{':
printf("Accept held call (RHH 1)\n");
hfp_hf_rrh_accept_held_call(device_addr);
hfp_hf_rrh_accept_held_call(acl_handle);
break;
case '}':
printf("Reject held call (RHH 2)\n");
hfp_hf_rrh_reject_held_call(device_addr);
hfp_hf_rrh_reject_held_call(acl_handle);
break;
case '?':
printf("Query Subscriber Number\n");
hfp_hf_query_subscriber_number(device_addr);
hfp_hf_query_subscriber_number(acl_handle);
break;
case '!':
printf("Update HF indicator with assigned number 1 (HFI)\n");
hfp_hf_set_hf_indicator(device_addr, 1, 1);
hfp_hf_set_hf_indicator(acl_handle, 1, 1);
break;
default:
printf("HF: undefined user command\n");
@ -347,7 +348,7 @@ void simulate_test_sequence(hfp_test_item_t * test_item){
int supported_features = 0;
sscanf(&expected_cmd[8],"%d", &supported_features);
printf("Call hfp_hf_init with SF %d\n", supported_features);
hfp_hf_release_service_level_connection(device_addr);
hfp_hf_release_service_level_connection(acl_handle);
hfp_hf_init_supported_features(supported_features);
@ -397,6 +398,7 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * event, uint
switch (event[2]) {
case HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED:
printf("\n** SLC established **\n\n");
acl_handle = hfp_subevent_service_level_connection_established_get_con_handle(event);
service_level_connection_established = 1;
codecs_connection_established = 0;
audio_connection_established = 0;
@ -480,8 +482,8 @@ TEST_GROUP(HFPClient){
}
void teardown(void){
hfp_hf_release_audio_connection(device_addr);
hfp_hf_release_service_level_connection(device_addr);
hfp_hf_release_audio_connection(acl_handle);
hfp_hf_release_service_level_connection(acl_handle);
service_level_connection_established = 0;
codecs_connection_established = 0;