mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-06 14:14:33 +02:00
Change HF AG APIs' NamingMethod
1. Remove parameter of esp-bt_hf_init & esp_bt_hf_deinit API 2. Change API names
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
#include "osi/allocator.h"
|
||||
|
||||
#if (BTC_HF_INCLUDED == TRUE)
|
||||
esp_err_t esp_bt_hf_register_callback(esp_hf_cb_t callback)
|
||||
esp_err_t esp_hf_ag_register_callback(esp_hf_cb_t callback)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -40,7 +40,7 @@ esp_err_t esp_bt_hf_register_callback(esp_hf_cb_t callback)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_init(esp_bd_addr_t remote_addr)
|
||||
esp_err_t esp_hf_ag_init(void)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -50,16 +50,12 @@ esp_err_t esp_bt_hf_init(esp_bd_addr_t remote_addr)
|
||||
msg.pid = BTC_PID_HF;
|
||||
msg.act = BTC_HF_INIT_EVT;
|
||||
|
||||
btc_hf_args_t arg;
|
||||
memset(&arg, 0, sizeof(btc_hf_args_t));
|
||||
memcpy(&(arg.init), remote_addr, sizeof(esp_bd_addr_t));
|
||||
|
||||
/* Switch to BTC context */
|
||||
bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL);
|
||||
bt_status_t status = btc_transfer_context(&msg, NULL, sizeof(btc_hf_args_t), NULL);
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_deinit(esp_bd_addr_t remote_addr)
|
||||
esp_err_t esp_hf_ag_deinit(void)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -69,16 +65,12 @@ esp_err_t esp_bt_hf_deinit(esp_bd_addr_t remote_addr)
|
||||
msg.pid = BTC_PID_HF;
|
||||
msg.act = BTC_HF_DEINIT_EVT;
|
||||
|
||||
btc_hf_args_t arg;
|
||||
memset(&arg, 0, sizeof(btc_hf_args_t));
|
||||
memcpy(&(arg.deinit), remote_addr, sizeof(esp_bd_addr_t));
|
||||
|
||||
/* Switch to BTC context */
|
||||
bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL);
|
||||
bt_status_t status = btc_transfer_context(&msg, NULL, sizeof(btc_hf_args_t), NULL);
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_connect(esp_bd_addr_t remote_addr)
|
||||
esp_err_t esp_hf_ag_slc_connect(esp_bd_addr_t remote_addr)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -97,7 +89,7 @@ esp_err_t esp_bt_hf_connect(esp_bd_addr_t remote_addr)
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_disconnect(esp_bd_addr_t remote_addr)
|
||||
esp_err_t esp_hf_ag_slc_disconnect(esp_bd_addr_t remote_addr)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -116,7 +108,7 @@ esp_err_t esp_bt_hf_disconnect(esp_bd_addr_t remote_addr)
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_connect_audio(esp_bd_addr_t remote_addr)
|
||||
esp_err_t esp_hf_ag_audio_connect(esp_bd_addr_t remote_addr)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -135,7 +127,7 @@ esp_err_t esp_bt_hf_connect_audio(esp_bd_addr_t remote_addr)
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_disconnect_audio(esp_bd_addr_t remote_addr)
|
||||
esp_err_t esp_hf_ag_audio_disconnect(esp_bd_addr_t remote_addr)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -154,7 +146,7 @@ esp_err_t esp_bt_hf_disconnect_audio(esp_bd_addr_t remote_addr)
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_vra(esp_bd_addr_t remote_addr, esp_hf_vr_state_t value)
|
||||
esp_err_t esp_hf_ag_vra_control(esp_bd_addr_t remote_addr, esp_hf_vr_state_t value)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -174,7 +166,7 @@ esp_err_t esp_bt_hf_vra(esp_bd_addr_t remote_addr, esp_hf_vr_state_t value)
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_volume_control(esp_bd_addr_t remote_addr, esp_hf_volume_control_target_t type, int volume)
|
||||
esp_err_t esp_hf_ag_volume_control(esp_bd_addr_t remote_addr, esp_hf_volume_control_target_t type, int volume)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -195,7 +187,7 @@ esp_err_t esp_bt_hf_volume_control(esp_bd_addr_t remote_addr, esp_hf_volume_cont
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_hf_unat_response(esp_bd_addr_t remote_addr, char *unat)
|
||||
esp_err_t esp_hf_ag_unknown_at_send(esp_bd_addr_t remote_addr, char *unat)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -215,7 +207,7 @@ esp_err_t esp_hf_unat_response(esp_bd_addr_t remote_addr, char *unat)
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_cmee_response(esp_bd_addr_t remote_addr, esp_hf_at_response_code_t response_code, esp_hf_cme_err_t error_code)
|
||||
esp_err_t esp_hf_ag_cmee_send(esp_bd_addr_t remote_addr, esp_hf_at_response_code_t response_code, esp_hf_cme_err_t error_code)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -236,7 +228,7 @@ esp_err_t esp_bt_hf_cmee_response(esp_bd_addr_t remote_addr, esp_hf_at_response_
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_indchange_notification(esp_bd_addr_t remote_addr,
|
||||
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)
|
||||
@@ -262,7 +254,7 @@ esp_err_t esp_bt_hf_indchange_notification(esp_bd_addr_t remote_addr,
|
||||
return (state == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_cind_response(esp_bd_addr_t remote_addr,
|
||||
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,
|
||||
esp_hf_network_state_t ntk_state, int signal, esp_hf_roaming_status_t roam, int batt_lev,
|
||||
@@ -292,7 +284,7 @@ esp_err_t esp_bt_hf_cind_response(esp_bd_addr_t remote_addr,
|
||||
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_cops_response(esp_bd_addr_t remote_addr, char *name)
|
||||
esp_err_t esp_hf_ag_cops_response(esp_bd_addr_t remote_addr, char *name)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -312,7 +304,7 @@ esp_err_t esp_bt_hf_cops_response(esp_bd_addr_t remote_addr, char *name)
|
||||
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_clcc_response(esp_bd_addr_t remote_addr, int index, esp_hf_current_call_direction_t dir,
|
||||
esp_err_t esp_hf_ag_clcc_response(esp_bd_addr_t remote_addr, int index, esp_hf_current_call_direction_t dir,
|
||||
esp_hf_current_call_status_t current_call_state, esp_hf_current_call_mode_t mode,
|
||||
esp_hf_current_call_mpty_type_t mpty, char *number, esp_hf_call_addr_type_t type)
|
||||
{
|
||||
@@ -342,7 +334,7 @@ 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_hf_ag_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_hf_subscriber_service_type_t type)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -363,7 +355,7 @@ esp_err_t esp_bt_hf_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_h
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_bsir(esp_bd_addr_t remote_addr, esp_hf_in_band_ring_state_t state)
|
||||
esp_err_t esp_hf_ag_bsir(esp_bd_addr_t remote_addr, esp_hf_in_band_ring_state_t state)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -383,7 +375,7 @@ esp_err_t esp_bt_hf_bsir(esp_bd_addr_t remote_addr, esp_hf_in_band_ring_state_t
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_answer_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_err_t esp_hf_ag_answer_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_hf_call_status_t call_state, esp_hf_call_setup_status_t call_setup_state,
|
||||
char *number, esp_hf_call_addr_type_t call_addr_type)
|
||||
{
|
||||
@@ -410,7 +402,7 @@ esp_err_t esp_bt_hf_answer_call(esp_bd_addr_t remote_addr, int num_active, int n
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_reject_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_err_t esp_hf_ag_reject_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_hf_call_status_t call_state, esp_hf_call_setup_status_t call_setup_state,
|
||||
char *number, esp_hf_call_addr_type_t call_addr_type)
|
||||
{
|
||||
@@ -437,7 +429,7 @@ esp_err_t esp_bt_hf_reject_call(esp_bd_addr_t remote_addr, int num_active, int n
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_end_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_err_t esp_hf_ag_end_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_hf_call_status_t call_state, esp_hf_call_setup_status_t call_setup_state,
|
||||
char *number, esp_hf_call_addr_type_t call_addr_type)
|
||||
{
|
||||
@@ -464,7 +456,7 @@ esp_err_t esp_bt_hf_end_call(esp_bd_addr_t remote_addr, int num_active, int num_
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_out_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_err_t esp_hf_ag_out_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_hf_call_status_t call_state, esp_hf_call_setup_status_t call_setup_state,
|
||||
char *number, esp_hf_call_addr_type_t call_addr_type)
|
||||
{
|
||||
@@ -491,7 +483,7 @@ esp_err_t esp_bt_hf_out_call(esp_bd_addr_t remote_addr, int num_active, int num_
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_register_data_callback(esp_hf_incoming_data_cb_t recv, esp_hf_outgoing_data_cb_t send)
|
||||
esp_err_t esp_hf_ag_register_data_callback(esp_hf_incoming_data_cb_t recv, esp_hf_outgoing_data_cb_t send)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -512,7 +504,7 @@ esp_err_t esp_bt_hf_register_data_callback(esp_hf_incoming_data_cb_t recv, esp_h
|
||||
}
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
void esp_hf_outgoing_data_ready(void)
|
||||
void esp_hf_ag_outgoing_data_ready(void)
|
||||
{
|
||||
btc_hf_ci_sco_data();
|
||||
}
|
||||
|
@@ -212,42 +212,38 @@ typedef void (* esp_hf_cb_t) (esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
|
||||
* - ESP_FAIL: if callback is a NULL function pointer
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_register_callback(esp_hf_cb_t callback);
|
||||
esp_err_t esp_hf_ag_register_callback(esp_hf_cb_t callback);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Initialize the bluetooth HF AG module.
|
||||
* This function should be called after esp_bluedroid_enable() completes successfully.
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: if the initialization request is sent successfully
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_init(esp_bd_addr_t remote_addr);
|
||||
esp_err_t esp_hf_ag_init(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief De-initialize for HF AG module.
|
||||
* This function should be called only after esp_bluedroid_enable() completes successfully.
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_deinit(esp_bd_addr_t remote_addr);
|
||||
esp_err_t esp_hf_ag_deinit(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief To establish a Service Level Connection to remote bluetooth HFP client device.
|
||||
* This function must be called after esp_bt_hf_init() and before esp_bt_hf_deinit().
|
||||
* This function must be called after esp_hf_ag_init() and before esp_hf_ag_deinit().
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth HFP client device address
|
||||
*
|
||||
@@ -257,12 +253,12 @@ esp_err_t esp_bt_hf_deinit(esp_bd_addr_t remote_addr);
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_connect(esp_bd_addr_t remote_bda);
|
||||
esp_err_t esp_hf_ag_slc_connect(esp_bd_addr_t remote_bda);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Disconnect from the remote HFP client. This function must be called
|
||||
* after esp_bt_hf_init() and before esp_bt_hf_deinit().
|
||||
* after esp_hf_ag_init() and before esp_hf_ag_deinit().
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
*
|
||||
@@ -272,7 +268,7 @@ esp_err_t esp_bt_hf_connect(esp_bd_addr_t remote_bda);
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_disconnect(esp_bd_addr_t remote_bda);
|
||||
esp_err_t esp_hf_ag_slc_disconnect(esp_bd_addr_t remote_bda);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -287,7 +283,7 @@ esp_err_t esp_bt_hf_disconnect(esp_bd_addr_t remote_bda);
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_connect_audio(esp_bd_addr_t remote_bda);
|
||||
esp_err_t esp_hf_ag_audio_connect(esp_bd_addr_t remote_bda);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -302,7 +298,7 @@ esp_err_t esp_bt_hf_connect_audio(esp_bd_addr_t remote_bda);
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_disconnect_audio(esp_bd_addr_t remote_bda);
|
||||
esp_err_t esp_hf_ag_audio_disconnect(esp_bd_addr_t remote_bda);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -319,7 +315,7 @@ esp_err_t esp_bt_hf_disconnect_audio(esp_bd_addr_t remote_bda);
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_vra(esp_bd_addr_t remote_bda, esp_hf_vr_state_t value);
|
||||
esp_err_t esp_hf_ag_vra_control(esp_bd_addr_t remote_bda, esp_hf_vr_state_t value);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -338,7 +334,7 @@ esp_err_t esp_bt_hf_vra(esp_bd_addr_t remote_bda, esp_hf_vr_state_t value);
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_volume_control(esp_bd_addr_t remote_bda, esp_hf_volume_control_target_t type, int volume);
|
||||
esp_err_t esp_hf_ag_volume_control(esp_bd_addr_t remote_bda, esp_hf_volume_control_target_t type, int volume);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -355,7 +351,7 @@ esp_err_t esp_bt_hf_volume_control(esp_bd_addr_t remote_bda, esp_hf_volume_contr
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_unat_response(esp_bd_addr_t remote_addr, char *unat);
|
||||
esp_err_t esp_hf_ag_unknown_at_send(esp_bd_addr_t remote_addr, char *unat);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -371,7 +367,7 @@ esp_err_t esp_hf_unat_response(esp_bd_addr_t remote_addr, char *unat);
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_cmee_response(esp_bd_addr_t remote_bda, esp_hf_at_response_code_t response_code, esp_hf_cme_err_t error_code);
|
||||
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);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -389,7 +385,7 @@ esp_err_t esp_bt_hf_cmee_response(esp_bd_addr_t remote_bda, esp_hf_at_response_c
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_indchange_notification(esp_bd_addr_t remote_addr, esp_hf_call_status_t call_state,
|
||||
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);
|
||||
|
||||
@@ -412,7 +408,7 @@ esp_err_t esp_bt_hf_indchange_notification(esp_bd_addr_t remote_addr, esp_hf_cal
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_cind_response(esp_bd_addr_t remote_addr,
|
||||
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,
|
||||
esp_hf_network_state_t ntk_state, int signal, esp_hf_roaming_status_t roam, int batt_lev,
|
||||
@@ -431,7 +427,7 @@ esp_err_t esp_bt_hf_cind_response(esp_bd_addr_t remote_addr,
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_cops_response(esp_bd_addr_t remote_addr, char *name);
|
||||
esp_err_t esp_hf_ag_cops_response(esp_bd_addr_t remote_addr, char *name);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -452,7 +448,7 @@ esp_err_t esp_bt_hf_cops_response(esp_bd_addr_t remote_addr, char *name);
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_clcc_response(esp_bd_addr_t remote_addr, int index, esp_hf_current_call_direction_t dir,
|
||||
esp_err_t esp_hf_ag_clcc_response(esp_bd_addr_t remote_addr, int index, esp_hf_current_call_direction_t dir,
|
||||
esp_hf_current_call_status_t current_call_state, esp_hf_current_call_mode_t mode,
|
||||
esp_hf_current_call_mpty_type_t mpty, char *number, esp_hf_call_addr_type_t type);
|
||||
|
||||
@@ -470,7 +466,7 @@ esp_err_t esp_bt_hf_clcc_response(esp_bd_addr_t remote_addr, int index, esp_hf_c
|
||||
* - 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_hf_ag_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_hf_subscriber_service_type_t type);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -485,7 +481,7 @@ esp_err_t esp_bt_hf_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_h
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_bsir(esp_bd_addr_t remote_addr, esp_hf_in_band_ring_state_t state);
|
||||
esp_err_t esp_hf_ag_bsir(esp_bd_addr_t remote_addr, esp_hf_in_band_ring_state_t state);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -505,7 +501,7 @@ esp_err_t esp_bt_hf_bsir(esp_bd_addr_t remote_addr, esp_hf_in_band_ring_state_t
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_answer_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_err_t esp_hf_ag_answer_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_hf_call_status_t call_state, esp_hf_call_setup_status_t call_setup_state,
|
||||
char *number, esp_hf_call_addr_type_t call_addr_type);
|
||||
|
||||
@@ -527,7 +523,7 @@ esp_err_t esp_bt_hf_answer_call(esp_bd_addr_t remote_addr, int num_active, int n
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_reject_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_err_t esp_hf_ag_reject_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_hf_call_status_t call_state, esp_hf_call_setup_status_t call_setup_state,
|
||||
char *number, esp_hf_call_addr_type_t call_addr_type);
|
||||
|
||||
@@ -549,7 +545,7 @@ esp_err_t esp_bt_hf_reject_call(esp_bd_addr_t remote_addr, int num_active, int n
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_out_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_err_t esp_hf_ag_out_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_hf_call_status_t call_state, esp_hf_call_setup_status_t call_setup_state,
|
||||
char *number, esp_hf_call_addr_type_t call_addr_type);
|
||||
|
||||
@@ -571,7 +567,7 @@ esp_err_t esp_bt_hf_out_call(esp_bd_addr_t remote_addr, int num_active, int num_
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_end_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_err_t esp_hf_ag_end_call(esp_bd_addr_t remote_addr, int num_active, int num_held,
|
||||
esp_hf_call_status_t call_state, esp_hf_call_setup_status_t call_setup_state,
|
||||
char *number, esp_hf_call_addr_type_t call_addr_type);
|
||||
|
||||
@@ -588,7 +584,7 @@ esp_err_t esp_bt_hf_end_call(esp_bd_addr_t remote_addr, int num_active, int num_
|
||||
* - ESP_FAIL: if callback is a NULL function pointer
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_register_data_callback(esp_hf_incoming_data_cb_t recv, esp_hf_outgoing_data_cb_t send);
|
||||
esp_err_t esp_hf_ag_register_data_callback(esp_hf_incoming_data_cb_t recv, esp_hf_outgoing_data_cb_t send);
|
||||
|
||||
|
||||
/**
|
||||
@@ -599,7 +595,7 @@ esp_err_t esp_bt_hf_register_data_callback(esp_hf_incoming_data_cb_t recv, esp_h
|
||||
* After this function is called, lower layer will invoke esp_hf_client_outgoing_data_cb_t to fetch data
|
||||
*
|
||||
*/
|
||||
void esp_hf_outgoing_data_ready(void);
|
||||
void esp_hf_ag_outgoing_data_ready(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -13,33 +13,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ESP_BT_HF_NUMBER_LEN (32)
|
||||
#define ESP_BT_HF_OPERATOR_NAME_LEN (16)
|
||||
|
||||
#ifndef BTC_HSAG_SERVICE_NAME
|
||||
#define BTC_HSAG_SERVICE_NAME ("Headset Gateway")
|
||||
#endif
|
||||
|
||||
#ifndef BTC_HFAG_SERVICE_NAME
|
||||
#define BTC_HFAG_SERVICE_NAME ("Handsfree Gateway")
|
||||
#endif
|
||||
|
||||
#ifndef BTC_HF_SERVICES
|
||||
#define BTC_HF_SERVICES (BTA_HSP_SERVICE_MASK | BTA_HFP_SERVICE_MASK )
|
||||
#endif
|
||||
|
||||
#ifndef BTC_HF_SERVICE_NAMES
|
||||
#define BTC_HF_SERVICE_NAMES {BTC_HSAG_SERVICE_NAME , BTC_HFAG_SERVICE_NAME}
|
||||
#endif
|
||||
|
||||
#ifndef BTC_HF_SECURITY
|
||||
#define BTC_HF_SECURITY (BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)
|
||||
#endif
|
||||
|
||||
#define BTC_HF_CALL_END_TIMEOUT 6
|
||||
|
||||
#define BTC_HF_INVALID_IDX -1
|
||||
|
||||
/// in-band ring tone state
|
||||
typedef enum {
|
||||
ESP_HF_IN_BAND_RINGTONE_NOT_PROVIDED = 0,
|
||||
@@ -255,84 +228,6 @@ typedef enum {
|
||||
ESP_HF_CME_NETWORK_NOT_ALLOWED = 32, /*!< network not allowed --emergency calls only */
|
||||
} esp_hf_cme_err_t;
|
||||
|
||||
/** Callback for connection state change.
|
||||
* state will have one of the values from BtHfConnectionState
|
||||
*/
|
||||
typedef void (* esp_hf_connection_state_callback)(esp_hf_connection_state_t state, esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for audio connection state change.
|
||||
* state will have one of the values from BtHfAudioState
|
||||
*/
|
||||
typedef void (* esp_hf_audio_state_callback)(esp_hf_audio_state_t state, esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for VR connection state change.
|
||||
* state will have one of the values from BtHfVRState
|
||||
*/
|
||||
typedef void (* esp_hf_vr_cmd_callback)(esp_hf_vr_state_t state, esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for answer incoming call (ATA)
|
||||
*/
|
||||
typedef void (* esp_hf_answer_call_cmd_callback)(esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for disconnect call (AT+CHUP)
|
||||
*/
|
||||
typedef void (* esp_hf_hangup_call_cmd_callback)(esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for disconnect call (AT+CHUP)
|
||||
* type will denote Speaker/Mic gain (BtHfVolumeControl).
|
||||
*/
|
||||
typedef void (* esp_hf_volume_cmd_callback)(esp_hf_volume_control_target_t type, int volume, esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for dialing an outgoing call
|
||||
* If number is NULL, redial
|
||||
*/
|
||||
typedef void (* esp_hf_dial_call_cmd_callback)(char *number, esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for sending DTMF tones
|
||||
* tone contains the dtmf character to be sent
|
||||
*/
|
||||
typedef void (* esp_hf_dtmf_cmd_callback)(char tone, esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for enabling/disabling noise reduction/echo cancellation
|
||||
* value will be 1 to enable, 0 to disable
|
||||
*/
|
||||
typedef void (* esp_hf_nrec_cmd_callback)(esp_hf_nrec_t nrec, esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for AT+BCS and event from BAC
|
||||
* WBS enable, WBS disable
|
||||
*/
|
||||
typedef void (* esp_hf_wbs_callback)(esp_hf_wbs_config_t wbs, esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for call hold handling (AT+CHLD)
|
||||
* value will contain the call hold command (0, 1, 2, 3)
|
||||
*/
|
||||
typedef void (* esp_hf_chld_cmd_callback)(esp_hf_chld_type_t chld, esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for CNUM (subscriber number)
|
||||
*/
|
||||
typedef void (* esp_hf_cnum_cmd_callback)(esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for indicators (CIND)
|
||||
*/
|
||||
typedef void (* esp_hf_cind_cmd_callback)(esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for operator selection (COPS)
|
||||
*/
|
||||
typedef void (* esp_hf_cops_cmd_callback)(esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for call list (AT+CLCC)
|
||||
*/
|
||||
typedef void (* esp_hf_clcc_cmd_callback) (esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for unknown AT command recd from AG
|
||||
* at_string will contain the unparsed AT string
|
||||
*/
|
||||
typedef void (* esp_hf_unknown_at_cmd_callback)(char *at_string, esp_bd_addr_t *bd_addr);
|
||||
|
||||
/** Callback for keypressed (HSP) event.
|
||||
*/
|
||||
typedef void (* esp_hf_key_pressed_cmd_callback)(esp_bd_addr_t *bd_addr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -38,6 +38,28 @@
|
||||
/************************************************************************************
|
||||
** Constants & Macros
|
||||
************************************************************************************/
|
||||
#ifndef BTC_HSAG_SERVICE_NAME
|
||||
#define BTC_HSAG_SERVICE_NAME ("Headset Gateway")
|
||||
#endif
|
||||
|
||||
#ifndef BTC_HFAG_SERVICE_NAME
|
||||
#define BTC_HFAG_SERVICE_NAME ("Handsfree Gateway")
|
||||
#endif
|
||||
|
||||
#ifndef BTC_HF_SERVICES
|
||||
#define BTC_HF_SERVICES (BTA_HSP_SERVICE_MASK | BTA_HFP_SERVICE_MASK )
|
||||
#endif
|
||||
|
||||
#ifndef BTC_HF_SERVICE_NAMES
|
||||
#define BTC_HF_SERVICE_NAMES {BTC_HSAG_SERVICE_NAME , BTC_HFAG_SERVICE_NAME}
|
||||
#endif
|
||||
|
||||
#ifndef BTC_HF_SECURITY
|
||||
#define BTC_HF_SECURITY (BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)
|
||||
#endif
|
||||
|
||||
#define BTC_HF_INVALID_IDX -1
|
||||
|
||||
/* Max HF Clients Supported From App */
|
||||
static UINT16 btc_max_hf_clients = 1;
|
||||
/* HF Param Definition */
|
||||
@@ -114,8 +136,7 @@ BTIF_TRACE_EVENT("CHECK_HF_INIT: %s", __FUNCTION__);\
|
||||
static int btc_hf_idx_by_bdaddr(bt_bdaddr_t *bd_addr)
|
||||
{
|
||||
for (int i = 0; i < btc_max_hf_clients; ++i) {
|
||||
if ((bdcmp(bd_addr->address, hf_local_param[i].btc_hf_cb.connected_bda.address) == 0)
|
||||
|| bd_addr->address) {
|
||||
if (bdcmp(bd_addr->address, hf_local_param[i].btc_hf_cb.connected_bda.address) == 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -288,16 +309,9 @@ bt_status_t btc_hf_execute_service(BOOLEAN b_enable)
|
||||
/************************************************************************************
|
||||
** Initialization and Connection Handle
|
||||
************************************************************************************/
|
||||
bt_status_t btc_hf_init(bt_bdaddr_t *bd_addr)
|
||||
bt_status_t btc_hf_init(void)
|
||||
{
|
||||
int idx = 0;
|
||||
UNUSED(bd_addr);
|
||||
|
||||
#if HFP_DYNAMIC_MEMORY == TRUE
|
||||
if ((hf_local_param = (hf_local_param_t *)osi_malloc(sizeof(hf_local_param_t) * BTC_HF_NUM_CB)) == NULL) {
|
||||
return BT_STATUS_FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
BTC_TRACE_DEBUG("%s - max_hf_clients=%d", __func__, btc_max_hf_clients);
|
||||
/* Invoke the enable service API to the core to set the appropriate service_id
|
||||
@@ -322,10 +336,8 @@ bt_status_t btc_hf_init(bt_bdaddr_t *bd_addr)
|
||||
return BT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
void btc_hf_deinit(bt_bdaddr_t *bd_addr)
|
||||
void btc_hf_deinit(void)
|
||||
{
|
||||
UNUSED(bd_addr);
|
||||
|
||||
BTC_TRACE_EVENT("%s", __FUNCTION__);
|
||||
btc_dm_disable_service(BTA_HFP_SERVICE_ID);
|
||||
#if HFP_DYNAMIC_MEMORY == TRUE
|
||||
@@ -1064,13 +1076,13 @@ void btc_hf_call_handler(btc_msg_t *msg)
|
||||
switch (msg->act) {
|
||||
case BTC_HF_INIT_EVT:
|
||||
{
|
||||
btc_hf_init(&arg->init);
|
||||
btc_hf_init();
|
||||
break;
|
||||
}
|
||||
|
||||
case BTC_HF_DEINIT_EVT:
|
||||
{
|
||||
btc_hf_deinit(&arg->deinit);
|
||||
btc_hf_deinit();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -61,12 +61,6 @@ typedef enum
|
||||
/* btc_hf_args_t */
|
||||
typedef union
|
||||
{
|
||||
// BTC_HF_INIT_EVT
|
||||
bt_bdaddr_t init;
|
||||
|
||||
//BTC_HF_DEINIT_EVT
|
||||
bt_bdaddr_t deinit;
|
||||
|
||||
// BTC_HF_CONNECT_EVT
|
||||
bt_bdaddr_t connect;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
// if you want to connect a specific device, add it's bda here
|
||||
esp_bd_addr_t hf_peer_addr = {0xB0, 0xF1, 0xA3, 0x01, 0x2D,0x2E};
|
||||
|
||||
void hf_msg_show_usage(void)
|
||||
{
|
||||
printf("########################################################################\n");
|
||||
@@ -59,28 +60,28 @@ HF_CMD_HANDLER(help)
|
||||
HF_CMD_HANDLER(conn)
|
||||
{
|
||||
printf("Connect.\n");
|
||||
esp_bt_hf_connect(hf_peer_addr);
|
||||
esp_hf_ag_slc_connect(hf_peer_addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
HF_CMD_HANDLER(disc)
|
||||
{
|
||||
printf("Disconnect\n");
|
||||
esp_bt_hf_disconnect(hf_peer_addr);
|
||||
esp_hf_ag_slc_disconnect(hf_peer_addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
HF_CMD_HANDLER(conn_audio)
|
||||
{
|
||||
printf("Connect Audio\n");
|
||||
esp_bt_hf_connect_audio(hf_peer_addr);
|
||||
esp_hf_ag_audio_connect(hf_peer_addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
HF_CMD_HANDLER(disc_audio)
|
||||
{
|
||||
printf("Disconnect Audio\n");
|
||||
esp_bt_hf_disconnect_audio(hf_peer_addr);
|
||||
esp_hf_ag_audio_disconnect(hf_peer_addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -88,14 +89,14 @@ HF_CMD_HANDLER(disc_audio)
|
||||
HF_CMD_HANDLER(vra_on)
|
||||
{
|
||||
printf("Start Voice Recognition.\n");
|
||||
esp_bt_hf_vra(hf_peer_addr,1);
|
||||
esp_hf_ag_vra_control(hf_peer_addr,1);
|
||||
return 0;
|
||||
}
|
||||
//AT+BVRA
|
||||
HF_CMD_HANDLER(vra_off)
|
||||
{
|
||||
printf("Stop Voicer Recognition.\n");
|
||||
esp_bt_hf_vra(hf_peer_addr,0);
|
||||
esp_hf_ag_vra_control(hf_peer_addr,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -119,7 +120,7 @@ HF_CMD_HANDLER(volume_control)
|
||||
return 1;
|
||||
}
|
||||
printf("Volume Update\n");
|
||||
esp_bt_hf_volume_control(hf_peer_addr, target, volume);
|
||||
esp_hf_ag_volume_control(hf_peer_addr, target, volume);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -156,7 +157,7 @@ HF_CMD_HANDLER(ind_change)
|
||||
return 1;
|
||||
}
|
||||
printf("Device Indicator Changed!\n");
|
||||
esp_bt_hf_indchange_notification(hf_peer_addr, call_state, call_setup_state, ntk_state, signal);
|
||||
esp_hf_ag_devices_status_indchange(hf_peer_addr, call_state, call_setup_state, ntk_state, signal);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -182,7 +183,7 @@ HF_CMD_HANDLER(cme_err)
|
||||
}
|
||||
|
||||
printf("Send CME Error.\n");
|
||||
esp_bt_hf_cmee_response(hf_peer_addr,response_code,error_code);
|
||||
esp_hf_ag_cmee_send(hf_peer_addr,response_code,error_code);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -190,7 +191,7 @@ HF_CMD_HANDLER(cme_err)
|
||||
HF_CMD_HANDLER(ir_on)
|
||||
{
|
||||
printf("Enable Voicer Recognition.\n");
|
||||
esp_bt_hf_bsir(hf_peer_addr,1);
|
||||
esp_hf_ag_bsir(hf_peer_addr,1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -198,7 +199,7 @@ HF_CMD_HANDLER(ir_on)
|
||||
HF_CMD_HANDLER(ir_off)
|
||||
{
|
||||
printf("Disable Voicer Recognition.\n");
|
||||
esp_bt_hf_bsir(hf_peer_addr,0);
|
||||
esp_hf_ag_bsir(hf_peer_addr,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -207,7 +208,7 @@ HF_CMD_HANDLER(ac)
|
||||
{
|
||||
printf("Answer Call from AG.\n");
|
||||
char *number = {"123456"};
|
||||
esp_bt_hf_answer_call(hf_peer_addr,1,0,1,1,number,0);
|
||||
esp_hf_ag_answer_call(hf_peer_addr,1,0,1,1,number,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -216,7 +217,7 @@ HF_CMD_HANDLER(rc)
|
||||
{
|
||||
printf("Reject Call from AG.\n");
|
||||
char *number = {"123456"};
|
||||
esp_bt_hf_reject_call(hf_peer_addr,0,0,0,0,number,0);
|
||||
esp_hf_ag_reject_call(hf_peer_addr,0,0,0,0,number,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -225,7 +226,7 @@ HF_CMD_HANDLER(end)
|
||||
{
|
||||
printf("End Call from AG.\n");
|
||||
char *number = {"123456"};
|
||||
esp_bt_hf_end_call(hf_peer_addr,0,0,0,0,number,0);
|
||||
esp_hf_ag_end_call(hf_peer_addr,0,0,0,0,number,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -236,7 +237,7 @@ HF_CMD_HANDLER(d)
|
||||
printf("Insufficient number of arguments");
|
||||
} else {
|
||||
printf("Dial number %s\n", argv[1]);
|
||||
esp_bt_hf_out_call(hf_peer_addr,1,0,1,2,argv[1],0);
|
||||
esp_hf_ag_out_call(hf_peer_addr,1,0,1,2,argv[1],0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -243,11 +243,11 @@ static void bt_app_send_data_task(void *arg)
|
||||
|
||||
if(s_audio_code == ESP_HF_AUDIO_STATE_CONNECTED_MSBC) {
|
||||
if(item_size >= WBS_PCM_INPUT_DATA_SIZE) {
|
||||
esp_hf_outgoing_data_ready();
|
||||
esp_hf_ag_outgoing_data_ready();
|
||||
}
|
||||
} else {
|
||||
if(item_size >= PCM_INPUT_DATA_SIZE) {
|
||||
esp_hf_outgoing_data_ready();
|
||||
esp_hf_ag_outgoing_data_ready();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -321,7 +321,7 @@ void bt_app_hf_cb(esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
|
||||
s_audio_code = ESP_HF_AUDIO_STATE_CONNECTED_MSBC;
|
||||
}
|
||||
s_time_old = esp_timer_get_time();
|
||||
esp_bt_hf_register_data_callback(bt_app_hf_incoming_cb, bt_app_hf_outgoing_cb);
|
||||
esp_hf_ag_register_data_callback(bt_app_hf_incoming_cb, bt_app_hf_outgoing_cb);
|
||||
/* Begin send esco data task */
|
||||
bt_app_send_data();
|
||||
} else if (param->audio_stat.state == ESP_HF_AUDIO_STATE_DISCONNECTED) {
|
||||
@@ -347,7 +347,7 @@ void bt_app_hf_cb(esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
|
||||
case ESP_HF_UNAT_RESPONSE_EVT:
|
||||
{
|
||||
ESP_LOGI(BT_HF_TAG, "--UNKOW AT CMD: %s", param->unat_rep.unat);
|
||||
esp_hf_unat_response(hf_peer_addr, NULL);
|
||||
esp_hf_ag_unknown_at_send(hf_peer_addr, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ 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_bt_hf_indchange_notification(hf_peer_addr,call_state,call_setup_state,ntk_state,signal);
|
||||
esp_hf_ag_devices_status_indchange(hf_peer_addr,call_state,call_setup_state,ntk_state,signal);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -372,14 +372,14 @@ void bt_app_hf_cb(esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
|
||||
esp_hf_roaming_status_t roam = 0;
|
||||
int batt_lev = 3;
|
||||
esp_hf_call_held_status_t call_held_status = 0;
|
||||
esp_bt_hf_cind_response(hf_peer_addr,call_status,call_setup_status,ntk_state,signal,roam,batt_lev,call_held_status);
|
||||
esp_hf_ag_cind_response(hf_peer_addr,call_status,call_setup_status,ntk_state,signal,roam,batt_lev,call_held_status);
|
||||
break;
|
||||
}
|
||||
|
||||
case ESP_HF_COPS_RESPONSE_EVT:
|
||||
{
|
||||
const int svc_type = 1;
|
||||
esp_bt_hf_cops_response(hf_peer_addr, c_operator_name_str[svc_type]);
|
||||
esp_hf_ag_cops_response(hf_peer_addr, c_operator_name_str[svc_type]);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ void bt_app_hf_cb(esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
|
||||
esp_hf_call_addr_type_t type = ESP_HF_CALL_ADDR_TYPE_UNKNOWN;
|
||||
|
||||
ESP_LOGI(BT_HF_TAG, "--Calling Line Identification.");
|
||||
esp_bt_hf_clcc_response(hf_peer_addr, index, dir, current_call_status, mode, mpty, number, type);
|
||||
esp_hf_ag_clcc_response(hf_peer_addr, index, dir, current_call_status, mode, mpty, number, type);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ void bt_app_hf_cb(esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
|
||||
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(hf_peer_addr, number,type);
|
||||
esp_hf_ag_cnum_response(hf_peer_addr, number,type);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ void bt_app_hf_cb(esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
|
||||
{
|
||||
ESP_LOGI(BT_HF_TAG, "--Asnwer Incoming Call.");
|
||||
char *number = {"123456"};
|
||||
esp_bt_hf_answer_call(hf_peer_addr,1,0,1,0,number,0);
|
||||
esp_hf_ag_answer_call(hf_peer_addr,1,0,1,0,number,0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ void bt_app_hf_cb(esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
|
||||
{
|
||||
ESP_LOGI(BT_HF_TAG, "--Reject Incoming Call.");
|
||||
char *number = {"123456"};
|
||||
esp_bt_hf_reject_call(hf_peer_addr,0,0,0,0,number,0);
|
||||
esp_hf_ag_reject_call(hf_peer_addr,0,0,0,0,number,0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ void bt_app_hf_cb(esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
|
||||
if (param->out_call.num_or_loc) {
|
||||
//dia_num_or_mem
|
||||
ESP_LOGI(BT_HF_TAG, "--Dial \"%s\".", param->out_call.num_or_loc);
|
||||
esp_bt_hf_out_call(hf_peer_addr,1,0,1,0,param->out_call.num_or_loc,0);
|
||||
esp_hf_ag_out_call(hf_peer_addr,1,0,1,0,param->out_call.num_or_loc,0);
|
||||
} else {
|
||||
//dia_last
|
||||
ESP_LOGI(BT_HF_TAG, "--Dial last number.");
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "esp_console.h"
|
||||
#include "app_hf_msg_set.h"
|
||||
|
||||
#define BT_HF_AG_TAG "HF_AG_DEMO_MAIN"
|
||||
#define BT_HF_AG_TAG "HF_AG_DEMO_MAIN"
|
||||
|
||||
/* event for handler "hf_ag_hdl_stack_up */
|
||||
enum {
|
||||
@@ -44,10 +44,10 @@ static void bt_hf_hdl_stack_evt(uint16_t event, void *p_param)
|
||||
char *dev_name = "ESP_HFP_AG";
|
||||
esp_bt_dev_set_device_name(dev_name);
|
||||
|
||||
esp_bt_hf_register_callback(bt_app_hf_cb);
|
||||
esp_hf_ag_register_callback(bt_app_hf_cb);
|
||||
|
||||
// init and register for HFP_AG functions
|
||||
esp_bt_hf_init(hf_peer_addr);
|
||||
esp_hf_ag_init();
|
||||
|
||||
/*
|
||||
* Set default parameters for Legacy Pairing
|
||||
|
Reference in New Issue
Block a user