Merge branch 'test/bqb_test_bt_classic_hfp_v5.0' into 'release/v5.0'

feat(bt/hfp): Add support for HFP BQB auto test (backport v5.0)

See merge request espressif/esp-idf!26223
This commit is contained in:
Jiang Jiang Jian 2023-10-07 14:28:28 +08:00
commit 64639bb296
14 changed files with 321 additions and 61 deletions

View File

@ -255,6 +255,27 @@ esp_err_t esp_hf_ag_devices_status_indchange(esp_bd_addr_t remote_addr,
return (state == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
}
esp_err_t esp_hf_ag_ciev_report(esp_bd_addr_t remote_addr, esp_hf_ciev_report_type_t ind_type, int value)
{
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
btc_msg_t msg;
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_HF;
msg.act = BTC_HF_CIEV_REPORT_EVT;
btc_hf_args_t arg;
memset(&arg, 0, sizeof(btc_hf_args_t));
memcpy(&(arg.ciev_rep.remote_addr), remote_addr, sizeof(esp_bd_addr_t));
arg.ciev_rep.ind.type = ind_type;
arg.ciev_rep.ind.value = value;
/* Switch to BTC context */
bt_status_t state = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL, NULL);
return (state == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
}
esp_err_t esp_hf_ag_cind_response(esp_bd_addr_t remote_addr,
esp_hf_call_status_t call_state,
esp_hf_call_setup_status_t call_setup_state,
@ -337,11 +358,14 @@ esp_err_t esp_hf_ag_clcc_response(esp_bd_addr_t remote_addr, int index, esp_hf_c
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
}
esp_err_t esp_hf_ag_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_hf_subscriber_service_type_t type)
esp_err_t esp_hf_ag_cnum_response(esp_bd_addr_t remote_addr, char *number, int number_type, esp_hf_subscriber_service_type_t service_type)
{
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if (number == NULL) {
return ESP_ERR_INVALID_ARG;
}
btc_msg_t msg;
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_HF;
@ -351,7 +375,8 @@ esp_err_t esp_hf_ag_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_h
memset(&arg, 0, sizeof(btc_hf_args_t));
memcpy(&(arg.cnum_rep), remote_addr, sizeof(esp_bd_addr_t));
arg.cnum_rep.number = number; //deep_copy
arg.cnum_rep.type = type;
arg.cnum_rep.number_type = number_type;
arg.cnum_rep.service_type = service_type;
/* Switch to BTC context */
bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t),

View File

@ -402,7 +402,7 @@ esp_err_t esp_hf_ag_vra_control(esp_bd_addr_t remote_bda, esp_hf_vr_state_t valu
*/
esp_err_t esp_hf_ag_volume_control(esp_bd_addr_t remote_bda, esp_hf_volume_control_target_t type, int volume);
/**
/**
*
* @brief Handle Unknown AT command from HFP Client.
* As a precondition to use this API, Service Level Connection shall exist with HFP client.
@ -419,7 +419,7 @@ esp_err_t esp_hf_ag_volume_control(esp_bd_addr_t remote_bda, esp_hf_volume_contr
*/
esp_err_t esp_hf_ag_unknown_at_send(esp_bd_addr_t remote_addr, char *unat);
/**
/**
*
* @brief Unsolicited send extend AT error code to HFP Client.
* As a precondition to use this API, Service Level Connection shall exist with HFP client.
@ -435,7 +435,7 @@ esp_err_t esp_hf_ag_unknown_at_send(esp_bd_addr_t remote_addr, char *unat);
*/
esp_err_t esp_hf_ag_cmee_send(esp_bd_addr_t remote_bda, esp_hf_at_response_code_t response_code, esp_hf_cme_err_t error_code);
/**
/**
*
* @brief Unsolicited send device status notification to HFP Client.
* As a precondition to use this API, Service Level Connection shall exist with HFP client.
@ -452,10 +452,29 @@ esp_err_t esp_hf_ag_cmee_send(esp_bd_addr_t remote_bda, esp_hf_at_response_code_
*
*/
esp_err_t esp_hf_ag_devices_status_indchange(esp_bd_addr_t remote_addr, esp_hf_call_status_t call_state,
esp_hf_call_setup_status_t call_setup_state,
esp_hf_network_state_t ntk_state, int signal);
esp_hf_call_setup_status_t call_setup_state,
esp_hf_network_state_t ntk_state, int signal) __attribute__((
deprecated("Please use esp_hf_ag_ciev_report")
));
/**
/**
*
* @brief Send indicator report "+CIEV: <ind> <value>" to HFP Client. "CIEV" means indicator events reporting",
* and all indicator types can be sent one type at a time.
* As a precondition to use this API, Service Level Connection shall exist with HFP client.
*
* @param[in] remote_addr: remote bluetooth device address
* @param[in] ind_type: indicator type
* @param[in] value: indicator value
* @return
* - ESP_OK: disconnect request is sent to lower layer
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
esp_err_t esp_hf_ag_ciev_report(esp_bd_addr_t remote_addr, esp_hf_ciev_report_type_t ind_type, int value);
/**
*
* @brief Response to device individual indicators to HFP Client.
* As a precondition to use this API, Service Level Connection shall exist with HFP client.
@ -501,7 +520,7 @@ esp_err_t esp_hf_ag_cops_response(esp_bd_addr_t remote_addr, char *name);
* As a precondition to use this API, Service Level Connection shall exist with HFP client.
*
* @param[in] remote_addr: remote bluetooth device address
* @param[in] index: the index of current call
* @param[in] index: the index of current call, starting with 1, finishing response with 0 (send OK)
* @param[in] dir: call direction (incoming/outgoing)
* @param[in] current_call_state: current call state
* @param[in] mode: current call mode (voice/data/fax)
@ -525,14 +544,18 @@ esp_err_t esp_hf_ag_clcc_response(esp_bd_addr_t remote_addr, int index, esp_hf_c
*
* @param[in] remote_addr: remote bluetooth device address
* @param[in] number: registration number
* @param[in] type: service type (unknown/voice/fax)
* @param[in] number_type: value of number type from
* 128-143: national or international, may contain prefix and/or escape digits
* 144-159: international, includes country code prefix, add "+" if needed
* 160-175: national, but no prefix nor escape digits
* @param[in] service_type: service type (unknown/voice/fax)
* @return
* - ESP_OK: disconnect request is sent to lower layer
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
esp_err_t esp_hf_ag_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_hf_subscriber_service_type_t type);
esp_err_t esp_hf_ag_cnum_response(esp_bd_addr_t remote_addr, char *number, int number_type, esp_hf_subscriber_service_type_t service_type);
/**
*
@ -597,6 +620,9 @@ esp_err_t esp_hf_ag_reject_call(esp_bd_addr_t remote_addr, int num_active, int n
*
* @brief Initiate a call from AG.
* As a precondition to use this API, Service Level Connection shall exist with HFP client.
* If the AG is driven by the HF to call esp_hf_ag_out_call, it needs to response an OK or ERROR
* to HF. But if the AG is actively calling esp_hf_ag_out_call, it does not need to take a response
* to HF.
*
* @param[in] remote_addr: remote bluetooth device address
* @param[in] num_active: the number of active call

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -51,6 +51,17 @@ typedef enum
ESP_HF_NETWORK_STATE_AVAILABLE
} esp_hf_network_state_t;
/// +CIEV report type
typedef enum {
ESP_HF_IND_TYPE_CALL = 1, /*!< position of call indicator */
ESP_HF_IND_TYPE_CALLSETUP, /*!< position of callsetup indicator */
ESP_HF_IND_TYPE_SERVICE, /*!< position of service indicator */
ESP_HF_IND_TYPE_SIGNAL, /*!< position of signal strength indicator, range: 0-5 */
ESP_HF_IND_TYPE_ROAM, /*!< position of roaming indicator */
ESP_HF_IND_TYPE_BATTCHG, /*!< position of battery charge indicator, range: 0-5 */
ESP_HF_IND_TYPE_CALLHELD /*!< position of callheld indicator */
} esp_hf_ciev_report_type_t;
/** +CIEV Service type */
typedef enum
{
@ -60,7 +71,7 @@ typedef enum
/// +CIND call status indicator values
typedef enum {
ESP_HF_CALL_STATUS_NO_CALLS = 0, /*!< no call in progress */
ESP_HF_CALL_STATUS_NO_CALLS = 0, /*!< no call in progress */
ESP_HF_CALL_STATUS_CALL_IN_PROGRESS = 1, /*!< call is present(active or held) */
} esp_hf_call_status_t;
@ -124,7 +135,7 @@ typedef enum {
/// +CNUM service type of the phone number
typedef enum {
ESP_HF_SUBSCRIBER_SERVICE_TYPE_UNKNOWN = 0, /*!< unknown */
ESP_HF_SUBSCRIBER_SERVICE_TYPE_VOICE, /*!< voice service */
ESP_HF_SUBSCRIBER_SERVICE_TYPE_VOICE = 4, /*!< voice service */
ESP_HF_SUBSCRIBER_SERVICE_TYPE_FAX, /*!< fax service */
} esp_hf_subscriber_service_type_t;

View File

@ -36,6 +36,9 @@
#include "stack/port_api.h"
#include "bta/utl.h"
#if BT_HF_AG_BQB_INCLUDED
static BOOLEAN s_bta_hf_ag_bqb_brsf_flag = false;
#endif /* BT_HF_AG_BQB_INCLUDED */
#if (BTA_AG_INCLUDED == TRUE)
/*****************************************************************************
@ -338,6 +341,22 @@ const UINT8 bta_ag_callsetup_ind_tbl[] =
#define COLON_IDX_4_VGSVGM 4
#endif
/*******************************************************************************
**
** Function bta_hf_ag_bqb_brsf_ctrl
**
** Description Control the usage of BTA_AG_BQB_BRSF_FEAT_SPEC for BQB test
**
** Returns void
**
*******************************************************************************/
#if BT_HF_AG_BQB_INCLUDED
void bta_hf_ag_bqb_brsf_ctrl(BOOLEAN enable)
{
s_bta_hf_ag_bqb_brsf_flag = enable;
}
#endif /* BT_HF_AG_BQB_INCLUDED */
/*******************************************
* Funcitons Result
********************************************/
@ -1025,7 +1044,15 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
/* store peer features */
p_scb->peer_features = (UINT16) int_arg;
/* send BRSF, send OK */
bta_ag_send_result(p_scb, BTA_AG_RES_BRSF, NULL, (INT16) (p_scb->features & BTA_AG_BSRF_FEAT_SPEC));
#if BT_HF_AG_BQB_INCLUDED
if (s_bta_hf_ag_bqb_brsf_flag == true) {
bta_ag_send_result(p_scb, BTA_AG_RES_BRSF, NULL, (INT16) (p_scb->features & BTA_AG_BQB_BRSF_FEAT_SPEC));
} else {
bta_ag_send_result(p_scb, BTA_AG_RES_BRSF, NULL, (INT16) (p_scb->features & BTA_AG_BRSF_FEAT_SPEC));
}
#else
bta_ag_send_result(p_scb, BTA_AG_RES_BRSF, NULL, (INT16) (p_scb->features & BTA_AG_BRSF_FEAT_SPEC));
#endif /* BT_HF_AG_BQB_INCLUDED */
bta_ag_send_ok(p_scb);
break;
}
@ -1522,7 +1549,6 @@ void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
if (p_result->data.ok_flag != BTA_AG_OK_ERROR) {
if (p_result->data.str[0] != 0) {
bta_ag_send_result(p_scb, code, p_result->data.str, 0);
bta_ag_send_ok(p_scb);
}
if (p_result->data.ok_flag == BTA_AG_OK_DONE) {
bta_ag_send_ok(p_scb);

View File

@ -76,16 +76,24 @@
#define BTA_AG_ACP 0 /* accepted connection */
#define BTA_AG_INT 1 /* initiating connection */
/* feature mask that matches spec */
#define BTA_AG_BSRF_FEAT_SPEC (BTA_AG_FEAT_3WAY | BTA_AG_FEAT_ECNR | \
BTA_AG_FEAT_VREC | BTA_AG_FEAT_INBAND | \
BTA_AG_FEAT_VTAG | BTA_AG_FEAT_REJECT | \
BTA_AG_FEAT_ECS | BTA_AG_FEAT_ECC | \
BTA_AG_FEAT_EXTERR | BTA_AG_FEAT_CODEC | \
BTA_AG_FEAT_ESCO_S4| BTA_AG_FEAT_VOIP)
#if BT_HF_AG_BQB_INCLUDED
/* feature mask that matches spec for BQB test */
#define BTA_AG_BQB_BRSF_FEAT_SPEC (BTA_AG_FEAT_VOIP | \
BTA_AG_FEAT_VTAG | BTA_AG_FEAT_CODEC | \
BTA_AG_FEAT_ECS | BTA_AG_FEAT_ECC | \
BTA_AG_FEAT_ESCO_S4 | BTA_AG_FEAT_EXTERR)
#endif /* BT_HF_AG_BQB_INCLUDED */
#define BTA_AG_SDP_FEAT_SPEC (BTA_AG_FEAT_3WAY | BTA_AG_FEAT_ECNR | \
BTA_AG_FEAT_VREC | BTA_AG_FEAT_INBAND | \
/* feature mask that matches spec */
#define BTA_AG_BRSF_FEAT_SPEC (BTA_AG_FEAT_3WAY | BTA_AG_FEAT_ECNR | \
BTA_AG_FEAT_VREC | BTA_AG_FEAT_INBAND | \
BTA_AG_FEAT_VTAG | BTA_AG_FEAT_REJECT | \
BTA_AG_FEAT_ECS | BTA_AG_FEAT_ECC | \
BTA_AG_FEAT_EXTERR | BTA_AG_FEAT_CODEC | \
BTA_AG_FEAT_ESCO_S4 | BTA_AG_FEAT_VOIP)
#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_VTAG)
enum

