kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'test/bqb_test_bt_classic_hfp_v4.4' into 'release/v4.4'
feat(bt/hfp): Add support for HFP BQB auto test(backport v4.4) See merge request espressif/esp-idf!26989pull/12720/head
commit
6f38dfe22b
|
@ -345,11 +345,14 @@ esp_err_t esp_bt_hf_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_bt_hf_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_hf_subscriber_service_type_t type)
|
||||
esp_err_t esp_bt_hf_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;
|
||||
|
@ -359,7 +362,8 @@ esp_err_t esp_bt_hf_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),
|
||||
|
|
|
@ -505,7 +505,7 @@ esp_err_t esp_bt_hf_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)
|
||||
|
@ -529,14 +529,18 @@ esp_err_t esp_bt_hf_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_bt_hf_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_hf_subscriber_service_type_t type);
|
||||
esp_err_t esp_bt_hf_cnum_response(esp_bd_addr_t remote_addr, char *number, int number_type, esp_hf_subscriber_service_type_t service_type);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -601,6 +605,9 @@ esp_err_t esp_bt_hf_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
|
||||
|
|
|
@ -159,7 +159,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;
|
||||
|
||||
|
|
|
@ -1522,7 +1522,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);
|
||||
|
|
|
@ -513,7 +513,7 @@ 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;
|
||||
}
|
||||
|
||||
//AT+CIND response
|
||||
|
@ -595,7 +595,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);
|
||||
|
@ -603,11 +603,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);
|
||||
|
@ -1130,7 +1130,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;
|
||||
}
|
||||
|
||||
|
@ -1479,7 +1479,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, ¶m);
|
||||
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));
|
||||
|
|
|
@ -149,7 +149,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
|
||||
|
|
|
@ -149,7 +149,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 ||
|
||||
|
|
|
@ -404,9 +404,14 @@ void bt_app_hf_cb(esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
|
|||
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_bt_hf_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_bt_hf_cnum_response(hf_peer_addr, number, number_type, service_type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue