mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-28 08:37:22 +00:00
hfp: support CLIP in HF
This commit is contained in:
parent
dfbd9600be
commit
66ee7d3e0b
28
src/hfp.h
28
src/hfp.h
@ -510,11 +510,7 @@ typedef struct hfp_connection {
|
|||||||
uint8_t establish_audio_connection;
|
uint8_t establish_audio_connection;
|
||||||
uint8_t release_audio_connection;
|
uint8_t release_audio_connection;
|
||||||
|
|
||||||
uint8_t change_in_band_ring_tone_setting;
|
timer_source_t hfp_timeout;
|
||||||
uint8_t ag_ring;
|
|
||||||
uint8_t ag_send_clip;
|
|
||||||
uint8_t ag_echo_and_noise_reduction;
|
|
||||||
uint8_t ag_activate_voice_recognition;
|
|
||||||
|
|
||||||
uint8_t microphone_gain;
|
uint8_t microphone_gain;
|
||||||
uint8_t send_microphone_gain;
|
uint8_t send_microphone_gain;
|
||||||
@ -523,22 +519,26 @@ typedef struct hfp_connection {
|
|||||||
uint8_t send_speaker_gain;
|
uint8_t send_speaker_gain;
|
||||||
|
|
||||||
uint8_t send_phone_number_for_voice_tag;
|
uint8_t send_phone_number_for_voice_tag;
|
||||||
|
uint8_t send_ag_status_indicators;
|
||||||
|
uint8_t send_response_and_hold_active;
|
||||||
|
uint8_t send_response_and_hold_status;
|
||||||
|
|
||||||
|
// AG only
|
||||||
|
uint8_t change_in_band_ring_tone_setting;
|
||||||
|
uint8_t ag_ring;
|
||||||
|
uint8_t ag_send_clip;
|
||||||
|
uint8_t ag_echo_and_noise_reduction;
|
||||||
|
uint8_t ag_activate_voice_recognition;
|
||||||
uint8_t send_subscriber_number;
|
uint8_t send_subscriber_number;
|
||||||
int next_subscriber_number_to_send;
|
uint8_t next_subscriber_number_to_send;
|
||||||
|
|
||||||
int send_status_of_current_calls;
|
int send_status_of_current_calls;
|
||||||
|
|
||||||
uint8_t hf_answer_incoming_call;
|
|
||||||
|
|
||||||
int send_ag_status_indicators;
|
|
||||||
int send_response_and_hold_active;
|
|
||||||
int send_response_and_hold_status;
|
|
||||||
|
|
||||||
// HF only
|
// HF only
|
||||||
hfp_hf_query_operator_state_t hf_query_operator_state;
|
hfp_hf_query_operator_state_t hf_query_operator_state;
|
||||||
|
uint8_t hf_answer_incoming_call;
|
||||||
|
uint8_t hf_send_clip_enable;
|
||||||
|
|
||||||
timer_source_t hfp_timeout;
|
|
||||||
} hfp_connection_t;
|
} hfp_connection_t;
|
||||||
|
|
||||||
// UTILS_START : TODO move to utils
|
// UTILS_START : TODO move to utils
|
||||||
|
21
src/hfp_hf.c
21
src/hfp_hf.c
@ -236,6 +236,12 @@ static int hfp_hf_cmd_ata(uint16_t cid){
|
|||||||
return send_str_over_rfcomm(cid, buffer);
|
return send_str_over_rfcomm(cid, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int hfp_hf_send_clip_enable(uint16_t cid){
|
||||||
|
char buffer[20];
|
||||||
|
sprintf(buffer, "AT%s=1\r\n", HFP_ENABLE_CLIP);
|
||||||
|
return send_str_over_rfcomm(cid, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
static void hfp_emit_ag_indicator_event(hfp_callback_t callback, int status, hfp_ag_indicator_t indicator){
|
static void hfp_emit_ag_indicator_event(hfp_callback_t callback, int status, hfp_ag_indicator_t indicator){
|
||||||
if (!callback) return;
|
if (!callback) return;
|
||||||
uint8_t event[6+HFP_MAX_INDICATOR_DESC_SIZE+1];
|
uint8_t event[6+HFP_MAX_INDICATOR_DESC_SIZE+1];
|
||||||
@ -333,6 +339,13 @@ static int hfp_hf_run_for_context_service_level_connection_queries(hfp_connectio
|
|||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (context->hf_send_clip_enable){
|
||||||
|
context->hf_send_clip_enable = 0;
|
||||||
|
context->ok_pending = 1;
|
||||||
|
hfp_hf_send_clip_enable(context->rfcomm_cid);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
switch (context->hf_query_operator_state){
|
switch (context->hf_query_operator_state){
|
||||||
case HFP_HF_QUERY_OPERATOR_SET_FORMAT:
|
case HFP_HF_QUERY_OPERATOR_SET_FORMAT:
|
||||||
context->hf_query_operator_state = HFP_HF_QUERY_OPERATOR_W4_SET_FORMAT_OK;
|
context->hf_query_operator_state = HFP_HF_QUERY_OPERATOR_W4_SET_FORMAT_OK;
|
||||||
@ -813,9 +826,17 @@ void hfp_hf_answer_incoming_call(bd_addr_t bd_addr){
|
|||||||
// HACK - remove after hfp_callsetup_state is updated
|
// HACK - remove after hfp_callsetup_state is updated
|
||||||
connection->hf_answer_incoming_call = 1;
|
connection->hf_answer_incoming_call = 1;
|
||||||
(void) hfp_callsetup_state;
|
(void) hfp_callsetup_state;
|
||||||
|
hfp_run_for_context(connection);
|
||||||
// if (hfp_callsetup_state == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
|
// if (hfp_callsetup_state == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
|
||||||
// connection->hf_answer_incoming_call = 1;
|
// connection->hf_answer_incoming_call = 1;
|
||||||
// } else {
|
// } else {
|
||||||
// log_error("HFP HF: answering incoming call in wrong callsetup state %u", hfp_callsetup_state);
|
// log_error("HFP HF: answering incoming call in wrong callsetup state %u", hfp_callsetup_state);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void hfp_hf_enable_calling_line_identification(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_clip_enable = 1;
|
||||||
|
hfp_run_for_context(connection);
|
||||||
|
}
|
||||||
|
@ -155,6 +155,11 @@ void hfp_hf_release_audio_connection(bd_addr_t bd_addr);
|
|||||||
*/
|
*/
|
||||||
void hfp_hf_answer_incoming_call(bd_addr_t bd_addr);
|
void hfp_hf_answer_incoming_call(bd_addr_t bd_addr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*/
|
||||||
|
void hfp_hf_enable_calling_line_identification(bd_addr_t bd_addr);
|
||||||
|
|
||||||
/* API_END */
|
/* API_END */
|
||||||
|
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
|
@ -111,6 +111,7 @@ static void show_usage(void){
|
|||||||
printf("f - answer incoming call\n");
|
printf("f - answer incoming call\n");
|
||||||
|
|
||||||
printf("g - query network operator name\n");
|
printf("g - query network operator name\n");
|
||||||
|
printf("h - enable Calling Line Identification.\n");
|
||||||
|
|
||||||
printf("t - terminate connection\n");
|
printf("t - terminate connection\n");
|
||||||
|
|
||||||
@ -169,6 +170,10 @@ static int stdin_process(struct data_source *ds){
|
|||||||
printf("Query operator.\n");
|
printf("Query operator.\n");
|
||||||
hfp_hf_query_operator_selection(device_addr);
|
hfp_hf_query_operator_selection(device_addr);
|
||||||
break;
|
break;
|
||||||
|
case 'h':
|
||||||
|
printf("Enable Calling Line Identification.\n");
|
||||||
|
hfp_hf_enable_calling_line_identification(device_addr);
|
||||||
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
printf("Terminate HCI connection.\n");
|
printf("Terminate HCI connection.\n");
|
||||||
gap_disconnect(handle);
|
gap_disconnect(handle);
|
||||||
@ -204,6 +209,12 @@ static void packet_handler(uint8_t * event, uint16_t event_size){
|
|||||||
case HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED:
|
case HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED:
|
||||||
printf("Service level connection released.\n\n");
|
printf("Service level connection released.\n\n");
|
||||||
break;
|
break;
|
||||||
|
case HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED:
|
||||||
|
printf("\n** Audio connection established **\n");
|
||||||
|
break;
|
||||||
|
case HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED:
|
||||||
|
printf("\n** Audio connection released **\n");
|
||||||
|
break;
|
||||||
case HFP_SUBEVENT_COMPLETE:
|
case HFP_SUBEVENT_COMPLETE:
|
||||||
switch (cmd){
|
switch (cmd){
|
||||||
case 'd':
|
case 'd':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user