mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/update_hfp_hf_version_v4.4' into 'release/v4.4'
Update HFP_HF version to 1.7.2(v4.4) See merge request espressif/esp-idf!17382
This commit is contained in:
commit
7a2068c864
@ -60,6 +60,9 @@ typedef enum {
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_ECC 0x80 /* Enhanced Call Control */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_EXTERR 0x100 /* Extended error codes */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_CODEC 0x200 /* Codec Negotiation */
|
||||
/* HFP 1.7+ */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_HF_IND 0x400 /* HF Indicators */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_ESCO_S4 0x800 /* eSCO S4 Setting Supported */
|
||||
|
||||
/* CHLD feature masks of AG */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_REL 0x01 /* 0 Release waiting call or held calls */
|
||||
|
@ -232,7 +232,7 @@ const tBTA_HF_CLIENT_ST_TBL bta_hf_client_st_tbl[] = {
|
||||
bta_hf_client_st_closing
|
||||
};
|
||||
|
||||
const char *bta_hf_client_version = "1.6";
|
||||
const int bta_hf_client_version = HFP_HF_VERSION_1_7;
|
||||
|
||||
/* HF Client control block */
|
||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||
@ -387,7 +387,7 @@ static void bta_hf_client_api_enable(tBTA_HF_CLIENT_DATA *p_data)
|
||||
bta_hf_client_cb.p_cback = p_data->api_enable.p_cback;
|
||||
|
||||
/* check if mSBC support enabled */
|
||||
if (strcmp(bta_hf_client_version, "1.6") == 0) {
|
||||
if (bta_hf_client_version >= HFP_HF_VERSION_1_6) {
|
||||
bta_hf_client_cb.msbc_enabled = TRUE;
|
||||
} else{
|
||||
bta_hf_client_cb.msbc_enabled = FALSE;
|
||||
|
@ -18,6 +18,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
#include "bta_hf_client_int.h"
|
||||
#include "bta/bta_hf_client_api.h"
|
||||
#include "common/bt_trace.h"
|
||||
#include <string.h>
|
||||
#include "common/bt_defs.h"
|
||||
@ -34,6 +35,11 @@
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 | \
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5)
|
||||
|
||||
#define BTA_HF_CLIENT_SCO_PARAM_IDX_CVSD 0 /* SCO setting for CVSD */
|
||||
#define BTA_HF_CLIENT_ESCO_PARAM_IDX_CVSD_S3 1 /* eSCO setting for CVSD S3 */
|
||||
#define BTA_HF_CLIENT_ESCO_PARAM_IDX_MSBC_T2 2 /* eSCO setting for mSBC T2 */
|
||||
#define BTA_HF_CLIENT_ESCO_PARAM_IDX_CVSD_S4 3 /* eSCO setting for CVSD S4 */
|
||||
|
||||
static const tBTM_ESCO_PARAMS bta_hf_client_esco_params[] = {
|
||||
/* SCO CVSD */
|
||||
{
|
||||
@ -72,6 +78,19 @@ static const tBTM_ESCO_PARAMS bta_hf_client_esco_params[] = {
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
|
||||
.retrans_effort = BTM_ESCO_RETRANS_QUALITY,
|
||||
},
|
||||
/* HFP 1.7+ */
|
||||
/* ESCO CVSD S4 */
|
||||
{
|
||||
.rx_bw = BTM_64KBITS_RATE,
|
||||
.tx_bw = BTM_64KBITS_RATE,
|
||||
.max_latency = 12,
|
||||
.voice_contfmt = BTM_VOICE_SETTING_CVSD,
|
||||
/* Allow controller to use all types available except 5-slot EDR */
|
||||
.packet_types = (BTM_SCO_LINK_ALL_PKT_MASK |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
|
||||
.retrans_effort = BTM_ESCO_RETRANS_QUALITY,
|
||||
}
|
||||
};
|
||||
|
||||
@ -178,18 +197,27 @@ static void bta_hf_client_sco_conn_rsp(tBTM_ESCO_CONN_REQ_EVT_DATA *p_data)
|
||||
{
|
||||
tBTM_ESCO_PARAMS resp;
|
||||
UINT8 hci_status = HCI_SUCCESS;
|
||||
UINT8 index = BTA_HF_CLIENT_ESCO_PARAM_IDX_CVSD_S3;
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
tBTA_HFP_CODEC_INFO codec_info = {BTA_HFP_SCO_CODEC_PCM};
|
||||
UINT32 pcm_sample_rate;
|
||||
#endif
|
||||
APPL_TRACE_DEBUG("%s", __FUNCTION__);
|
||||
|
||||
APPL_TRACE_DEBUG("%s: negotiated codec = %d", __FUNCTION__, bta_hf_client_cb.scb.negotiated_codec);
|
||||
|
||||
if (bta_hf_client_cb.scb.sco_state == BTA_HF_CLIENT_SCO_LISTEN_ST) {
|
||||
if (p_data->link_type == BTM_LINK_TYPE_SCO) {
|
||||
resp = bta_hf_client_esco_params[0];
|
||||
index = BTA_HF_CLIENT_SCO_PARAM_IDX_CVSD;
|
||||
} else {
|
||||
resp = bta_hf_client_esco_params[bta_hf_client_cb.scb.negotiated_codec];
|
||||
if ((bta_hf_client_cb.scb.negotiated_codec == BTM_SCO_CODEC_CVSD) &&
|
||||
(bta_hf_client_cb.scb.features && BTA_HF_CLIENT_FEAT_ESCO_S4) &&
|
||||
(bta_hf_client_cb.scb.peer_features && BTA_HF_CLIENT_PEER_ESCO_S4)) {
|
||||
index = BTA_HF_CLIENT_ESCO_PARAM_IDX_CVSD_S4;
|
||||
} else if (bta_hf_client_cb.scb.negotiated_codec == BTM_SCO_CODEC_MSBC) {
|
||||
index = BTA_HF_CLIENT_ESCO_PARAM_IDX_MSBC_T2;
|
||||
}
|
||||
}
|
||||
resp = bta_hf_client_esco_params[index];
|
||||
|
||||
/* tell sys to stop av if any */
|
||||
bta_sys_sco_use(BTA_ID_HS, 1, bta_hf_client_cb.scb.peer_addr);
|
||||
@ -350,6 +378,7 @@ static void bta_hf_client_sco_create(BOOLEAN is_orig)
|
||||
tBTM_STATUS status;
|
||||
UINT8 *p_bd_addr = NULL;
|
||||
tBTM_ESCO_PARAMS params;
|
||||
UINT8 index = BTA_HF_CLIENT_ESCO_PARAM_IDX_CVSD_S3;
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
tBTM_SCO_ROUTE_TYPE sco_route;
|
||||
tBTA_HFP_CODEC_INFO codec_info = {BTA_HFP_SCO_CODEC_PCM};
|
||||
@ -364,7 +393,15 @@ static void bta_hf_client_sco_create(BOOLEAN is_orig)
|
||||
return;
|
||||
}
|
||||
|
||||
params = bta_hf_client_esco_params[1];
|
||||
if (bta_hf_client_cb.scb.negotiated_codec == BTM_SCO_CODEC_CVSD) {
|
||||
if ((bta_hf_client_cb.scb.features && BTA_HF_CLIENT_FEAT_ESCO_S4) &&
|
||||
(bta_hf_client_cb.scb.peer_features && BTA_HF_CLIENT_PEER_ESCO_S4)) {
|
||||
index = BTA_HF_CLIENT_ESCO_PARAM_IDX_CVSD_S4;
|
||||
}
|
||||
} else if (bta_hf_client_cb.scb.negotiated_codec == BTM_SCO_CODEC_MSBC) {
|
||||
index = BTA_HF_CLIENT_ESCO_PARAM_IDX_MSBC_T2;
|
||||
}
|
||||
params = bta_hf_client_esco_params[index];
|
||||
|
||||
/* if initiating set current scb and peer bd addr */
|
||||
if (is_orig) {
|
||||
|
@ -114,7 +114,7 @@ BOOLEAN bta_hf_client_add_record(char *p_service_name, UINT8 scn,
|
||||
|
||||
/* add profile descriptor list */
|
||||
profile_uuid = UUID_SERVCLASS_HF_HANDSFREE;
|
||||
version = HFP_VERSION_1_6;
|
||||
version = HFP_VERSION_1_7;
|
||||
|
||||
result &= SDP_AddProfileDescriptorList(sdp_handle, profile_uuid, version);
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#define HFP_VERSION_1_1 0x0101
|
||||
#define HFP_VERSION_1_5 0x0105
|
||||
#define HFP_VERSION_1_6 0x0106
|
||||
#define HFP_VERSION_1_7 0x0107
|
||||
|
||||
/* RFCOMM MTU SIZE */
|
||||
#define BTA_HF_CLIENT_MTU 256
|
||||
|
@ -33,6 +33,10 @@
|
||||
** Constants and data types
|
||||
*****************************************************************************/
|
||||
|
||||
/* Hands-Free unit(HF) version */
|
||||
#define HFP_HF_VERSION_1_6 0x0106 /* v1.6 */
|
||||
#define HFP_HF_VERSION_1_7 0x0107 /* v1.7 */
|
||||
|
||||
/* HFP peer (AG) features*/
|
||||
#define BTA_HF_CLIENT_PEER_FEAT_3WAY 0x00000001 /* Three-way calling */
|
||||
#define BTA_HF_CLIENT_PEER_FEAT_ECNR 0x00000002 /* Echo cancellation and/or noise reduction */
|
||||
@ -44,6 +48,9 @@
|
||||
#define BTA_HF_CLIENT_PEER_ECC 0x00000080 /* Enhanced Call Control */
|
||||
#define BTA_HF_CLIENT_PEER_EXTERR 0x00000100 /* Extended error codes */
|
||||
#define BTA_HF_CLIENT_PEER_CODEC 0x00000200 /* Codec Negotiation */
|
||||
/* HFP 1.7+ */
|
||||
#define BTA_HF_CLIENT_PEER_HF_IND 0x00000400 /* HF Indicators */
|
||||
#define BTA_HF_CLIENT_PEER_ESCO_S4 0x00000800 /* eSCO S4 Setting Supported */
|
||||
|
||||
typedef UINT16 tBTA_HF_CLIENT_PEER_FEAT;
|
||||
|
||||
@ -56,6 +63,8 @@ typedef UINT16 tBTA_HF_CLIENT_PEER_FEAT;
|
||||
#define BTA_HF_CLIENT_FEAT_ECS 0x00000020 /* Enhanced Call Status */
|
||||
#define BTA_HF_CLIENT_FEAT_ECC 0x00000040 /* Enhanced Call Control */
|
||||
#define BTA_HF_CLIENT_FEAT_CODEC 0x00000080 /* Codec Negotiation */
|
||||
#define BTA_HF_CLIENT_FEAT_HF_IND 0x00000100 /* HF indicators */
|
||||
#define BTA_HF_CLIENT_FEAT_ESCO_S4 0x00000200 /* eSCO S4 Setting Supported */
|
||||
|
||||
/* HFP HF extended call handling - masks not related to any spec */
|
||||
#define BTA_HF_CLIENT_CHLD_REL 0x00000001 /* 0 Release waiting call or held calls */
|
||||
|
@ -51,13 +51,13 @@
|
||||
#endif
|
||||
|
||||
#ifndef BTC_HF_CLIENT_FEATURES
|
||||
#define BTC_HF_CLIENT_FEATURES ( BTA_HF_CLIENT_FEAT_ECNR | \
|
||||
BTA_HF_CLIENT_FEAT_3WAY | \
|
||||
BTA_HF_CLIENT_FEAT_CLI | \
|
||||
BTA_HF_CLIENT_FEAT_VREC | \
|
||||
BTA_HF_CLIENT_FEAT_VOL | \
|
||||
BTA_HF_CLIENT_FEAT_ECS | \
|
||||
BTA_HF_CLIENT_FEAT_ECC | \
|
||||
#define BTC_HF_CLIENT_FEATURES ( BTA_HF_CLIENT_FEAT_ECNR | \
|
||||
BTA_HF_CLIENT_FEAT_3WAY | \
|
||||
BTA_HF_CLIENT_FEAT_CLI | \
|
||||
BTA_HF_CLIENT_FEAT_VREC | \
|
||||
BTA_HF_CLIENT_FEAT_VOL | \
|
||||
BTA_HF_CLIENT_FEAT_ECS | \
|
||||
BTA_HF_CLIENT_FEAT_ECC | \
|
||||
BTA_HF_CLIENT_FEAT_CODEC)
|
||||
#endif
|
||||
|
||||
@ -66,7 +66,7 @@
|
||||
/************************************************************************************
|
||||
** Static variables
|
||||
************************************************************************************/
|
||||
const char *btc_hf_client_version = "1.6";
|
||||
const int btc_hf_client_version = HFP_HF_VERSION_1_7;
|
||||
|
||||
#if HFP_DYNAMIC_MEMORY == FALSE
|
||||
static hf_client_local_param_t hf_client_local_param;
|
||||
@ -200,7 +200,7 @@ static bt_status_t connect_int( bt_bdaddr_t *bd_addr, uint16_t uuid )
|
||||
|
||||
bt_status_t btc_hf_client_connect( bt_bdaddr_t *bd_addr )
|
||||
{
|
||||
BTC_TRACE_EVENT("HFP Client version is %s", btc_hf_client_version);
|
||||
BTC_TRACE_EVENT("HFP Client version is 0x%04x", btc_hf_client_version);
|
||||
CHECK_HF_CLIENT_INIT();
|
||||
return btc_queue_connect(UUID_SERVCLASS_HF_HANDSFREE, bd_addr, connect_int);
|
||||
}
|
||||
@ -690,33 +690,36 @@ bt_status_t btc_hf_client_execute_service(BOOLEAN b_enable)
|
||||
{
|
||||
BTC_TRACE_EVENT("%s enable:%d", __FUNCTION__, b_enable);
|
||||
|
||||
if (b_enable)
|
||||
{
|
||||
/* Enable and register with BTA-HFClient */
|
||||
BTA_HfClientEnable(bte_hf_client_evt);
|
||||
if (strcmp(btc_hf_client_version, "1.6") == 0)
|
||||
{
|
||||
BTC_TRACE_EVENT("Support Codec Nego. %d ", BTC_HF_CLIENT_FEATURES);
|
||||
BTA_HfClientRegister(BTC_HF_CLIENT_SECURITY, BTC_HF_CLIENT_FEATURES,
|
||||
BTC_HF_CLIENT_SERVICE_NAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
BTC_TRACE_EVENT("No Codec Nego Supported");
|
||||
hf_client_local_param.btc_hf_client_features = BTC_HF_CLIENT_FEATURES;
|
||||
hf_client_local_param.btc_hf_client_features = hf_client_local_param.btc_hf_client_features & (~BTA_HF_CLIENT_FEAT_CODEC);
|
||||
BTC_TRACE_EVENT("hf_client_local_param.btc_hf_client_features is %d", hf_client_local_param.btc_hf_client_features);
|
||||
BTA_HfClientRegister(BTC_HF_CLIENT_SECURITY, hf_client_local_param.btc_hf_client_features,
|
||||
BTC_HF_CLIENT_SERVICE_NAME);
|
||||
}
|
||||
if (b_enable)
|
||||
{
|
||||
/* Enable and register with BTA-HFClient */
|
||||
BTA_HfClientEnable(bte_hf_client_evt);
|
||||
hf_client_local_param.btc_hf_client_features = BTC_HF_CLIENT_FEATURES;
|
||||
if (btc_hf_client_version >= HFP_HF_VERSION_1_7)
|
||||
{
|
||||
hf_client_local_param.btc_hf_client_features |= BTA_HF_CLIENT_FEAT_ESCO_S4;
|
||||
BTC_TRACE_EVENT("eSCO S4 Setting Supported");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
BTA_HfClientDeregister(hf_client_local_param.btc_hf_client_cb.handle);
|
||||
BTA_HfClientDisable();
|
||||
}
|
||||
return BT_STATUS_SUCCESS;
|
||||
}
|
||||
else if (btc_hf_client_version >= HFP_HF_VERSION_1_6)
|
||||
{
|
||||
BTC_TRACE_EVENT("No eSCO S4 Setting Supported");
|
||||
}
|
||||
else
|
||||
{
|
||||
BTC_TRACE_EVENT("No Codec Nego Supported");
|
||||
hf_client_local_param.btc_hf_client_features = hf_client_local_param.btc_hf_client_features & (~BTA_HF_CLIENT_FEAT_CODEC);
|
||||
}
|
||||
BTC_TRACE_EVENT("hf_client_local_param.btc_hf_client_features is %d", hf_client_local_param.btc_hf_client_features);
|
||||
BTA_HfClientRegister(BTC_HF_CLIENT_SECURITY, hf_client_local_param.btc_hf_client_features,
|
||||
BTC_HF_CLIENT_SERVICE_NAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
BTA_HfClientDeregister(hf_client_local_param.btc_hf_client_cb.handle);
|
||||
BTA_HfClientDisable();
|
||||
}
|
||||
return BT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void process_ind_evt(tBTA_HF_CLIENT_IND *ind)
|
||||
|
Loading…
Reference in New Issue
Block a user