feat(bt/bluedroid): added events to indicate the profile states of HFP

This commit is contained in:
Jin Cheng
2024-04-16 10:22:44 +08:00
committed by BOT
parent 408ae4c560
commit fdcf89ae6b
7 changed files with 124 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -63,6 +63,7 @@ typedef enum
ESP_HF_WBS_RESPONSE_EVT, /*!< Codec Status */
ESP_HF_BCS_RESPONSE_EVT, /*!< Final Codec Choice */
ESP_HF_PKT_STAT_NUMS_GET_EVT, /*!< Request number of packet different status */
ESP_HF_PROF_STATE_EVT, /*!< Indicate HF init or deinit complete */
} esp_hf_cb_event_t;
/// Dial type of ESP_HF_DIAL_EVT
@@ -223,6 +224,13 @@ typedef union
uint32_t tx_discarded; /*!< the total number of packets send lost */
} pkt_nums; /*!< AG callback param of ESP_HF_PKT_STAT_NUMS_GET_EVT */
/**
* @brief ESP_HF_PROF_STATE_EVT
*/
struct ag_prof_stat_param {
esp_hf_prof_state_t state; /*!< hf profile state param */
} prof_stat; /*!< status to indicate hf prof init or deinit */
} esp_hf_cb_param_t; /*!< HFP AG callback param compound*/
/**
@@ -284,6 +292,7 @@ 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.
* ESP_HF_PROF_STATE_EVT with ESP_HF_INIT_SUCCESS will reported to the APP layer.
*
* @return
* - ESP_OK: if the initialization request is sent successfully
@@ -297,6 +306,7 @@ 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.
* ESP_HF_PROF_STATE_EVT with ESP_HF_DEINIT_SUCCESS will reported to the APP layer.
*
* @return
* - ESP_OK: success
@@ -504,13 +514,13 @@ esp_err_t esp_hf_ag_cind_response(esp_bd_addr_t remote_addr,
/**
*
* @brief Reponse for AT+COPS command from HF Client.
* @brief Response for AT+COPS command from HF Client.
* 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] name: current operator name
* @return
* - ESP_OK: reponse for AT+COPS command is sent to lower layer
* - ESP_OK: response for AT+COPS command is sent to lower layer
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
@@ -529,7 +539,7 @@ esp_err_t esp_hf_ag_cops_response(esp_bd_addr_t remote_addr, char *name);
* @param[in] mode: current call mode (voice/data/fax)
* @param[in] mpty: single or multi type
* @param[in] number: current call number
* @param[in] type: international type or unknow
* @param[in] type: international type or unknown
* @return
* - ESP_OK: response to AT+CLCC command is sent to lower layer
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -97,6 +97,7 @@ typedef enum {
ESP_HF_CLIENT_BINP_EVT, /*!< requested number of last voice tag from AG */
ESP_HF_CLIENT_RING_IND_EVT, /*!< ring indication event */
ESP_HF_CLIENT_PKT_STAT_NUMS_GET_EVT, /*!< requested number of packet different status */
ESP_HF_CLIENT_PROF_STATE_EVT, /*!< Indicate HF CLIENT init or deinit complete */
} esp_hf_client_cb_event_t;
/// HFP client callback parameters
@@ -266,6 +267,13 @@ typedef union {
uint32_t tx_discarded; /*!< the total number of packets send lost */
} pkt_nums; /*!< HF callback param of ESP_HF_CLIENT_PKT_STAT_NUMS_GET_EVT */
/**
* @brief ESP_HF_CLIENT_PROF_STATE_EVT
*/
struct hf_client_prof_stat_param {
esp_hf_prof_state_t state; /*!< hf client profile state param */
} prof_stat; /*!< status to indicate hf client prof init or deinit */
} esp_hf_client_cb_param_t; /*!< HFP client callback parameters */
/**
@@ -323,6 +331,7 @@ esp_err_t esp_hf_client_register_callback(esp_hf_client_cb_t callback);
*
* @brief Initialize the bluetooth HFP client module.
* This function should be called after esp_bluedroid_enable() completes successfully.
* ESP_HF_CLIENT_PROF_STATE_EVT with ESP_HF_INIT_SUCCESS will reported to the APP layer.
*
* @return
* - ESP_OK: if the initialization request is sent successfully
@@ -336,6 +345,7 @@ esp_err_t esp_hf_client_init(void);
*
* @brief De-initialize for HFP client module.
* This function should be called only after esp_bluedroid_enable() completes successfully.
* ESP_HF_CLIENT_PROF_STATE_EVT with ESP_HF_DEINIT_SUCCESS will reported to the APP layer.
*
* @return
* - ESP_OK: success
@@ -422,7 +432,7 @@ esp_err_t esp_hf_client_start_voice_recognition(void);
* As a precondition to use this API, Service Level Connection shall exist with AG.
*
* @return
* - ESP_OK: stoping voice recognition is sent to lower layer
* - ESP_OK: stopping voice recognition is sent to lower layer
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -13,6 +13,16 @@
extern "C" {
#endif
/// profile states
typedef enum {
ESP_HF_INIT_SUCCESS = 0, /*!< Indicate init successful */
ESP_HF_INIT_ALREADY, /*!< Indicate init repeated */
ESP_HF_INIT_FAIL, /*!< Indicate init fail */
ESP_HF_DEINIT_SUCCESS, /*!< Indicate deinit successful */
ESP_HF_DEINIT_ALREADY, /*!< Indicate deinit repeated */
ESP_HF_DEINIT_FAIL, /*!< Indicate deinit fail */
} esp_hf_prof_state_t;
/// in-band ring tone state
typedef enum {
ESP_HF_IN_BAND_RINGTONE_NOT_PROVIDED = 0,
@@ -128,7 +138,7 @@ typedef enum {
/// +CLCC address type
typedef enum {
ESP_HF_CALL_ADDR_TYPE_UNKNOWN = 0x81, /*!< unkown address type */
ESP_HF_CALL_ADDR_TYPE_UNKNOWN = 0x81, /*!< unknown address type */
ESP_HF_CALL_ADDR_TYPE_INTERNATIONAL = 0x91, /*!< international address */
} esp_hf_call_addr_type_t;
@@ -160,7 +170,7 @@ typedef enum
ESP_HF_NREC_START
} esp_hf_nrec_t;
///+CCWA resposne status
///+CCWA response status
typedef enum {
ESP_HF_CALL_WAITING_INACTIVE,
ESP_HF_CALL_WAITING_ACTIVE,