mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-26 21:35:16 +00:00
hfp: extract hfp_init_link_settings
This commit is contained in:
parent
f3a16b9a42
commit
65928b7817
24
src/hfp_ag.c
24
src/hfp_ag.c
@ -528,10 +528,24 @@ static int codecs_exchange_state_machine(hfp_connection_t * context){
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hfp_init_link_settings(hfp_connection_t * context){
|
||||
// determine highest possible link setting
|
||||
context->link_setting = HFP_LINK_SETTINGS_D1;
|
||||
if (hci_remote_eSCO_supported(context->con_handle)){
|
||||
context->link_setting = HFP_LINK_SETTINGS_S3;
|
||||
if ((context->remote_supported_features & (1<<HFP_HFSF_ESCO_S4))
|
||||
&& (hfp_supported_features & (1<<HFP_AGSF_ESCO_S4))){
|
||||
context->link_setting = HFP_LINK_SETTINGS_S4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void hfp_ag_slc_established(hfp_connection_t * context){
|
||||
context->state = HFP_SERVICE_LEVEL_CONNECTION_ESTABLISHED;
|
||||
hfp_emit_event(hfp_callback, HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED, 0);
|
||||
|
||||
hfp_init_link_settings(context);
|
||||
|
||||
// if active call exist, set per-connection state active, too (when audio is on)
|
||||
if (hfp_ag_call_state == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
|
||||
context->call_state = HFP_CALL_W4_AUDIO_CONNECTION_FOR_ACTIVE;
|
||||
@ -541,16 +555,6 @@ static void hfp_ag_slc_established(hfp_connection_t * context){
|
||||
hfp_ag_callsetup_state == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
|
||||
hfp_ag_hf_start_ringing(context);
|
||||
}
|
||||
|
||||
// determine highest possible link setting
|
||||
context->link_setting = HFP_LINK_SETTINGS_D1;
|
||||
if (hci_remote_eSCO_supported(context->con_handle)){
|
||||
context->link_setting = HFP_LINK_SETTINGS_S3;
|
||||
if ((context->remote_supported_features & (1<<HFP_HFSF_ESCO_S4))
|
||||
&& (hfp_supported_features & (1<<HFP_AGSF_ESCO_S4))){
|
||||
context->link_setting = HFP_LINK_SETTINGS_S4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int hfp_ag_run_for_context_service_level_connection(hfp_connection_t * context){
|
||||
|
Loading…
x
Reference in New Issue
Block a user