feat(bt): Add API to get profile status

This commit is contained in:
xiongweichao
2025-02-08 16:14:23 +08:00
parent 60d077eadd
commit 3721a43afc
39 changed files with 598 additions and 50 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -111,6 +111,15 @@ typedef enum {
ESP_A2D_SET_INVALID_PARAMS /*!< A2DP profile set delay report value is invalid parameter */
} esp_a2d_set_delay_value_state_t;
/**
* @brief A2DP profile status parameters
*/
typedef struct {
bool a2d_snk_inited; /*!< A2DP sink initialization */
bool a2d_src_inited; /*!< A2DP source initialization */
uint8_t conn_num; /*!< Number of connections */
} esp_a2d_profile_status_t;
/**
* @brief A2DP callback events
*/
@@ -376,6 +385,18 @@ esp_err_t esp_a2d_sink_get_delay_value(void);
esp_err_t esp_a2d_media_ctrl(esp_a2d_media_ctrl_t ctrl);
/**
* @brief This function is used to get the status of A2DP
*
* @param[out] profile_status - A2DP status
*
* @return
* - ESP_OK: success
* - other: failed
*/
esp_err_t esp_a2d_get_profile_status(esp_a2d_profile_status_t *profile_status);
/**
*
* @brief Initialize the bluetooth A2DP source module. A2DP can work independently.
@@ -409,7 +430,7 @@ esp_err_t esp_a2d_source_deinit(void);
/**
* @brief Register A2DP source data input function. For now, the input shoule be PCM data stream.
* @brief Register A2DP source data input function. For now, the input should be PCM data stream.
* This function should be called only after esp_bluedroid_enable() completes
* successfully. The callback is invoked in the context of A2DP source task whose
* stack size is configurable through menuconfig.

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -313,6 +313,14 @@ typedef enum {
#define ESP_BT_GAP_TPOLL_DFT (0x0028) /*!< Default poll interval, unit is 625 microseconds */
#define ESP_BT_GAP_TPOLL_MAX (0x1000) /*!< Maximum poll interval, unit is 625 microseconds */
/** GAP status */
typedef struct {
esp_bt_gap_discovery_state_t disc_stat; /*!< Device Discovery state */
esp_bt_connection_mode_t conn_mode; /*!< Connection mode */
esp_bt_discovery_mode_t disc_mode; /*!< Discovery mode */
uint8_t bredr_acl_link_num; /*!< Number of bredr link connections */
} esp_bt_gap_profile_status_t;
/// GAP state callback parameters
typedef union {
/**
@@ -983,6 +991,17 @@ esp_err_t esp_bt_gap_set_device_name(const char *name);
*/
esp_err_t esp_bt_gap_get_device_name(void);
/**
* @brief Get the status of GAP
*
* @param[out] profile_status - GAP status
*
* @return
* - ESP_OK : success
* - other : failed
*/
esp_err_t esp_bt_gap_get_profile_status(esp_bt_gap_profile_status_t *profile_status);
#ifdef __cplusplus
}
#endif

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -74,6 +74,13 @@ typedef enum
ESP_HF_DIAL_MEM, /*!< Dial with a memory position */
} esp_hf_dial_type_t;
/// HFP AG profile status parameters
typedef struct {
bool hfp_ag_inited; /*!< hfp ag initialization */
uint8_t conn_num; /*!< Number of connections */
} esp_hf_profile_status_t;
/// HFP AG callback parameters
typedef union
{
@@ -719,6 +726,17 @@ esp_err_t esp_hf_ag_pkt_stat_nums_get(uint16_t sync_conn_handle);
*/
void esp_hf_ag_outgoing_data_ready(void);
/**
* @brief This function is used to get the status of hfp ag
*
* @param[out] profile_status - hfp ag status
*
* @return
* - ESP_OK: success
* - other: failed
*/
esp_err_t esp_hf_ag_get_profile_status(esp_hf_profile_status_t *profile_status);
#ifdef __cplusplus
}
#endif

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -42,6 +42,14 @@ typedef enum {
ESP_HF_CLIENT_IN_BAND_RINGTONE_PROVIDED,
} esp_hf_client_in_band_ring_state_t;
/**
* @brief HF client profile status parameters
*/
typedef struct {
bool hf_client_inited; /*!< hf client initialization */
uint8_t conn_num; /*!< Number of connections */
} esp_hf_client_profile_status_t;
/* features masks of AG */
#define ESP_HF_CLIENT_PEER_FEAT_3WAY 0x01 /* Three-way calling */
#define ESP_HF_CLIENT_PEER_FEAT_ECNR 0x02 /* Echo cancellation and/or noise reduction */
@@ -738,6 +746,17 @@ void esp_hf_client_pcm_resample_deinit(void);
*/
int32_t esp_hf_client_pcm_resample(void *src, uint32_t in_bytes, void *dst);
/**
* @brief This function is used to get the status of hf client
*
* @param[out] profile_status - hf client status
*
* @return
* - ESP_OK: success
* - other: failed
*/
esp_err_t esp_hf_client_get_profile_status(esp_hf_client_profile_status_t *profile_status);
#ifdef __cplusplus
}
#endif

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -145,6 +145,14 @@ typedef enum {
ESP_HIDD_NO_CONNECTION, /*!< connection may have been closed */
} esp_hidd_status_t;
/**
* @brief HID device profile status parameters
*/
typedef struct {
bool hidd_inited; /*!< HID device initialization */
uint8_t conn_num; /*!< Number of connections */
} esp_hidd_profile_status_t;
/**
* @brief HID device callback parameters union
*/
@@ -406,6 +414,17 @@ esp_err_t esp_bt_hid_device_report_error(esp_hidd_handshake_error_t error);
*/
esp_err_t esp_bt_hid_device_virtual_cable_unplug(void);
/**
* @brief This function is used to get the status of hid device
*
* @param[out] profile_status - HID device status
*
* @return
* - ESP_OK: success
* - other: failed
*/
esp_err_t esp_bt_hid_device_get_profile_status(esp_hidd_profile_status_t *profile_status);
#ifdef __cplusplus
}
#endif

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -104,7 +104,7 @@ typedef enum {
typedef enum {
ESP_HIDH_DEV_ATTR_VIRTUAL_CABLE = 0x0001, /*!< whether Virtual Cables is supported */
ESP_HIDH_DEV_ATTR_NORMALLY_CONNECTABLE = 0x0002, /*!< whether device is in Page Scan mode when there is no active connection */
ESP_HIDH_DEV_ATTR_RECONNECT_INITIATE = 0x0004, /*!< whether the HID device inititates the reconnection process */
ESP_HIDH_DEV_ATTR_RECONNECT_INITIATE = 0x0004, /*!< whether the HID device initiates the reconnection process */
} esp_hidh_dev_attr_t;
/**
@@ -128,11 +128,19 @@ typedef struct {
int vendor_id; /*!< Device ID information: vendor ID */
int product_id; /*!< Device ID information: product ID */
int version; /*!< Device ID information: version */
uint8_t ctry_code; /*!< SDP attrbutes of HID devices: HID country code (https://www.usb.org/sites/default/files/hid1_11.pdf) */
int dl_len; /*!< SDP attrbutes of HID devices: HID device descriptor length */
uint8_t dsc_list[BTHH_MAX_DSC_LEN]; /*!< SDP attrbutes of HID devices: HID device descriptor definition */
uint8_t ctry_code; /*!< SDP attributes of HID devices: HID country code (https://www.usb.org/sites/default/files/hid1_11.pdf) */
int dl_len; /*!< SDP attributes of HID devices: HID device descriptor length */
uint8_t dsc_list[BTHH_MAX_DSC_LEN]; /*!< SDP attributes of HID devices: HID device descriptor definition */
} esp_hidh_hid_info_t;
/**
* @brief HID host profile status parameters
*/
typedef struct {
bool hidh_inited; /*!< HID host initialization */
uint8_t conn_num; /*!< Number of connections */
} esp_hidh_profile_status_t;
/**
* @brief HID host callback parameters union
*/
@@ -157,7 +165,7 @@ typedef union {
struct hidh_open_evt_param {
esp_hidh_status_t status; /*!< operation status */
esp_hidh_connection_state_t conn_status; /*!< connection status */
bool is_orig; /*!< indicate if host intiate the connection */
bool is_orig; /*!< indicate if host initiate the connection */
uint8_t handle; /*!< device handle */
esp_bd_addr_t bd_addr; /*!< device address */
} open; /*!< HIDH callback param of ESP_HIDH_OPEN_EVT */
@@ -475,6 +483,17 @@ esp_err_t esp_bt_hid_host_set_report(esp_bd_addr_t bd_addr, esp_hidh_report_type
*/
esp_err_t esp_bt_hid_host_send_data(esp_bd_addr_t bd_addr, uint8_t *data, size_t len);
/**
* @brief This function is used to get the status of hid host
*
* @param[out] profile_status - HID host status
*
* @return
* - ESP_OK: success
* - other: failed
*/
esp_err_t esp_bt_hid_host_get_profile_status(esp_hidh_profile_status_t *profile_status);
#ifdef __cplusplus
}
#endif

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -40,6 +40,14 @@ typedef enum {
#define ESP_BT_L2CAP_SEC_ENCRYPT 0x0024 /*!< Encryption required */
typedef uint32_t esp_bt_l2cap_cntl_flags_t;
/**
* @brief L2CAP status parameters
*/
typedef struct {
bool l2cap_inited; /*!< l2cap initialization */
uint8_t conn_num; /*!< Number of connections */
} esp_bt_l2cap_protocol_status_t;
/**
* @brief L2CAP callback function events
*/
@@ -244,6 +252,17 @@ esp_err_t esp_bt_l2cap_vfs_register(void);
*/
esp_err_t esp_bt_l2cap_vfs_unregister(void);
/**
* @brief This function is used to get the status of L2CAP
*
* @param[out] status - l2cap status
*
* @return
* - ESP_OK: success
* - other: failed
*/
esp_err_t esp_bt_l2cap_get_protocol_status(esp_bt_l2cap_protocol_status_t *status);
#ifdef __cplusplus
}
#endif

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -37,6 +37,14 @@ typedef enum {
ESP_SDP_NO_CREATE_RECORD, /*!< No record created */
} esp_sdp_status_t;
/**
* @brief SDP protocol status parameters
*/
typedef struct {
bool sdp_inited; /*!< SDP initialization */
uint8_t records_num; /*!< Number of created records */
} esp_sdp_protocol_status_t;
/**
* @brief SDP callback function events
*/
@@ -271,6 +279,17 @@ esp_err_t esp_sdp_create_record(esp_bluetooth_sdp_record_t *record);
*/
esp_err_t esp_sdp_remove_record(int record_handle);
/**
* @brief This function is used to get the status of SDP
*
* @param[out] status - sdp status
*
* @return
* - ESP_OK: success
* - other: failed
*/
esp_err_t esp_sdp_get_protocol_status(esp_sdp_protocol_status_t *status);
#ifdef __cplusplus
}
#endif

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -102,6 +102,13 @@ typedef enum {
ESP_SPP_VFS_UNREGISTER_EVT = 37, /*!< When SPP VFS unregister, the event comes */
} esp_spp_cb_event_t;
/**
* @brief SPP profile status parameters
*/
typedef struct {
bool spp_inited; /*!< spp initialization */
uint8_t conn_num; /*!< Number of connections */
} esp_spp_profile_status_t;
/**
* @brief SPP callback parameters union
@@ -432,6 +439,17 @@ esp_err_t esp_spp_vfs_register(void);
*/
esp_err_t esp_spp_vfs_unregister(void);
/**
* @brief This function is used to get the status of SPP
*
* @param[out] profile_status - SPP status
*
* @return
* - ESP_OK: success
* - other: failed
*/
esp_err_t esp_spp_get_profile_status(esp_spp_profile_status_t *profile_status);
#ifdef __cplusplus
}
#endif