mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03: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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user