View File

@ -25,6 +25,10 @@
#include "bta/bta_hf_client_api.h"
#include "bta_hf_client_int.h"
#if BT_HF_CLIENT_BQB_INCLUDED
static BOOLEAN s_bta_hf_client_bqb_clip_flag = TRUE;
#endif /* BT_HF_CLIENT_BQB_INCLUDED */
#if (BTA_HF_INCLUDED == TRUE)
/* uncomment to enable extra debug */
/* #define BTA_HF_CLIENT_DEBUG TRUE */
@ -247,6 +251,21 @@ tBTA_HF_CLIENT_CB bta_hf_client_cb;
tBTA_HF_CLIENT_CB *bta_hf_client_cb_ptr;
#endif
/*******************************************************************************
**
** Function bta_hf_client_bqb_clip_ctrl
**
** Description Control if send the command AT+CLIP for BQB test
**
** Returns void
**
*******************************************************************************/
#if BT_HF_CLIENT_BQB_INCLUDED
void bta_hf_client_bqb_clip_ctrl(BOOLEAN enable)
{
s_bta_hf_client_bqb_clip_flag = enable;
}
#endif /* BT_HF_CLIENT_BQB_INCLUDED */
/*******************************************************************************
**
@ -538,7 +557,14 @@ static void send_post_slc_cmd(void)
bta_hf_client_send_at_cmee(TRUE);
bta_hf_client_send_at_cops(FALSE);
bta_hf_client_send_at_btrh(TRUE, 0);
#if BT_HF_CLIENT_BQB_INCLUDED
if (s_bta_hf_client_bqb_clip_flag == TRUE) {
bta_hf_client_send_at_clip(TRUE);
}
#else
bta_hf_client_send_at_clip(TRUE);
#endif /* BT_HF_CLIENT_BQB_INCLUDED */
}
/*******************************************************************************

View File

@ -29,6 +29,10 @@
#include "hci/hci_audio.h"
#endif
#if BT_HF_CLIENT_BQB_INCLUDED
static BOOLEAN s_bta_hf_client_bqb_esco_s1_flag = false;
#endif /* BT_HF_CLIENT_BQB_INCLUDED */
#if (BTA_HF_INCLUDED == TRUE)
#define BTA_HF_CLIENT_NO_EDR_ESCO (BTM_SCO_PKT_TYPES_MASK_NO_2_EV3 | \
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 | \
@ -39,6 +43,7 @@
#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 */
#define BTA_HF_CLIENT_ESCO_PARAM_IDX_CVSD_S1 4 /* eSCO setting for CVSD S1 */
static const tBTM_ESCO_PARAMS bta_hf_client_esco_params[] = {
/* SCO CVSD */
@ -91,7 +96,23 @@ static const tBTM_ESCO_PARAMS bta_hf_client_esco_params[] = {
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
.retrans_effort = BTM_ESCO_RETRANS_QUALITY,
},
/* ESCO CVSD S1 */
#if BT_HF_CLIENT_BQB_INCLUDED
{
.rx_bw = BTM_64KBITS_RATE,
.tx_bw = BTM_64KBITS_RATE,
.max_latency = 7,
.voice_contfmt = BTM_VOICE_SETTING_CVSD,
/* Packet Types : EV3 */
.packet_types = (HCI_ESCO_PKT_TYPES_MASK_EV3 |
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
BTM_SCO_PKT_TYPES_MASK_NO_2_EV3 |
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
.retrans_effort = BTM_ESCO_RETRANS_POWER,
}
#endif /* BT_HF_CLIENT_BQB_INCLUDED */
};
enum {
@ -106,6 +127,22 @@ enum {
#endif /* #if (BTM_SCO_HCI_INCLUDED == TRUE ) */
};
/*******************************************************************************
**
** Function bta_hf_client_bqb_esco_s1_ctrl
**
** Description Control the usage of CVSD eSCO S1 parameter for BQB test
**
** Returns void
**
*******************************************************************************/
#if BT_HF_CLIENT_BQB_INCLUDED
void bta_hf_client_bqb_esco_s1_ctrl(BOOLEAN enable)
{
s_bta_hf_client_bqb_esco_s1_flag = enable;
}
#endif /* BT_HF_CLIENT_BQB_INCLUDED */
static void bta_hf_client_sco_event(UINT8 event);
/*******************************************************************************
**
@ -214,6 +251,11 @@ static void bta_hf_client_sco_conn_rsp(tBTM_ESCO_CONN_REQ_EVT_DATA *p_data)
(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;
#if BT_HF_CLIENT_BQB_INCLUDED
if (s_bta_hf_client_bqb_esco_s1_flag == true) {
index = BTA_HF_CLIENT_ESCO_PARAM_IDX_CVSD_S1;
}
#endif /* BT_HF_CLIENT_BQB_INCLUDED */
} else if (bta_hf_client_cb.scb.negotiated_codec == BTM_SCO_CODEC_MSBC) {
index = BTA_HF_CLIENT_ESCO_PARAM_IDX_MSBC_T2;
}

View File

@ -71,26 +71,36 @@ static hf_local_param_t *hf_local_param;
#if (BTM_WBS_INCLUDED == TRUE)
#ifndef BTC_HF_FEATURES
#define BTC_HF_FEATURES ( BTA_AG_FEAT_ECNR | \
BTA_AG_FEAT_REJECT | \
BTA_AG_FEAT_ECS | \
BTA_AG_FEAT_EXTERR | \
BTA_AG_FEAT_VREC | \
BTA_AG_FEAT_INBAND | \
BTA_AG_FEAT_CODEC | \
BTA_AG_FEAT_ESCO_S4| \
BTA_AG_FEAT_UNAT)
#define BTC_HF_FEATURES ( BTA_AG_FEAT_ECNR | \
BTA_AG_FEAT_REJECT | \
BTA_AG_FEAT_ECS | \
BTA_AG_FEAT_EXTERR | \
BTA_AG_FEAT_VREC | \
BTA_AG_FEAT_INBAND | \
BTA_AG_FEAT_CODEC | \
BTA_AG_FEAT_ESCO_S4 | \
BTA_AG_FEAT_UNAT )
#endif
#else
#ifndef BTC_HF_FEATURES
#define BTC_HF_FEATURES ( BTA_AG_FEAT_ECNR | \
BTA_AG_FEAT_REJECT | \
BTA_AG_FEAT_ECS | \
BTA_AG_FEAT_EXTERR | \
BTA_AG_FEAT_VREC | \
BTA_AG_FEAT_INBAND | \
BTA_AG_FEAT_ESCO_S4| \
BTA_AG_FEAT_UNAT)
#if BT_HF_AG_BQB_INCLUDED
#define BTC_HF_FEATURES ( BTA_AG_FEAT_REJECT | \
BTA_AG_FEAT_ECS | \
BTA_AG_FEAT_EXTERR | \
BTA_AG_FEAT_VREC | \
BTA_AG_FEAT_INBAND | \
BTA_AG_FEAT_ESCO_S4 | \
BTA_AG_FEAT_UNAT )
#else
#define BTC_HF_FEATURES ( BTA_AG_FEAT_ECNR | \
BTA_AG_FEAT_REJECT | \
BTA_AG_FEAT_ECS | \
BTA_AG_FEAT_EXTERR | \
BTA_AG_FEAT_VREC | \
BTA_AG_FEAT_INBAND | \
BTA_AG_FEAT_ESCO_S4 | \
BTA_AG_FEAT_UNAT )
#endif /* BT_HF_AG_BQB_INCLUDED */
#endif
#endif
@ -525,7 +535,20 @@ static bt_status_t btc_hf_indchange_notification(bt_bdaddr_t *bd_addr,
send_indicator_update(BTA_AG_IND_SIGNAL, signal);
return BT_STATUS_SUCCESS;
}
return BT_STATUS_SUCCESS;
return BT_STATUS_FAIL;
}
// +CIEV<...> for device status update, send other indicators, e.g. roaming, battery, call held and bearer
bt_status_t btc_hf_ciev_report(bt_bdaddr_t *bd_addr, tBTA_AG_IND_TYPE indicator, uint16_t value)
{
int idx = btc_hf_idx_by_bdaddr(bd_addr);
CHECK_HF_INIT(idx);
if (is_connected(idx, bd_addr)) {
send_indicator_update(indicator, value);
return BT_STATUS_SUCCESS;
}
return BT_STATUS_FAIL;
}
//AT+CIND response
@ -607,7 +630,7 @@ static bt_status_t btc_hf_clcc_response(bt_bdaddr_t *bd_addr, int index, esp_hf_
}
//AT+CNUM
static bt_status_t btc_hf_cnum_response(bt_bdaddr_t *bd_addr, const char *number, esp_hf_subscriber_service_type_t type)
static bt_status_t btc_hf_cnum_response(bt_bdaddr_t *bd_addr, const char *number, int number_type, esp_hf_subscriber_service_type_t service_type)
{
int idx = btc_hf_idx_by_bdaddr(bd_addr);
CHECK_HF_SLC_CONNECTED(idx);
@ -615,11 +638,11 @@ static bt_status_t btc_hf_cnum_response(bt_bdaddr_t *bd_addr, const char *number
if (is_connected(idx, bd_addr)) {
tBTA_AG_RES_DATA ag_res;
memset(&ag_res, 0, sizeof (ag_res));
BTC_TRACE_EVENT("cnum_response: number = %s, type = %d", number, type);
if (number) {
sprintf(ag_res.str, ",\"%s\",%d",number, type);
BTC_TRACE_EVENT("cnum_response: number = %s, number type = %d, service type = %d", number, number_type, service_type);
if (service_type) {
sprintf(ag_res.str, ",\"%s\",%d,,%d",number, number_type, service_type);
} else {
sprintf(ag_res.str, ",\"\",%d",type);
sprintf(ag_res.str, ",\"%s\",%d,,",number, number_type);
}
ag_res.ok_flag = BTA_AG_OK_DONE;
BTA_AgResult(hf_local_param[idx].btc_hf_cb.handle, BTA_AG_CNUM_RES, &ag_res);
@ -1117,6 +1140,12 @@ void btc_hf_call_handler(btc_msg_t *msg)
break;
}
case BTC_HF_CIEV_REPORT_EVT:
{
btc_hf_ciev_report(&arg->ciev_rep.remote_addr, arg->ciev_rep.ind.type, arg->ciev_rep.ind.value);
break;
}
case BTC_HF_CIND_RESPONSE_EVT:
{
btc_hf_cind_response(&arg->cind_rep.remote_addr,
@ -1142,7 +1171,7 @@ void btc_hf_call_handler(btc_msg_t *msg)
case BTC_HF_CNUM_RESPONSE_EVT:
{
btc_hf_cnum_response(&arg->cnum_rep.remote_addr, arg->cnum_rep.number, arg->cnum_rep.type);
btc_hf_cnum_response(&arg->cnum_rep.remote_addr, arg->cnum_rep.number, arg->cnum_rep.number_type, arg->cnum_rep.service_type);
break;
}
@ -1491,7 +1520,6 @@ void btc_hf_cb_handler(btc_msg_t *msg)
param.out_call.num_or_loc = osi_malloc((strlen(p_data->val.str) + 1) * sizeof(char));
sprintf(param.out_call.num_or_loc, p_data->val.str);
btc_hf_cb_to_app(ESP_HF_DIAL_EVT, &param);
send_indicator_update(BTA_AG_IND_CALLSETUP,BTA_AG_CALLSETUP_OUTGOING);
osi_free(param.out_call.num_or_loc);
} else if (event == BTA_AG_AT_BLDN_EVT) { //dial_last
memcpy(param.out_call.remote_addr, &hf_local_param[idx].btc_hf_cb.connected_bda,sizeof(esp_bd_addr_t));

View File

@ -28,6 +28,10 @@
#include "esp_bt.h"
#include <assert.h>
#if BT_HF_CLIENT_BQB_INCLUDED
static BOOLEAN s_bta_hf_client_bqb_esco_s4_flag = false;
#endif /* BT_HF_CLIENT_BQB_INCLUDED */
#if (BTC_HF_CLIENT_INCLUDED == TRUE)
/************************************************************************************
@ -54,6 +58,21 @@
#endif
/*******************************************************************************
**
** Function bta_hf_client_bqb_esco_s4_ctrl
**
** Description Control the usage of BTA_HF_CLIENT_FEAT_ESCO_S4 for BQB test
**
** Returns void
**
*******************************************************************************/
#if BT_HF_CLIENT_BQB_INCLUDED
void bta_hf_client_bqb_esco_s4_ctrl(BOOLEAN enable)
{
s_bta_hf_client_bqb_esco_s4_flag = enable;
}
#endif /* BT_HF_CLIENT_BQB_INCLUDED */
/************************************************************************************
** Static variables
@ -743,6 +762,11 @@ bt_status_t btc_hf_client_execute_service(BOOLEAN b_enable)
if (btc_hf_client_version >= HFP_HF_VERSION_1_7)
{
hf_client_local_param.btc_hf_client_features |= BTA_HF_CLIENT_FEAT_ESCO_S4;
#if BT_HF_CLIENT_BQB_INCLUDED
if (s_bta_hf_client_bqb_esco_s4_flag == true) {
hf_client_local_param.btc_hf_client_features = BTA_HF_CLIENT_FEAT_ESCO_S4;
}
#endif /* BT_HF_CLIENT_BQB_INCLUDED */
BTC_TRACE_EVENT("eSCO S4 Setting Supported");
}

View File

@ -44,6 +44,7 @@ typedef enum
BTC_HF_UNAT_RESPONSE_EVT,
BTC_HF_CME_ERR_EVT,
BTC_HF_IND_NOTIFICATION_EVT,
BTC_HF_CIEV_REPORT_EVT,
BTC_HF_CIND_RESPONSE_EVT,
BTC_HF_COPS_RESPONSE_EVT,
BTC_HF_CLCC_RESPONSE_EVT,
@ -109,6 +110,12 @@ typedef union
int signal;
} ind_change;
//BTC_HF_CIEV_REPORT_EVT
struct ciev_args {
bt_bdaddr_t remote_addr;
tBTA_AG_IND ind;
} ciev_rep;
//BTC_HF_CIND_RESPONSE_EVT
struct cind_args {
bt_bdaddr_t remote_addr;
@ -143,7 +150,8 @@ typedef union
struct cnum_args {
bt_bdaddr_t remote_addr;
char *number;
esp_hf_subscriber_service_type_t type;
int number_type;
esp_hf_subscriber_service_type_t service_type;
} cnum_rep;
//BTC_HF_NREC_RESPONSE_EVT

View File

@ -1993,6 +1993,24 @@
#define PAN_NAP_SECURITY_LEVEL 0
#endif
/******************************************************************************
**
** HFP
**
******************************************************************************/
#if (BTC_HF_INCLUDED == TRUE) && (BT_CLASSIC_BQB_INCLUDED == TRUE)
#define BT_HF_AG_BQB_INCLUDED TRUE
#else
#define BT_HF_AG_BQB_INCLUDED FALSE
#endif
#if (BTC_HF_CLIENT_INCLUDED == TRUE) && (BT_CLASSIC_BQB_INCLUDED == TRUE)
#define BT_HF_CLIENT_BQB_INCLUDED TRUE
#else
#define BT_HF_CLIENT_BQB_INCLUDED FALSE
#endif
/******************************************************************************
**
** GAP

View File

@ -1033,7 +1033,7 @@ void btm_sco_connected (UINT8 hci_status, BD_ADDR bda, UINT16 hci_handle,
#endif
btm_cb.sco_cb.sco_disc_reason = hci_status;
BTM_TRACE_ERROR("%s, handle %x", __FUNCTION__, hci_handle);
BTM_TRACE_API("%s, handle %x", __FUNCTION__, hci_handle);
#if (BTM_MAX_SCO_LINKS>0)
for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) {
if (((p->state == SCO_ST_CONNECTING) ||

View File

@ -148,7 +148,7 @@ HF_CMD_HANDLER(ind_change)
if (sscanf(argv[3], "%d", &ntk_state) != 1 ||
(ntk_state != ESP_HF_NETWORK_STATE_NOT_AVAILABLE &&
ntk_state != ESP_HF_NETWORK_STATE_AVAILABLE)) {
printf("Invalid argument for netwrok state %s\n", argv[3]);
printf("Invalid argument for network state %s\n", argv[3]);
return 1;
}
if (sscanf(argv[4], "%d", &signal) != 1 ||
@ -157,7 +157,10 @@ HF_CMD_HANDLER(ind_change)
return 1;
}
printf("Device Indicator Changed!\n");
esp_hf_ag_devices_status_indchange(hf_peer_addr, call_state, call_setup_state, ntk_state, signal);
esp_hf_ag_ciev_report(hf_peer_addr, ESP_HF_IND_TYPE_CALL, call_state);
esp_hf_ag_ciev_report(hf_peer_addr, ESP_HF_IND_TYPE_CALLSETUP, call_setup_state);
esp_hf_ag_ciev_report(hf_peer_addr, ESP_HF_IND_TYPE_SERVICE, ntk_state);
esp_hf_ag_ciev_report(hf_peer_addr, ESP_HF_IND_TYPE_SIGNAL, signal);
return 0;
}

View File

@ -85,9 +85,9 @@ const char *c_volume_control_target_str[] = {
// esp_hf_subscriber_service_type_t
char *c_operator_name_str[] = {
"中国移动",
"中国联通",
"中国电信",
"China Mobile",
"China Unicom",
"China Telecom",
};
// esp_hf_subscriber_service_type_t
@ -360,7 +360,12 @@ void bt_app_hf_cb(esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
esp_hf_call_setup_status_t call_setup_state = 2;
esp_hf_network_state_t ntk_state = 1;
int signal = 2;
esp_hf_ag_devices_status_indchange(param->ind_upd.remote_addr,call_state,call_setup_state,ntk_state,signal);
int battery = 3;
esp_hf_ag_ciev_report(param->ind_upd.remote_addr, ESP_HF_IND_TYPE_CALL, call_state);
esp_hf_ag_ciev_report(param->ind_upd.remote_addr, ESP_HF_IND_TYPE_CALLSETUP, call_setup_state);
esp_hf_ag_ciev_report(param->ind_upd.remote_addr, ESP_HF_IND_TYPE_SERVICE, ntk_state);
esp_hf_ag_ciev_report(param->ind_upd.remote_addr, ESP_HF_IND_TYPE_SIGNAL, signal);
esp_hf_ag_ciev_report(param->ind_upd.remote_addr, ESP_HF_IND_TYPE_BATTCHG, battery);
break;
}
@ -399,15 +404,25 @@ void bt_app_hf_cb(esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
ESP_LOGI(BT_HF_TAG, "--Calling Line Identification.");
esp_hf_ag_clcc_response(param->clcc_rep.remote_addr, index, dir, current_call_status, mode, mpty, number, type);
//AG shall always send ok response to HF
//index = 0 means response ok
index = 0;
esp_hf_ag_clcc_response(param->clcc_rep.remote_addr, index, dir, current_call_status, mode, mpty, number, type);
break;
}
case ESP_HF_CNUM_RESPONSE_EVT:
{
char *number = {"123456"};
esp_hf_subscriber_service_type_t type = 1;
ESP_LOGI(BT_HF_TAG, "--Current Number is %s ,Type is %s.", number, c_subscriber_service_type_str[type]);
esp_hf_ag_cnum_response(param->cnum_rep.remote_addr, number,type);
int number_type = 129;
esp_hf_subscriber_service_type_t service_type = ESP_HF_SUBSCRIBER_SERVICE_TYPE_VOICE;
if (service_type == ESP_HF_SUBSCRIBER_SERVICE_TYPE_VOICE || service_type == ESP_HF_SUBSCRIBER_SERVICE_TYPE_FAX) {
ESP_LOGI(BT_HF_TAG, "--Current Number is %s, Number Type is %d, Service Type is %s.", number, number_type, c_subscriber_service_type_str[service_type - 3]);
} else {
ESP_LOGI(BT_HF_TAG, "--Current Number is %s, Number Type is %d, Service Type is %s.", number, number_type, c_subscriber_service_type_str[0]);
}
esp_hf_ag_cnum_response(hf_peer_addr, number, number_type, service_type);
break;
}