mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-14 01:27:41 +00:00
Merge branch 'master' of https://github.com/bluekitchen/btstack
This commit is contained in:
commit
656d48c76f
@ -696,7 +696,7 @@ static hfp_command_t parse_command(const char * line_buffer, int isHandsFree){
|
||||
return HFP_CMD_CALL_PHONE_NUMBER;
|
||||
}
|
||||
|
||||
if (strncmp(line_buffer, HFP_REDIAL_LAST_NUMBER, strlen(HFP_REDIAL_LAST_NUMBER)) == 0){
|
||||
if (strncmp(line_buffer+offset, HFP_REDIAL_LAST_NUMBER, strlen(HFP_REDIAL_LAST_NUMBER)) == 0){
|
||||
return HFP_CMD_REDIAL_LAST_NUMBER;
|
||||
}
|
||||
|
||||
|
17
src/hfp.h
17
src/hfp.h
@ -124,7 +124,7 @@ extern "C" {
|
||||
#define HFP_HANG_UP_CALL "+CHUP"
|
||||
#define HFP_CHANGE_IN_BAND_RING_TONE_SETTING "+BSIR"
|
||||
#define HFP_CALL_PHONE_NUMBER "ATD"
|
||||
#define HFP_REDIAL_LAST_NUMBER "AT+BLDN"
|
||||
#define HFP_REDIAL_LAST_NUMBER "+BLDN"
|
||||
#define HFP_TURN_OFF_EC_AND_NR "+NREC" // EC (Echo CAnceling), NR (Noise Reduction)
|
||||
#define HFP_ACTIVATE_VOICE_RECOGNITION "+BVRA" // EC (Echo CAnceling), NR (Noise Reduction)
|
||||
#define HFP_SET_MICROPHONE_GAIN "+VGM"
|
||||
@ -552,9 +552,22 @@ typedef struct hfp_connection {
|
||||
// HF only
|
||||
hfp_hf_query_operator_state_t hf_query_operator_state;
|
||||
uint8_t hf_answer_incoming_call;
|
||||
uint8_t hf_initiate_outgoing_call;
|
||||
uint8_t hf_initiate_memory_dialing;
|
||||
uint8_t hf_initiate_redial_last_number;
|
||||
|
||||
uint8_t hf_send_clip_enable;
|
||||
uint8_t hf_send_chup;
|
||||
|
||||
uint8_t hf_activate_call_waiting_notification;
|
||||
uint8_t hf_deactivate_call_waiting_notification;
|
||||
|
||||
uint8_t hf_activate_calling_line_notification;
|
||||
uint8_t hf_deactivate_calling_line_notification;
|
||||
uint8_t hf_activate_echo_canceling_and_noise_reduction;
|
||||
uint8_t hf_deactivate_echo_canceling_and_noise_reduction;
|
||||
uint8_t hf_activate_voice_recognition_notification;
|
||||
uint8_t hf_deactivate_voice_recognition_notification;
|
||||
|
||||
} hfp_connection_t;
|
||||
|
||||
// UTILS_START : TODO move to utils
|
||||
|
342
src/hfp_hf.c
342
src/hfp_hf.c
@ -73,9 +73,11 @@ static uint8_t hfp_indicators_status;
|
||||
|
||||
static hfp_callback_t hfp_callback;
|
||||
|
||||
// static hfp_call_status_t hfp_call_state;
|
||||
static hfp_callsetup_status_t hfp_callsetup_state;
|
||||
// static hfp_callheld_status_t hfp_callheld_state;
|
||||
static hfp_call_status_t hfp_call_status;
|
||||
static hfp_callsetup_status_t hfp_callsetup_status;
|
||||
static hfp_callheld_status_t hfp_callheld_status;
|
||||
|
||||
static char phone_number[25];
|
||||
|
||||
void hfp_hf_register_packet_handler(hfp_callback_t callback){
|
||||
hfp_callback = callback;
|
||||
@ -236,9 +238,57 @@ static int hfp_hf_cmd_ata(uint16_t cid){
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
}
|
||||
|
||||
static int hfp_hf_send_clip_enable(uint16_t cid){
|
||||
static int hfp_hf_set_microphone_gain_cmd(uint16_t cid, int gain){
|
||||
char buffer[40];
|
||||
sprintf(buffer, "AT%s=%d\r\n", HFP_SET_MICROPHONE_GAIN, gain);
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
}
|
||||
|
||||
static int hfp_hf_set_speaker_gain_cmd(uint16_t cid, int gain){
|
||||
char buffer[40];
|
||||
sprintf(buffer, "AT%s=%d\r\n", HFP_SET_SPEAKER_GAIN, gain);
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
}
|
||||
|
||||
static int hfp_hf_set_calling_line_notification_cmd(uint16_t cid, uint8_t activate){
|
||||
char buffer[40];
|
||||
sprintf(buffer, "AT%s=%d\r\n", HFP_ENABLE_CLIP, activate);
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
}
|
||||
|
||||
static int hfp_hf_set_echo_canceling_and_noise_reduction_cmd(uint16_t cid, uint8_t activate){
|
||||
char buffer[40];
|
||||
sprintf(buffer, "AT%s=%d\r\n", HFP_TURN_OFF_EC_AND_NR, activate);
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
}
|
||||
|
||||
static int hfp_hf_set_voice_recognition_notification_cmd(uint16_t cid, uint8_t activate){
|
||||
char buffer[40];
|
||||
sprintf(buffer, "AT%s=%d\r\n", HFP_ACTIVATE_VOICE_RECOGNITION, activate);
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
}
|
||||
|
||||
static int hfp_hf_set_call_waiting_notification_cmd(uint16_t cid, uint8_t activate){
|
||||
char buffer[40];
|
||||
sprintf(buffer, "AT%s=%d\r\n", HFP_ENABLE_CALL_WAITING_NOTIFICATION, activate);
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
}
|
||||
|
||||
static int hfp_hf_initiate_outgoing_call_cmd(uint16_t cid){
|
||||
char buffer[40];
|
||||
sprintf(buffer, "%s%s;\r\n", HFP_CALL_PHONE_NUMBER, phone_number);
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
}
|
||||
|
||||
static int hfp_hf_send_memory_dial_cmd(uint16_t cid){
|
||||
char buffer[40];
|
||||
sprintf(buffer, "%s>%s;\r\n", HFP_CALL_PHONE_NUMBER, phone_number);
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
}
|
||||
|
||||
static int hfp_hf_send_redial_last_number_cmd(uint16_t cid){
|
||||
char buffer[20];
|
||||
sprintf(buffer, "AT%s=1\r\n", HFP_ENABLE_CLIP);
|
||||
sprintf(buffer, "AT%s\r\n", HFP_REDIAL_LAST_NUMBER);
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
}
|
||||
|
||||
@ -473,11 +523,96 @@ static void hfp_run_for_context(hfp_connection_t * context){
|
||||
if (!done){
|
||||
done = call_setup_state_machine(context);
|
||||
}
|
||||
|
||||
if (context->hf_send_clip_enable){
|
||||
context->hf_send_clip_enable = 0;
|
||||
|
||||
if (context->send_microphone_gain){
|
||||
context->send_microphone_gain = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_send_clip_enable(context->rfcomm_cid);
|
||||
hfp_hf_set_microphone_gain_cmd(context->rfcomm_cid, context->microphone_gain);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->send_speaker_gain){
|
||||
context->send_speaker_gain = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_set_speaker_gain_cmd(context->rfcomm_cid, context->speaker_gain);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_deactivate_calling_line_notification){
|
||||
context->hf_deactivate_calling_line_notification = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_set_calling_line_notification_cmd(context->rfcomm_cid, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_activate_calling_line_notification){
|
||||
context->hf_activate_calling_line_notification = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_set_calling_line_notification_cmd(context->rfcomm_cid, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_deactivate_echo_canceling_and_noise_reduction){
|
||||
context->hf_deactivate_echo_canceling_and_noise_reduction = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_set_echo_canceling_and_noise_reduction_cmd(context->rfcomm_cid, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_activate_echo_canceling_and_noise_reduction){
|
||||
context->hf_activate_echo_canceling_and_noise_reduction = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_set_echo_canceling_and_noise_reduction_cmd(context->rfcomm_cid, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_deactivate_voice_recognition_notification){
|
||||
context->hf_deactivate_voice_recognition_notification = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_set_voice_recognition_notification_cmd(context->rfcomm_cid, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_activate_voice_recognition_notification){
|
||||
context->hf_activate_voice_recognition_notification = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_set_voice_recognition_notification_cmd(context->rfcomm_cid, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (context->hf_deactivate_call_waiting_notification){
|
||||
context->hf_deactivate_call_waiting_notification = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_set_call_waiting_notification_cmd(context->rfcomm_cid, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_activate_call_waiting_notification){
|
||||
context->hf_activate_call_waiting_notification = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_set_call_waiting_notification_cmd(context->rfcomm_cid, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_initiate_outgoing_call){
|
||||
context->hf_initiate_outgoing_call = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_initiate_outgoing_call_cmd(context->rfcomm_cid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_initiate_memory_dialing){
|
||||
context->hf_initiate_memory_dialing = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_send_memory_dial_cmd(context->rfcomm_cid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_initiate_redial_last_number){
|
||||
context->hf_initiate_redial_last_number = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_send_redial_last_number_cmd(context->rfcomm_cid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -638,14 +773,6 @@ static void hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8
|
||||
for (pos = 0; pos < size ; pos++){
|
||||
hfp_parse(context, packet[pos], 1);
|
||||
}
|
||||
// emit indicators status changed
|
||||
for (i = 0; i < context->ag_indicators_nr; i++){
|
||||
if (context->ag_indicators[i].status_changed) {
|
||||
context->ag_indicators[i].status_changed = 0;
|
||||
hfp_emit_ag_indicator_event(hfp_callback, 0, context->ag_indicators[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (context->command){
|
||||
case HFP_CMD_EXTENDED_AUDIO_GATEWAY_ERROR:
|
||||
@ -657,6 +784,7 @@ static void hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8
|
||||
context->ok_pending = 0;
|
||||
hfp_reset_context_flags(context);
|
||||
hfp_emit_event(hfp_callback, HFP_SUBEVENT_COMPLETE, 1);
|
||||
context->command = HFP_CMD_NONE;
|
||||
break;
|
||||
case HFP_CMD_OK:
|
||||
hfp_hf_switch_on_ok(context);
|
||||
@ -664,6 +792,22 @@ static void hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8
|
||||
case HFP_CMD_RING:
|
||||
hfp_emit_event(hfp_callback, HFP_SUBEVENT_RING, 0);
|
||||
break;
|
||||
case HFP_CMD_TRANSFER_AG_INDICATOR_STATUS:
|
||||
for (i = 0; i < context->ag_indicators_nr; i++){
|
||||
if (context->ag_indicators[i].status_changed) {
|
||||
if (strcmp(context->ag_indicators[i].name, "callsetup") == 0){
|
||||
hfp_callsetup_status = (hfp_callsetup_status_t) context->ag_indicators[i].status;
|
||||
} else if (strcmp(context->ag_indicators[i].name, "callheld") == 0){
|
||||
hfp_callheld_status = (hfp_callheld_status_t) context->ag_indicators[i].status;
|
||||
} else if (strcmp(context->ag_indicators[i].name, "call") == 0){
|
||||
hfp_call_status = (hfp_call_status_t) context->ag_indicators[i].status;
|
||||
}
|
||||
context->ag_indicators[i].status_changed = 0;
|
||||
hfp_emit_ag_indicator_event(hfp_callback, 0, context->ag_indicators[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -853,27 +997,167 @@ void hfp_hf_answer_incoming_call(bd_addr_t bd_addr){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
|
||||
// HACK - remove after hfp_callsetup_state is updated
|
||||
connection->hf_answer_incoming_call = 1;
|
||||
(void) hfp_callsetup_state;
|
||||
hfp_run_for_context(connection);
|
||||
// if (hfp_callsetup_state == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
|
||||
// connection->hf_answer_incoming_call = 1;
|
||||
// } else {
|
||||
// log_error("HFP HF: answering incoming call in wrong callsetup state %u", hfp_callsetup_state);
|
||||
// }
|
||||
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
|
||||
connection->hf_answer_incoming_call = 1;
|
||||
hfp_run_for_context(connection);
|
||||
} else {
|
||||
log_error("HFP HF: answering incoming call with wrong callsetup status %u", hfp_callsetup_status);
|
||||
}
|
||||
}
|
||||
|
||||
void hfp_hf_terminate_call(bd_addr_t bd_addr){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
connection->hf_send_chup = 1;
|
||||
|
||||
if (hfp_call_status == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
|
||||
connection->hf_send_chup = 1;
|
||||
hfp_run_for_context(connection);
|
||||
} else {
|
||||
log_error("HFP HF: terminating incoming call with wrong call status %u", hfp_call_status);
|
||||
}
|
||||
}
|
||||
|
||||
void hfp_hf_reject_call(bd_addr_t bd_addr){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
|
||||
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
|
||||
connection->hf_send_chup = 1;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
}
|
||||
|
||||
void hfp_hf_dial_number(bd_addr_t bd_addr, char * number){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
|
||||
connection->hf_initiate_outgoing_call = 1;
|
||||
snprintf(phone_number, sizeof(phone_number), "%s", number);
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
void hfp_hf_enable_calling_line_identification(bd_addr_t bd_addr){
|
||||
void hfp_hf_dial_memory(bd_addr_t bd_addr, char * number){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
connection->hf_send_clip_enable = 1;
|
||||
|
||||
connection->hf_initiate_memory_dialing = 1;
|
||||
snprintf(phone_number, sizeof(phone_number), "%s", number);
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
void hfp_hf_redial_last_number(bd_addr_t bd_addr){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
|
||||
connection->hf_initiate_redial_last_number = 1;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
void hfp_hf_activate_call_waiting_notification(bd_addr_t bd_addr){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
|
||||
connection->hf_activate_call_waiting_notification = 1;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
|
||||
void hfp_hf_deactivate_call_waiting_notification(bd_addr_t bd_addr){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
|
||||
connection->hf_deactivate_call_waiting_notification = 1;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
|
||||
void hfp_hf_activate_calling_line_notification(bd_addr_t bd_addr){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
|
||||
connection->hf_deactivate_calling_line_notification = 1;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_deactivate_calling_line_notification(bd_addr_t bd_addr){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
|
||||
connection->hf_deactivate_calling_line_notification = 1;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
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 * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
|
||||
connection->hf_deactivate_echo_canceling_and_noise_reduction = 1;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
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 * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
|
||||
connection->hf_deactivate_echo_canceling_and_noise_reduction = 1;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_activate_voice_recognition_notification(bd_addr_t bd_addr){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
|
||||
connection->hf_deactivate_voice_recognition_notification = 1;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_deactivate_voice_recognition_notification(bd_addr_t bd_addr){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
|
||||
connection->hf_deactivate_voice_recognition_notification = 1;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_set_microphone_gain(bd_addr_t bd_addr, int gain){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
if (connection->microphone_gain == gain) return;
|
||||
|
||||
connection->microphone_gain = gain;
|
||||
connection->send_microphone_gain = 1;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_set_speaker_gain(bd_addr_t bd_addr, int gain){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
if (connection->speaker_gain == gain) return;
|
||||
|
||||
connection->speaker_gain = gain;
|
||||
connection->send_speaker_gain = 1;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
|
68
src/hfp_hf.h
68
src/hfp_hf.h
@ -154,6 +154,11 @@ void hfp_hf_release_audio_connection(bd_addr_t bd_addr);
|
||||
*/
|
||||
void hfp_hf_answer_incoming_call(bd_addr_t bd_addr);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_reject_call(bd_addr_t bd_addr);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
@ -162,7 +167,68 @@ void hfp_hf_terminate_call(bd_addr_t bd_addr);
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_enable_calling_line_identification(bd_addr_t bd_addr);
|
||||
void hfp_hf_dial_number(bd_addr_t bd_addr, char * number);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_dial_memory(bd_addr_t bd_addr, char * number);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_redial_last_number(bd_addr_t bd_addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_activate_call_waiting_notification(bd_addr_t bd_addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_deactivate_call_waiting_notification(bd_addr_t bd_addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_activate_calling_line_notification(bd_addr_t bd_addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_deactivate_calling_line_notification(bd_addr_t bd_addr);
|
||||
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_activate_echo_canceling_and_noise_reduction(bd_addr_t bd_addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_deactivate_echo_canceling_and_noise_reduction(bd_addr_t bd_addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_activate_voice_recognition_notification(bd_addr_t bd_addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_deactivate_voice_recognition_notification(bd_addr_t bd_addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_set_microphone_gain(bd_addr_t bd_addr, int gain);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_set_speaker_gain(bd_addr_t bd_addr, int gain);
|
||||
|
||||
/* API_END */
|
||||
|
||||
|
@ -99,21 +99,51 @@ static void show_usage(void){
|
||||
printf("b - establish Audio connection\n");
|
||||
printf("B - release Audio connection\n");
|
||||
|
||||
printf("C - enable registration status update for all AG indicators\n");
|
||||
printf("c - disable registration status update for all AG indicators\n");
|
||||
printf("C - enable registration status update for all AG indicators\n");
|
||||
|
||||
printf("d - query network operator.\n");
|
||||
printf("D - set HFP AG registration status update for individual indicators\n");
|
||||
printf("d - Query network operator.\n");
|
||||
|
||||
printf("E - enable reporting of the extended AG error result code\n");
|
||||
printf("e - disable reporting of the extended AG error result code\n");
|
||||
printf("E - enable reporting of the extended AG error result code\n");
|
||||
|
||||
printf("f - answer incoming call\n");
|
||||
printf("F - Hangup call\n");
|
||||
|
||||
printf("g - query network operator name\n");
|
||||
printf("G - reject call\n");
|
||||
|
||||
printf("h - enable Calling Line Identification.\n");
|
||||
|
||||
printf("i - dial 1234567\n");
|
||||
printf("I - redial\n");
|
||||
|
||||
printf("j - dial #1\n");
|
||||
printf("J - dial #99\n");
|
||||
|
||||
printf("k - deactivate call waiting notification\n");
|
||||
printf("K - activate call waiting notification\n");
|
||||
|
||||
printf("l - deactivate calling line notification\n");
|
||||
printf("L - activate calling line notification\n");
|
||||
|
||||
printf("m - deactivate echo canceling and noise reduction\n");
|
||||
printf("M - activate echo canceling and noise reduction\n");
|
||||
|
||||
printf("n - deactivate voice recognition notification\n");
|
||||
printf("N - activate voice recognition notification\n");
|
||||
|
||||
printf("o - Set speaker volume to 0 (minimum)\n");
|
||||
printf("O - Set speaker volume to 9 (default)\n");
|
||||
printf("p - Set speaker volume to 12 (higher)\n");
|
||||
printf("P - Set speaker volume to 15 (maximum)\n");
|
||||
|
||||
printf("q - Set microphone gain to 0 (minimum)\n");
|
||||
printf("Q - Set microphone gain to 9 (default)\n");
|
||||
printf("s - Set microphone gain to 12 (higher)\n");
|
||||
printf("S - Set microphone gain to 15 (maximum)\n");
|
||||
|
||||
printf("t - terminate connection\n");
|
||||
|
||||
printf("---\n");
|
||||
@ -171,6 +201,10 @@ static int stdin_process(struct data_source *ds){
|
||||
printf("Hangup call.\n");
|
||||
hfp_hf_terminate_call(device_addr);
|
||||
break;
|
||||
case 'G':
|
||||
printf("Reject call.\n");
|
||||
hfp_hf_reject_call(device_addr);
|
||||
break;
|
||||
case 'g':
|
||||
printf("Query operator.\n");
|
||||
hfp_hf_query_operator_selection(device_addr);
|
||||
@ -187,6 +221,78 @@ static int stdin_process(struct data_source *ds){
|
||||
memcpy(device_addr, phone_addr, 6);
|
||||
printf("Use iPhone %s as Audiogateway.\n", bd_addr_to_str(device_addr));
|
||||
break;
|
||||
case 'i':
|
||||
printf("Dial 1234567\n");
|
||||
hfp_hf_dial_number(device_addr, "1234567");
|
||||
break;
|
||||
case 'I':
|
||||
printf("Redial\n");
|
||||
hfp_hf_redial_last_number(device_addr);
|
||||
break;
|
||||
case 'j':
|
||||
printf("Dial #1\n");
|
||||
hfp_hf_dial_memory(device_addr,"#1");
|
||||
break;
|
||||
case 'J':
|
||||
printf("Dial #99\n");
|
||||
hfp_hf_dial_memory(device_addr,"#99");
|
||||
break;
|
||||
case 'k':
|
||||
printf("Deactivate call waiting notification\n");
|
||||
hfp_hf_deactivate_call_waiting_notification(device_addr);
|
||||
break;
|
||||
case 'K':
|
||||
printf("Activate call waiting notification\n");
|
||||
hfp_hf_activate_call_waiting_notification(device_addr);
|
||||
break;
|
||||
case 'l':
|
||||
printf("Deactivate calling line notification\n");
|
||||
hfp_hf_deactivate_calling_line_notification(device_addr);
|
||||
break;
|
||||
case 'L':
|
||||
printf("Activate calling line notification\n");
|
||||
hfp_hf_activate_calling_line_notification(device_addr);
|
||||
break;
|
||||
case 'm':
|
||||
printf("Deactivate echo canceling and noise reduction\n");
|
||||
hfp_hf_deactivate_echo_canceling_and_noise_reduction(device_addr);
|
||||
break;
|
||||
case 'M':
|
||||
printf("Activate echo canceling and noise reduction\n");
|
||||
hfp_hf_activate_echo_canceling_and_noise_reduction(device_addr);
|
||||
break;
|
||||
case 'n':
|
||||
printf("Deactivate voice recognition notification\n");
|
||||
hfp_hf_deactivate_voice_recognition_notification(device_addr);
|
||||
break;
|
||||
case 'N':
|
||||
printf("Activate voice recognition notification\n");
|
||||
hfp_hf_activate_voice_recognition_notification(device_addr);
|
||||
break;
|
||||
case 'o':
|
||||
printf("Set speaker gain to 0 (minimum)\n");
|
||||
hfp_hf_set_speaker_gain(device_addr, 0);
|
||||
break;
|
||||
case 'O':
|
||||
printf("Set speaker gain to 9 (default)\n");
|
||||
hfp_hf_set_speaker_gain(device_addr, 9);
|
||||
break;
|
||||
case 'p':
|
||||
printf("Set speaker gain to 12 (higher)\n");
|
||||
hfp_hf_set_speaker_gain(device_addr, 12);
|
||||
break;
|
||||
case 'P':
|
||||
printf("Set speaker gain to 15 (maximum)\n");
|
||||
hfp_hf_set_speaker_gain(device_addr, 15);
|
||||
break;
|
||||
case 'q':
|
||||
printf("Set microphone gain to 0\n");
|
||||
hfp_hf_set_microphone_gain(device_addr, 0);
|
||||
break;
|
||||
case 'Q':
|
||||
printf("Set microphone gain to 9\n");
|
||||
hfp_hf_set_microphone_gain(device_addr, 9);
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user