update hfp_ag version to 1.7.2

This commit is contained in:
xiongweichao 2022-05-31 11:02:40 +08:00
parent 32aa2ab24e
commit 90f464c671
7 changed files with 113 additions and 56 deletions

View File

@ -34,6 +34,10 @@ extern "C" {
#define ESP_HF_PEER_FEAT_ECC 0x80 /* Enhanced Call Control */ #define ESP_HF_PEER_FEAT_ECC 0x80 /* Enhanced Call Control */
#define ESP_HF_PEER_FEAT_EXTERR 0x100 /* Extended error codes */ #define ESP_HF_PEER_FEAT_EXTERR 0x100 /* Extended error codes */
#define ESP_HF_PEER_FEAT_CODEC 0x200 /* Codec Negotiation */ #define ESP_HF_PEER_FEAT_CODEC 0x200 /* Codec Negotiation */
/* HFP 1.7+ */
#define ESP_HF_PEER_FEAT_HF_IND 0x400 /* HF Indicators */
#define ESP_HF_PEER_FEAT_ESCO_S4 0x800 /* eSCO S4 Setting Supported */
/* CHLD feature masks of HF AG */ /* CHLD feature masks of HF AG */
#define ESP_HF_CHLD_FEAT_REL 0x01 /* 0 Release waiting call or held calls */ #define ESP_HF_CHLD_FEAT_REL 0x01 /* 0 Release waiting call or held calls */

View File

@ -272,7 +272,7 @@ const tBTA_AG_ST_TBL bta_ag_st_tbl[] =
/***************************************************************************** /*****************************************************************************
** Global data ** Global data
*****************************************************************************/ *****************************************************************************/
const char *bta_ag_version = "1.6"; const uint16_t bta_ag_version = HFP_VERSION_1_7;
/* AG control block */ /* AG control block */
#if BTA_DYNAMIC_MEMORY == FALSE #if BTA_DYNAMIC_MEMORY == FALSE
tBTA_AG_CB bta_ag_cb; tBTA_AG_CB bta_ag_cb;
@ -758,7 +758,7 @@ static void bta_ag_api_enable(tBTA_AG_DATA *p_data)
bta_ag_cb.p_cback = p_data->api_enable.p_cback; bta_ag_cb.p_cback = p_data->api_enable.p_cback;
bta_ag_cb.parse_mode = p_data->api_enable.parse_mode; bta_ag_cb.parse_mode = p_data->api_enable.parse_mode;
/* check if mSBC support enabled */ /* check if mSBC support enabled */
if (strcmp(bta_ag_version, "1.6") == 0) { if (bta_ag_version >= HFP_VERSION_1_6) {
bta_ag_cb.msbc_enabled = TRUE; bta_ag_cb.msbc_enabled = TRUE;
bta_ag_cb.scb->negotiated_codec = BTM_SCO_CODEC_MSBC; bta_ag_cb.scb->negotiated_codec = BTM_SCO_CODEC_MSBC;
} else{ } else{

View File

@ -70,10 +70,11 @@ enum
}; };
#if (BTM_WBS_INCLUDED == TRUE) #if (BTM_WBS_INCLUDED == TRUE)
#define BTA_AG_NUM_CODECS 3 #define BTA_AG_NUM_CODECS 4
#define BTA_AG_ESCO_SETTING_IDX_CVSD 0 /* eSCO setting for CVSD */ #define BTA_AG_ESCO_SETTING_IDX_CVSD 0 /* eSCO setting for CVSD */
#define BTA_AG_ESCO_SETTING_IDX_T1 1 /* eSCO setting for mSBC T1 */ #define BTA_AG_ESCO_SETTING_IDX_T1 1 /* eSCO setting for mSBC T1 */
#define BTA_AG_ESCO_SETTING_IDX_T2 2 /* eSCO setting for mSBC T2 */ #define BTA_AG_ESCO_SETTING_IDX_T2 2 /* eSCO setting for mSBC T2 */
#define BTA_AG_ESCO_SETTING_IDX_S4 3 /* eSCO setting for CVSD S4 */
static const tBTM_ESCO_PARAMS bta_ag_esco_params[BTA_AG_NUM_CODECS] = static const tBTM_ESCO_PARAMS bta_ag_esco_params[BTA_AG_NUM_CODECS] =
{ {
@ -81,7 +82,7 @@ static const tBTM_ESCO_PARAMS bta_ag_esco_params[BTA_AG_NUM_CODECS] =
{ {
BTM_64KBITS_RATE, /* TX Bandwidth (64 kbits/sec) */ BTM_64KBITS_RATE, /* TX Bandwidth (64 kbits/sec) */
BTM_64KBITS_RATE, /* RX Bandwidth (64 kbits/sec) */ BTM_64KBITS_RATE, /* RX Bandwidth (64 kbits/sec) */
0x000a, /* 10 ms (HS/HF can use EV3, 2-EV3, 3-EV3) */ 10, /* 10 ms (HS/HF can use EV3, 2-EV3, 3-EV3) */
BTM_VOICE_SETTING_CVSD, /* Inp Linear, Air CVSD, 2s Comp, 16bit */ BTM_VOICE_SETTING_CVSD, /* Inp Linear, Air CVSD, 2s Comp, 16bit */
(BTM_SCO_PKT_TYPES_MASK_HV1 + /* Packet Types */ (BTM_SCO_PKT_TYPES_MASK_HV1 + /* Packet Types */
BTM_SCO_PKT_TYPES_MASK_HV2 + BTM_SCO_PKT_TYPES_MASK_HV2 +
@ -117,16 +118,33 @@ static const tBTM_ESCO_PARAMS bta_ag_esco_params[BTA_AG_NUM_CODECS] =
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 | BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5), BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
BTM_ESCO_RETRANS_QUALITY /* Retransmission effort */ BTM_ESCO_RETRANS_QUALITY /* Retransmission effort */
} },
}; /* HFP 1.7+ */
#else /* eSCO CVSD S4 */
/* WBS not included, CVSD by default */
static const tBTM_ESCO_PARAMS bta_ag_esco_params =
{ {
BTM_64KBITS_RATE, /* TX Bandwidth (64 kbits/sec) */ BTM_64KBITS_RATE, /* TX Bandwidth (64 kbits/sec) */
BTM_64KBITS_RATE, /* RX Bandwidth (64 kbits/sec) */ BTM_64KBITS_RATE, /* RX Bandwidth (64 kbits/sec) */
0x000a, /* 10 ms (HS/HF can use EV3, 2-EV3, 3-EV3) */ 12, /* 12 ms (HS/HF can use EV3, 2-EV3) */
0x0060, /* Inp Linear, Air CVSD, 2s Comp, 16bit */ BTM_VOICE_SETTING_CVSD, /* Inp Linear, Air CVSD, 2s Comp, 16bit */
(BTM_SCO_LINK_ALL_PKT_MASK |
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
BTM_ESCO_RETRANS_QUALITY /* Retransmission effort */
}
};
#else
#define BTA_AG_NUM_CODECS 2
#define BTA_AG_ESCO_SETTING_IDX_CVSD 0 /* eSCO setting for CVSD S3 */
#define BTA_AG_ESCO_SETTING_IDX_S4 1 /* eSCO setting for CVSD S4 */
/* WBS not included, CVSD by default */
static const tBTM_ESCO_PARAMS bta_ag_esco_params[] =
{
{
BTM_64KBITS_RATE, /* TX Bandwidth (64 kbits/sec) */
BTM_64KBITS_RATE, /* RX Bandwidth (64 kbits/sec) */
10, /* 10 ms (HS/HF can use EV3, 2-EV3, 3-EV3) */
BTM_VOICE_SETTING_CVSD, /* Inp Linear, Air CVSD, 2s Comp, 16bit */
(BTM_SCO_PKT_TYPES_MASK_HV1 + /* Packet Types */ (BTM_SCO_PKT_TYPES_MASK_HV1 + /* Packet Types */
BTM_SCO_PKT_TYPES_MASK_HV2 + BTM_SCO_PKT_TYPES_MASK_HV2 +
BTM_SCO_PKT_TYPES_MASK_HV3 + BTM_SCO_PKT_TYPES_MASK_HV3 +
@ -136,6 +154,19 @@ static const tBTM_ESCO_PARAMS bta_ag_esco_params =
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 + BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 +
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5), BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
BTM_ESCO_RETRANS_POWER /* Retransmission effort */ BTM_ESCO_RETRANS_POWER /* Retransmission effort */
},
/* HFP 1.7+ */
/* eSCO CVSD S4 */
{
BTM_64KBITS_RATE, /* TX Bandwidth (64 kbits/sec) */
BTM_64KBITS_RATE, /* RX Bandwidth (64 kbits/sec) */
12, /* 12 ms (HS/HF can use EV3, 2-EV3) */
BTM_VOICE_SETTING_CVSD, /* Inp Linear, Air CVSD, 2s Comp, 16bit */
(BTM_SCO_LINK_ALL_PKT_MASK |
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
BTM_ESCO_RETRANS_QUALITY /* Retransmission effort */
}
}; };
#endif #endif
@ -470,9 +501,9 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
tBTM_STATUS status; tBTM_STATUS status;
UINT8 *p_bd_addr = NULL; UINT8 *p_bd_addr = NULL;
tBTM_ESCO_PARAMS params; tBTM_ESCO_PARAMS params;
UINT8 codec_index = BTA_AG_ESCO_SETTING_IDX_CVSD;
#if (BTM_WBS_INCLUDED == TRUE) #if (BTM_WBS_INCLUDED == TRUE)
tBTA_AG_PEER_CODEC esco_codec = BTM_SCO_CODEC_CVSD; tBTA_AG_PEER_CODEC esco_codec = BTM_SCO_CODEC_CVSD;
int codec_index = 0;
#endif #endif
#if (BTM_SCO_HCI_INCLUDED == TRUE) #if (BTM_SCO_HCI_INCLUDED == TRUE)
tBTM_SCO_ROUTE_TYPE sco_route; tBTM_SCO_ROUTE_TYPE sco_route;
@ -513,11 +544,20 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
codec_index = BTA_AG_ESCO_SETTING_IDX_T1; codec_index = BTA_AG_ESCO_SETTING_IDX_T1;
} }
} }
params = bta_ag_esco_params[codec_index]; /* If eSCO codec is CVSD and eSC0 S4 is supported, index is S4 */
else if ((esco_codec == BTM_SCO_CODEC_CVSD) && (p_scb->features & BTA_AG_FEAT_ESCO_S4)
&& (p_scb->peer_features & BTA_AG_PEER_FEAT_ESCO_S4))
{
codec_index = BTA_AG_ESCO_SETTING_IDX_S4;
}
#else #else
/* When WBS is not included, use CVSD by default */ if ((p_scb->features & BTA_AG_FEAT_ESCO_S4) && (p_scb->peer_features & BTA_AG_PEER_FEAT_ESCO_S4))
params = bta_ag_esco_params; {
codec_index = BTA_AG_ESCO_SETTING_IDX_S4;
}
#endif #endif
params = bta_ag_esco_params[codec_index];
if(bta_ag_cb.sco.param_updated) /* If we do not use the default parameters */ if(bta_ag_cb.sco.param_updated) /* If we do not use the default parameters */
params = bta_ag_cb.sco.params; params = bta_ag_cb.sco.params;
@ -527,6 +567,8 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
#if (BTM_WBS_INCLUDED == TRUE) #if (BTM_WBS_INCLUDED == TRUE)
if (esco_codec == BTM_SCO_CODEC_CVSD) /* For CVSD */ if (esco_codec == BTM_SCO_CODEC_CVSD) /* For CVSD */
#endif #endif
{
if (codec_index == BTA_AG_ESCO_SETTING_IDX_CVSD)
{ {
/* Use the application packet types (5 slot EV packets not allowed) */ /* Use the application packet types (5 slot EV packets not allowed) */
params.packet_types = p_bta_ag_cfg->sco_pkt_types | params.packet_types = p_bta_ag_cfg->sco_pkt_types |
@ -534,6 +576,7 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5; BTM_SCO_PKT_TYPES_MASK_NO_3_EV5;
} }
} }
}
/* if initiating, set current scb and peer bd addr */ /* if initiating, set current scb and peer bd addr */
if (is_orig) if (is_orig)
@ -1608,6 +1651,7 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB *p_scb, tBTM_ESCO_CONN_REQ_EVT_DATA *p_data
if (p_data->link_type == BTM_LINK_TYPE_SCO) if (p_data->link_type == BTM_LINK_TYPE_SCO)
{ {
resp.retrans_effort = BTM_ESCO_RETRANS_OFF;
resp.packet_types = (BTM_SCO_LINK_ONLY_MASK | resp.packet_types = (BTM_SCO_LINK_ONLY_MASK |
BTM_SCO_PKT_TYPES_MASK_NO_2_EV3 | BTM_SCO_PKT_TYPES_MASK_NO_2_EV3 |
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 | BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
@ -1616,6 +1660,13 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB *p_scb, tBTM_ESCO_CONN_REQ_EVT_DATA *p_data
} }
else /* Allow controller to use all types available except 5-slot EDR */ else /* Allow controller to use all types available except 5-slot EDR */
{ {
if ((p_scb->features & BTA_AG_FEAT_ESCO_S4) &&
(p_scb->peer_features & BTA_AG_PEER_FEAT_ESCO_S4))
{
resp.max_latency = 12;
resp.retrans_effort = BTM_ESCO_RETRANS_QUALITY;
}
resp.packet_types = (BTM_SCO_LINK_ALL_PKT_MASK | resp.packet_types = (BTM_SCO_LINK_ALL_PKT_MASK |
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 | BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5); BTM_SCO_PKT_TYPES_MASK_NO_3_EV5);

View File

@ -157,7 +157,7 @@ BOOLEAN bta_ag_add_record(UINT16 service_uuid, char *p_service_name, UINT8 scn,
/* add profile descriptor list */ /* add profile descriptor list */
if (service_uuid == UUID_SERVCLASS_AG_HANDSFREE) { if (service_uuid == UUID_SERVCLASS_AG_HANDSFREE) {
profile_uuid = UUID_SERVCLASS_HF_HANDSFREE; profile_uuid = UUID_SERVCLASS_HF_HANDSFREE;
version = HFP_VERSION_1_6; version = HFP_VERSION_1_7;
} else { } else {
profile_uuid = UUID_SERVCLASS_HEADSET; profile_uuid = UUID_SERVCLASS_HEADSET;
version = HSP_VERSION_1_2; version = HSP_VERSION_1_2;

View File

@ -48,6 +48,7 @@
#define HFP_VERSION_1_1 0x0101 #define HFP_VERSION_1_1 0x0101
#define HFP_VERSION_1_5 0x0105 #define HFP_VERSION_1_5 0x0105
#define HFP_VERSION_1_6 0x0106 #define HFP_VERSION_1_6 0x0106
#define HFP_VERSION_1_7 0x0107
#define HSP_VERSION_1_0 0x0100 #define HSP_VERSION_1_0 0x0100
#define HSP_VERSION_1_2 0x0102 #define HSP_VERSION_1_2 0x0102
@ -80,7 +81,7 @@
BTA_AG_FEAT_VTAG | BTA_AG_FEAT_REJECT | \ BTA_AG_FEAT_VTAG | BTA_AG_FEAT_REJECT | \
BTA_AG_FEAT_ECS | BTA_AG_FEAT_ECC | \ BTA_AG_FEAT_ECS | BTA_AG_FEAT_ECC | \
BTA_AG_FEAT_EXTERR | BTA_AG_FEAT_CODEC | \ BTA_AG_FEAT_EXTERR | BTA_AG_FEAT_CODEC | \
BTA_AG_FEAT_VOIP) BTA_AG_FEAT_ESCO_S4| BTA_AG_FEAT_VOIP)
#define BTA_AG_SDP_FEAT_SPEC (BTA_AG_FEAT_3WAY | BTA_AG_FEAT_ECNR | \ #define BTA_AG_SDP_FEAT_SPEC (BTA_AG_FEAT_3WAY | BTA_AG_FEAT_ECNR | \
BTA_AG_FEAT_VREC | BTA_AG_FEAT_INBAND | \ BTA_AG_FEAT_VREC | BTA_AG_FEAT_INBAND | \

View File

@ -45,12 +45,16 @@
#define BTA_AG_FEAT_ECC 0x00000080 /* Enhanced Call Control */ #define BTA_AG_FEAT_ECC 0x00000080 /* Enhanced Call Control */
#define BTA_AG_FEAT_EXTERR 0x00000100 /* Extended error codes */ #define BTA_AG_FEAT_EXTERR 0x00000100 /* Extended error codes */
#define BTA_AG_FEAT_CODEC 0x00000200 /* Codec Negotiation */ #define BTA_AG_FEAT_CODEC 0x00000200 /* Codec Negotiation */
#define BTA_AG_FEAT_VOIP 0x00000400 /* VoIP call */ /* HFP 1.7+ */
#define BTA_AG_FEAT_HF_IND 0x00000400 /* HF Indicators */
#define BTA_AG_FEAT_ESCO_S4 0x00000800 /* eSCO S4 Setting Supported */
/* Proprietary features: using 31 ~ 16 bits */ /* Proprietary features: using 31 ~ 16 bits */
#define BTA_AG_FEAT_BTRH 0x00010000 /* CCAP incoming call hold */ #define BTA_AG_FEAT_BTRH 0x00010000 /* CCAP incoming call hold */
#define BTA_AG_FEAT_UNAT 0x00020000 /* Pass unknown AT commands to application */ #define BTA_AG_FEAT_UNAT 0x00020000 /* Pass unknown AT commands to application */
#define BTA_AG_FEAT_NOSCO 0x00040000 /* No SCO control performed by BTA AG */ #define BTA_AG_FEAT_NOSCO 0x00040000 /* No SCO control performed by BTA AG */
#define BTA_AG_FEAT_NO_ESCO 0x00080000 /* Do not allow or use eSCO */ #define BTA_AG_FEAT_NO_ESCO 0x00080000 /* Do not allow or use eSCO */
#define BTA_AG_FEAT_VOIP 0x00100000 /* VoIP call */
typedef UINT32 tBTA_AG_FEAT; typedef UINT32 tBTA_AG_FEAT;
/* HFP peer features */ /* HFP peer features */
@ -62,9 +66,16 @@ typedef UINT32 tBTA_AG_FEAT;
#define BTA_AG_PEER_FEAT_ECS 0x0020 /* Enhanced Call Status */ #define BTA_AG_PEER_FEAT_ECS 0x0020 /* Enhanced Call Status */
#define BTA_AG_PEER_FEAT_ECC 0x0040 /* Enhanced Call Control */ #define BTA_AG_PEER_FEAT_ECC 0x0040 /* Enhanced Call Control */
#define BTA_AG_PEER_FEAT_CODEC 0x0080 /* Codec Negotiation */ #define BTA_AG_PEER_FEAT_CODEC 0x0080 /* Codec Negotiation */
#define BTA_AG_PEER_FEAT_VOIP 0x0100 /* VoIP call */ /* HFP 1.7+ */
#define BTA_AG_PEER_FEAT_HF_IND 0x0100 /* HF Indicators */
#define BTA_AG_PEER_FEAT_ESCO_S4 0x0200 /* eSCO S4 Setting Supported */
typedef UINT16 tBTA_AG_PEER_FEAT; typedef UINT16 tBTA_AG_PEER_FEAT;
/* Proprietary features: using bits after 12 */
/* Pass unknown AT command responses to application */
#define BTA_AG_PEER_FEAT_UNAT 0x1000
#define BTA_AG_PEER_FEAT_VOIP 0x2000 /* VoIP call */
/* AG extended call handling - masks not related to any spec */ /* AG extended call handling - masks not related to any spec */
#define BTA_AG_CLIENT_CHLD_REL 0x00000001 /* 0 Release waiting call or held calls */ #define BTA_AG_CLIENT_CHLD_REL 0x00000001 /* 0 Release waiting call or held calls */
#define BTA_AG_CLIENT_CHLD_REL_ACC 0x00000002 /* 1 Release active calls and accept other (waiting or held) cal */ #define BTA_AG_CLIENT_CHLD_REL_ACC 0x00000002 /* 1 Release active calls and accept other (waiting or held) cal */

View File

@ -1,20 +1,8 @@
/****************************************************************************** /*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* *
* Copyright (C) 2009-2012 Broadcom Corporation * SPDX-License-Identifier: Apache-2.0
* */
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/
/************************************************************************************ /************************************************************************************
* *
@ -68,6 +56,7 @@ static hf_local_param_t *hf_local_param;
BTA_AG_FEAT_VREC | \ BTA_AG_FEAT_VREC | \
BTA_AG_FEAT_INBAND | \ BTA_AG_FEAT_INBAND | \
BTA_AG_FEAT_CODEC | \ BTA_AG_FEAT_CODEC | \
BTA_AG_FEAT_ESCO_S4| \
BTA_AG_FEAT_UNAT) BTA_AG_FEAT_UNAT)
#endif #endif
#else #else
@ -78,6 +67,7 @@ static hf_local_param_t *hf_local_param;
BTA_AG_FEAT_EXTERR | \ BTA_AG_FEAT_EXTERR | \
BTA_AG_FEAT_VREC | \ BTA_AG_FEAT_VREC | \
BTA_AG_FEAT_INBAND | \ BTA_AG_FEAT_INBAND | \
BTA_AG_FEAT_ESCO_S4| \
BTA_AG_FEAT_UNAT) BTA_AG_FEAT_UNAT)
#endif #endif
#endif #endif