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:
weitianhua
2020-12-15 16:08:28 +08:00
parent 7756b6e2c7
commit b4aa3269e7
8 changed files with 110 additions and 220 deletions
@@ -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