mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-29 18:27:20 +02:00
feat(bt): Add API to get profile status
This commit is contained in:
@ -522,6 +522,9 @@ bt_status_t btc_init(void)
|
||||
return BT_STATUS_NOMEM;
|
||||
}
|
||||
#endif
|
||||
#if BTC_GAP_BT_INCLUDED
|
||||
btc_gap_bt_init();
|
||||
#endif
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
btc_gap_callback_init();
|
||||
@ -534,6 +537,9 @@ bt_status_t btc_init(void)
|
||||
|
||||
void btc_deinit(void)
|
||||
{
|
||||
#if BTC_GAP_BT_INCLUDED
|
||||
btc_gap_bt_deinit();
|
||||
#endif
|
||||
#if BTC_DYNAMIC_MEMORY
|
||||
btc_deinit_mem();
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -229,6 +229,21 @@ esp_err_t esp_a2d_media_ctrl(esp_a2d_media_ctrl_t ctrl)
|
||||
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_a2d_get_profile_status(esp_a2d_profile_status_t *profile_status)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if (profile_status == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
memset(profile_status, 0, sizeof(esp_a2d_profile_status_t));
|
||||
btc_a2dp_get_profile_status(profile_status);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if BTC_AV_SRC_INCLUDED
|
||||
esp_err_t esp_a2d_source_init(void)
|
||||
{
|
||||
|
@ -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
|
||||
*/
|
||||
@ -554,4 +554,20 @@ esp_err_t esp_bt_gap_get_device_name(void)
|
||||
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_gap_get_profile_status(esp_bt_gap_profile_status_t *profile_status)
|
||||
{
|
||||
if (profile_status == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
memset(profile_status, 0, sizeof(esp_bt_gap_profile_status_t));
|
||||
btc_gap_bt_status_get(profile_status);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#endif /* #if BTC_GAP_BT_INCLUDED == TRUE */
|
||||
|
@ -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
|
||||
*/
|
||||
@ -548,6 +548,21 @@ esp_err_t esp_hf_ag_register_data_callback(esp_hf_incoming_data_cb_t recv, esp_h
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_hf_ag_get_profile_status(esp_hf_profile_status_t *profile_status)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if (profile_status == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
memset(profile_status, 0, sizeof(esp_hf_profile_status_t));
|
||||
btc_hf_get_profile_status(profile_status);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
esp_err_t esp_hf_ag_pkt_stat_nums_get(uint16_t sync_conn_handle)
|
||||
{
|
||||
|
@ -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
|
||||
*/
|
||||
@ -515,6 +515,21 @@ esp_err_t esp_hf_client_register_data_callback(esp_hf_client_incoming_data_cb_t
|
||||
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_hf_client_get_profile_status(esp_hf_client_profile_status_t *profile_status)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if (profile_status == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
memset(profile_status, 0, sizeof(esp_hf_client_profile_status_t));
|
||||
btc_hf_client_get_profile_status(profile_status);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
esp_err_t esp_hf_client_pkt_stat_nums_get(uint16_t sync_conn_handle)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@ -167,4 +167,17 @@ esp_err_t esp_bt_hid_device_virtual_cable_unplug(void)
|
||||
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hid_device_get_profile_status(esp_hidd_profile_status_t *profile_status)
|
||||
{
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
if (profile_status == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
memset(profile_status, 0, sizeof(esp_hidd_profile_status_t));
|
||||
btc_hd_get_profile_status(profile_status);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#endif /* defined BTC_HD_INCLUDED && BTC_HD_INCLUDED == TRUE */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@ -247,4 +247,17 @@ esp_err_t esp_bt_hid_host_send_data(esp_bd_addr_t bd_addr, uint8_t *data, size_t
|
||||
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hid_host_get_profile_status(esp_hidh_profile_status_t *profile_status)
|
||||
{
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
if (profile_status == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
memset(profile_status, 0, sizeof(esp_hidh_profile_status_t));
|
||||
btc_hh_get_profile_status(profile_status);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#endif /* defined BTC_HH_INCLUDED && BTC_HH_INCLUDED == TRUE */
|
||||
|
@ -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
|
||||
*/
|
||||
@ -128,4 +128,17 @@ esp_err_t esp_bt_l2cap_vfs_unregister(void)
|
||||
return btc_l2cap_vfs_unregister();
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_l2cap_get_protocol_status(esp_bt_l2cap_protocol_status_t *status)
|
||||
{
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
if (status == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
memset(status, 0, sizeof(esp_bt_l2cap_protocol_status_t));
|
||||
btc_l2cap_get_protocol_status(status);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#endif ///defined BTC_L2CAP_INCLUDED && BTC_L2CAP_INCLUDED == TRUE
|
||||
|
@ -164,4 +164,17 @@ esp_err_t esp_sdp_remove_record(int record_handle)
|
||||
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_sdp_get_protocol_status(esp_sdp_protocol_status_t *status)
|
||||
{
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
if (status == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
memset(status, 0, sizeof(esp_sdp_protocol_status_t));
|
||||
btc_sdp_get_protocol_status(status);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#endif ///defined BTC_SDP_INCLUDED && BTC_SDP_INCLUDED == TRUE
|
||||
|
@ -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
|
||||
*/
|
||||
@ -252,4 +252,17 @@ esp_err_t esp_spp_vfs_unregister(void)
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_spp_get_profile_status(esp_spp_profile_status_t *profile_status)
|
||||
{
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
if (profile_status == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
memset(profile_status, 0, sizeof(esp_spp_profile_status_t));
|
||||
btc_spp_get_profile_status(profile_status);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#endif ///defined BTC_SPP_INCLUDED && BTC_SPP_INCLUDED == TRUE
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
*/
|
||||
@ -718,10 +718,9 @@ bt_status_t btc_dm_disable_service(tBTA_SERVICE_ID service_id)
|
||||
|
||||
return BT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#if (BTC_GAP_BT_INCLUDED == TRUE)
|
||||
static void btc_dm_acl_link_stat(tBTA_DM_ACL_LINK_STAT *p_acl_link_stat)
|
||||
{
|
||||
#if (BTC_GAP_BT_INCLUDED == TRUE)
|
||||
esp_bt_gap_cb_param_t param;
|
||||
esp_bt_gap_cb_event_t event = ESP_BT_GAP_EVT_MAX;
|
||||
bt_bdaddr_t bt_addr;
|
||||
@ -763,8 +762,8 @@ static void btc_dm_acl_link_stat(tBTA_DM_ACL_LINK_STAT *p_acl_link_stat)
|
||||
if (cb) {
|
||||
cb(event, ¶m);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void btc_dm_sec_cb_handler(btc_msg_t *msg)
|
||||
{
|
||||
@ -851,7 +850,10 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
|
||||
break;
|
||||
#endif /* BTM_OOB_INCLUDED == TRUE */
|
||||
case BTA_DM_ACL_LINK_STAT_EVT: {
|
||||
#if (BTC_GAP_BT_INCLUDED == TRUE)
|
||||
btc_gap_bt_acl_link_num_update(&p_data->acl_link_stat);
|
||||
btc_dm_acl_link_stat(&p_data->acl_link_stat);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case BTA_DM_DEV_UNPAIRED_EVT: {
|
||||
|
@ -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
|
||||
*/
|
||||
@ -34,7 +34,7 @@
|
||||
|
||||
#if BTC_AV_INCLUDED
|
||||
|
||||
// global variable to inidcate avrc is initialized with a2dp
|
||||
// global variable to indicate avrc is initialized with a2dp
|
||||
bool g_av_with_rc;
|
||||
// global variable to indicate a2dp is initialized
|
||||
bool g_a2dp_on_init;
|
||||
@ -1355,7 +1355,7 @@ static void bte_av_media_callback(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data)
|
||||
/* send a command to BT Media Task */
|
||||
btc_a2dp_sink_reset_decoder((UINT8 *)p_data);
|
||||
|
||||
/* currently only supportes SBC */
|
||||
/* currently only supports SBC */
|
||||
a2d_status = A2D_ParsSbcInfo(&sbc_cie, (UINT8 *)p_data, FALSE);
|
||||
if (a2d_status == A2D_SUCCESS) {
|
||||
btc_msg_t msg;
|
||||
@ -1632,6 +1632,35 @@ void btc_a2dp_cb_handler(btc_msg_t *msg)
|
||||
btc_av_event_free_data(msg);
|
||||
}
|
||||
|
||||
void btc_a2dp_get_profile_status(esp_a2d_profile_status_t *param)
|
||||
{
|
||||
// Not initialized by default
|
||||
param->a2d_snk_inited = false;
|
||||
param->a2d_src_inited = false;
|
||||
|
||||
#if A2D_DYNAMIC_MEMORY == TRUE
|
||||
if (btc_av_cb_ptr)
|
||||
#endif
|
||||
{
|
||||
if (btc_av_cb.sm_handle) {
|
||||
if (btc_av_cb.service_id == BTA_A2DP_SINK_SERVICE_ID) {
|
||||
param->a2d_src_inited = false;
|
||||
param->a2d_snk_inited = true;
|
||||
} else if (btc_av_cb.service_id == BTA_A2DP_SOURCE_SERVICE_ID) {
|
||||
param->a2d_src_inited = true;
|
||||
param->a2d_snk_inited = false;
|
||||
} else {
|
||||
param->a2d_snk_inited = false;
|
||||
param->a2d_src_inited = false;
|
||||
return;
|
||||
}
|
||||
if (btc_av_is_connected()) {
|
||||
param->conn_num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if BTC_AV_SINK_INCLUDED
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -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
|
||||
*/
|
||||
@ -24,14 +24,27 @@
|
||||
#define BTC_STORAGE_FILL_PROPERTY(p_prop, t, l, p_v) \
|
||||
(p_prop)->type = t;(p_prop)->len = l; (p_prop)->val = (p_v);
|
||||
|
||||
typedef struct {
|
||||
esp_bt_gap_discovery_state_t disc_stat;
|
||||
esp_bt_connection_mode_t conn_mode;
|
||||
esp_bt_discovery_mode_t disc_mode;
|
||||
uint8_t bredr_acl_link_num;
|
||||
uint16_t handle[MAX_ACL_CONNECTIONS];
|
||||
} gap_bt_local_param_t;
|
||||
|
||||
#if BTC_GAP_BT_DYNAMIC_MEMORY == FALSE
|
||||
static gap_bt_local_param_t gap_bt_local_param;
|
||||
#else
|
||||
static gap_bt_local_param_t *gap_bt_local_param_ptr;
|
||||
#define gap_bt_local_param (*gap_bt_local_param_ptr)
|
||||
#endif
|
||||
|
||||
static void bte_search_devices_evt(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data);
|
||||
static void bte_dm_search_services_evt(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data);
|
||||
static void bte_dm_remote_service_record_evt(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data);
|
||||
static void search_services_copy_cb(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
static void search_service_record_copy_cb(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
|
||||
static bool btc_gap_bt_inquiry_in_progress = false;
|
||||
|
||||
static inline void btc_gap_bt_cb_to_app(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
||||
{
|
||||
esp_bt_gap_cb_t cb = (esp_bt_gap_cb_t)btc_profile_cb_get(BTC_PID_GAP_BT);
|
||||
@ -45,6 +58,9 @@ static void btc_bt_set_scan_mode(esp_bt_connection_mode_t c_mode, esp_bt_discove
|
||||
tBTA_DM_DISC disc_mode;
|
||||
tBTA_DM_CONN conn_mode;
|
||||
|
||||
gap_bt_local_param.conn_mode = c_mode;
|
||||
gap_bt_local_param.disc_mode = d_mode;
|
||||
|
||||
switch (c_mode) {
|
||||
case ESP_BT_NON_CONNECTABLE:
|
||||
conn_mode = BTA_DM_NON_CONN;
|
||||
@ -93,7 +109,7 @@ static void btc_gap_bt_start_discovery(btc_gap_bt_args_t *arg)
|
||||
/* TODO: Filter device by BDA needs to be implemented here */
|
||||
|
||||
/* Will be enabled to TRUE once inquiry busy level has been received */
|
||||
btc_gap_bt_inquiry_in_progress = FALSE;
|
||||
gap_bt_local_param.disc_stat = ESP_BT_GAP_DISCOVERY_STOPPED;
|
||||
/* find nearby devices */
|
||||
BTA_DmSearch(&inq_params, services, bte_search_devices_evt);
|
||||
|
||||
@ -374,7 +390,7 @@ static void btc_gap_bt_search_devices_evt(tBTA_DM_SEARCH_PARAM *p_data)
|
||||
* if inquiry is in progress, then we don't want to act on this cancel_cmpl_evt
|
||||
* but instead wait for the cancel_cmpl_evt_via the busy level
|
||||
*/
|
||||
if (btc_gap_bt_inquiry_in_progress == false) {
|
||||
if (gap_bt_local_param.disc_stat == ESP_BT_GAP_DISCOVERY_STOPPED) {
|
||||
esp_bt_gap_cb_param_t param;
|
||||
param.disc_st_chg.state = ESP_BT_GAP_DISCOVERY_STOPPED;
|
||||
btc_gap_bt_cb_to_app(ESP_BT_GAP_DISC_STATE_CHANGED_EVT, ¶m);
|
||||
@ -1158,15 +1174,15 @@ void btc_gap_bt_busy_level_updated(uint8_t bl_flags)
|
||||
if (bl_flags == BTM_BL_INQUIRY_STARTED) {
|
||||
param.disc_st_chg.state = ESP_BT_GAP_DISCOVERY_STARTED;
|
||||
btc_gap_bt_cb_to_app(ESP_BT_GAP_DISC_STATE_CHANGED_EVT, ¶m);
|
||||
btc_gap_bt_inquiry_in_progress = true;
|
||||
gap_bt_local_param.disc_stat = ESP_BT_GAP_DISCOVERY_STARTED;
|
||||
} else if (bl_flags == BTM_BL_INQUIRY_CANCELLED) {
|
||||
param.disc_st_chg.state = ESP_BT_GAP_DISCOVERY_STOPPED;
|
||||
btc_gap_bt_cb_to_app(ESP_BT_GAP_DISC_STATE_CHANGED_EVT, ¶m);
|
||||
btc_gap_bt_inquiry_in_progress = false;
|
||||
gap_bt_local_param.disc_stat = ESP_BT_GAP_DISCOVERY_STOPPED;
|
||||
} else if (bl_flags == BTM_BL_INQUIRY_COMPLETE) {
|
||||
/* The Inquiry Complete event is not transported to app layer,
|
||||
since the app only cares about the Name Discovery Complete event */
|
||||
btc_gap_bt_inquiry_in_progress = false;
|
||||
gap_bt_local_param.disc_stat = ESP_BT_GAP_DISCOVERY_STOPPED;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1307,4 +1323,76 @@ void btc_gap_bt_cb_handler(btc_msg_t *msg)
|
||||
}
|
||||
btc_gap_bt_cb_deep_free(msg);
|
||||
}
|
||||
|
||||
void btc_gap_bt_init(void)
|
||||
{
|
||||
#if BTC_GAP_BT_DYNAMIC_MEMORY == TRUE
|
||||
if ((gap_bt_local_param_ptr = (gap_bt_local_param_t *)osi_malloc(sizeof(gap_bt_local_param_t))) == NULL) {
|
||||
BTC_TRACE_ERROR("%s malloc failed\n", __func__);
|
||||
return;
|
||||
}
|
||||
memset((void *)gap_bt_local_param_ptr, 0, sizeof(gap_bt_local_param_t));
|
||||
#else
|
||||
memset(&gap_bt_local_param, 0, sizeof(gap_bt_local_param_t));
|
||||
#endif
|
||||
}
|
||||
|
||||
void btc_gap_bt_deinit(void)
|
||||
{
|
||||
#if BTC_GAP_BT_DYNAMIC_MEMORY == TRUE
|
||||
if (gap_bt_local_param_ptr) {
|
||||
osi_free(gap_bt_local_param_ptr);
|
||||
gap_bt_local_param_ptr = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void btc_gap_bt_acl_link_handle_store(uint16_t handle)
|
||||
{
|
||||
for (int i = 0; i < MAX_ACL_CONNECTIONS; i++) {
|
||||
if (gap_bt_local_param.handle[i] == 0) {
|
||||
gap_bt_local_param.handle[i] = handle;
|
||||
gap_bt_local_param.bredr_acl_link_num++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (gap_bt_local_param.bredr_acl_link_num > MAX_ACL_CONNECTIONS) {
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void btc_gap_bt_acl_link_handle_remove(uint16_t handle)
|
||||
{
|
||||
for (int i = 0; i < MAX_ACL_CONNECTIONS; i++) {
|
||||
if (gap_bt_local_param.handle[i] == handle) {
|
||||
gap_bt_local_param.handle[i] = 0;
|
||||
gap_bt_local_param.bredr_acl_link_num--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (gap_bt_local_param.bredr_acl_link_num > MAX_ACL_CONNECTIONS) {
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
void btc_gap_bt_acl_link_num_update(tBTA_DM_ACL_LINK_STAT *p_acl_link_stat)
|
||||
{
|
||||
if (p_acl_link_stat->event == BTA_ACL_LINK_STAT_CONN_CMPL &&
|
||||
p_acl_link_stat->link_act.conn_cmpl.status == HCI_SUCCESS) {
|
||||
btc_gap_bt_acl_link_handle_store(p_acl_link_stat->link_act.conn_cmpl.handle);
|
||||
} else if (p_acl_link_stat->event == BTA_ACL_LINK_STAT_DISCONN_CMPL) {
|
||||
btc_gap_bt_acl_link_handle_remove(p_acl_link_stat->link_act.disconn_cmpl.handle);
|
||||
}
|
||||
}
|
||||
|
||||
void btc_gap_bt_status_get(esp_bt_gap_profile_status_t *param)
|
||||
{
|
||||
param->disc_stat = gap_bt_local_param.disc_stat;
|
||||
param->conn_mode = gap_bt_local_param.conn_mode;
|
||||
param->disc_mode = gap_bt_local_param.disc_mode;
|
||||
param->bredr_acl_link_num = gap_bt_local_param.bredr_acl_link_num;
|
||||
}
|
||||
|
||||
#endif /* (BTC_GAP_BT_INCLUDED == TRUE) */
|
||||
|
@ -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
|
||||
*/
|
||||
@ -1666,4 +1666,23 @@ void btc_hf_cb_handler(btc_msg_t *msg)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void btc_hf_get_profile_status(esp_hf_profile_status_t *param)
|
||||
{
|
||||
int idx = 0;
|
||||
|
||||
param->hfp_ag_inited = false; // Not initialized by default
|
||||
|
||||
#if HFP_DYNAMIC_MEMORY == TRUE
|
||||
if (hf_local_param)
|
||||
#endif
|
||||
{
|
||||
if (hf_local_param[idx].btc_hf_cb.initialized) {
|
||||
param->hfp_ag_inited = true;
|
||||
if (hf_local_param[idx].btc_hf_cb.connection_state == ESP_HF_CONNECTION_STATE_SLC_CONNECTED) {
|
||||
param->conn_num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // #if (BTC_HF_INCLUDED == TRUE)
|
||||
|
@ -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
|
||||
*/
|
||||
@ -1200,4 +1200,21 @@ void btc_hf_client_call_handler(btc_msg_t *msg)
|
||||
}
|
||||
}
|
||||
|
||||
void btc_hf_client_get_profile_status(esp_hf_client_profile_status_t *param)
|
||||
{
|
||||
param->hf_client_inited = false; // Not initialized by default
|
||||
|
||||
#if HFP_DYNAMIC_MEMORY == TRUE
|
||||
if (hf_client_local_param_ptr)
|
||||
#endif
|
||||
{
|
||||
if (hf_client_local_param.btc_hf_client_cb.initialized) {
|
||||
param->hf_client_inited = true;
|
||||
if (hf_client_local_param.btc_hf_client_cb.state == ESP_HF_CLIENT_CONNECTION_STATE_SLC_CONNECTED) {
|
||||
param->conn_num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* #if (BTC_HF_CLIENT_INCLUDED == TRUE) */
|
||||
|
@ -959,4 +959,16 @@ void btc_hd_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||
}
|
||||
}
|
||||
|
||||
void btc_hd_get_profile_status(esp_hidd_profile_status_t *param)
|
||||
{
|
||||
if (is_hidd_init()) {
|
||||
param->hidd_inited = true;
|
||||
if (btc_hd_cb.status == BTC_HD_CONNECTED) {
|
||||
param->conn_num++;
|
||||
}
|
||||
} else {
|
||||
param->hidd_inited = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HID_DEV_INCLUDED==TRUE
|
||||
|
@ -1575,4 +1575,16 @@ void btc_hh_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||
}
|
||||
}
|
||||
|
||||
void btc_hh_get_profile_status(esp_hidh_profile_status_t *param)
|
||||
{
|
||||
if (is_hidh_init()) {
|
||||
param->hidh_inited = true;
|
||||
if (btc_hh_cb.status == BTC_HH_DEV_CONNECTED) {
|
||||
param->conn_num++;
|
||||
}
|
||||
} else {
|
||||
param->hidh_inited = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HID_HOST_INCLUDED == TRUE
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#if (BTC_AV_INCLUDED == TRUE)
|
||||
|
||||
// global variable to inidcate avrc is initialized with a2dp
|
||||
// global variable to indicate avrc is initialized with a2dp
|
||||
extern bool g_av_with_rc;
|
||||
// global variable to indicate a2dp is initialized
|
||||
extern bool g_a2dp_on_init;
|
||||
@ -108,6 +108,8 @@ void btc_a2dp_call_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_a2dp_cb_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_a2dp_get_profile_status(esp_a2d_profile_status_t *param);
|
||||
|
||||
void btc_a2dp_sink_reg_data_cb(esp_a2d_sink_data_cb_t callback);
|
||||
|
||||
void btc_a2dp_src_reg_data_cb(esp_a2d_source_data_cb_t callback);
|
||||
|
@ -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
|
||||
*/
|
||||
@ -13,6 +13,7 @@
|
||||
#include "esp_gap_bt_api.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "bta/utl.h"
|
||||
#include "bta/bta_api.h"
|
||||
|
||||
#if (BTC_GAP_BT_INCLUDED == TRUE)
|
||||
typedef enum {
|
||||
@ -192,8 +193,12 @@ void btc_gap_bt_cb_handler(btc_msg_t *msg);
|
||||
void btc_gap_bt_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
void btc_gap_bt_arg_deep_free(btc_msg_t *msg);
|
||||
void btc_gap_bt_busy_level_updated(uint8_t bl_flags);
|
||||
void btc_gap_bt_init(void);
|
||||
void btc_gap_bt_deinit(void);
|
||||
void btc_gap_bt_acl_link_num_update(tBTA_DM_ACL_LINK_STAT *p_acl_link_stat);
|
||||
|
||||
esp_err_t btc_gap_bt_get_cod(esp_bt_cod_t *cod);
|
||||
void btc_gap_bt_status_get(esp_bt_gap_profile_status_t *param);
|
||||
#endif /* #if BTC_GAP_BT_INCLUDED */
|
||||
|
||||
#endif /* __BTC_GAP_BT_H__ */
|
||||
|
@ -97,13 +97,11 @@ void btc_hd_call_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_hd_cb_handler(btc_msg_t *msg);
|
||||
|
||||
// extern btc_hd_cb_t btc_hd_cb;
|
||||
// extern void btc_hd_remove_device(bt_bdaddr_t bd_addr);
|
||||
// extern void btc_hd_service_registration();
|
||||
|
||||
void btc_hd_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
void btc_hd_cb_arg_deep_free(btc_msg_t *msg);
|
||||
|
||||
void btc_hd_get_profile_status(esp_hidd_profile_status_t *param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -255,6 +255,8 @@ void btc_hf_arg_deep_free(btc_msg_t *msg);
|
||||
|
||||
bt_status_t btc_hf_ci_sco_data(void);
|
||||
|
||||
void btc_hf_get_profile_status(esp_hf_profile_status_t *param);
|
||||
|
||||
#endif // BTC_HF_INCLUDED == TRUE
|
||||
|
||||
#endif /* __BTC_HF_AG_H__ */
|
||||
|
@ -155,7 +155,7 @@ extern hf_client_local_param_t *hf_client_local_param_ptr;
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
** BTC HF AG API
|
||||
** BTC HF CLIENT API
|
||||
********************************************************************************/
|
||||
|
||||
void btc_hf_client_call_handler(btc_msg_t *msg);
|
||||
@ -165,6 +165,8 @@ void btc_hf_client_cb_handler(btc_msg_t *msg);
|
||||
void btc_hf_client_incoming_data_cb_to_app(const uint8_t *data, uint32_t len);
|
||||
|
||||
uint32_t btc_hf_client_outgoing_data_cb_to_app(uint8_t *data, uint32_t len);
|
||||
|
||||
void btc_hf_client_get_profile_status(esp_hf_client_profile_status_t *param);
|
||||
#endif ///BTC_HF_CLIENT_INCLUDED == TRUE
|
||||
|
||||
#endif /* __BTC_HF_CLIENT_H__ */
|
||||
|
@ -186,4 +186,6 @@ void btc_hh_cb_arg_deep_free(btc_msg_t *msg);
|
||||
|
||||
bool btc_hh_add_added_dev(BD_ADDR bd_addr, uint16_t attr_mask);
|
||||
|
||||
void btc_hh_get_profile_status(esp_hidh_profile_status_t *param);
|
||||
|
||||
#endif /* BTC_HH_H */
|
||||
|
@ -67,6 +67,7 @@ void btc_l2cap_call_handler(btc_msg_t *msg);
|
||||
void btc_l2cap_cb_handler(btc_msg_t *msg);
|
||||
esp_err_t btc_l2cap_vfs_register(void);
|
||||
esp_err_t btc_l2cap_vfs_unregister(void);
|
||||
void btc_l2cap_get_protocol_status(esp_bt_l2cap_protocol_status_t *param);
|
||||
|
||||
#endif ///defined BTC_L2CAP_INCLUDED && BTC_L2CAP_INCLUDED == TRUE
|
||||
#endif ///__BTC_L2CAP_H__
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "common/bt_target.h"
|
||||
#include "bta/bta_sdp_api.h"
|
||||
#include "bt_sdp.h"
|
||||
#include "esp_sdp_api.h"
|
||||
|
||||
#if (defined BTC_SDP_INCLUDED && BTC_SDP_INCLUDED == TRUE)
|
||||
|
||||
@ -49,5 +50,7 @@ void btc_sdp_arg_deep_free(btc_msg_t *msg);
|
||||
void btc_sdp_call_handler(btc_msg_t *msg);
|
||||
void btc_sdp_cb_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_sdp_get_protocol_status(esp_sdp_protocol_status_t *param);
|
||||
|
||||
#endif ///defined BTC_SDP_INCLUDED && BTC_SDP_INCLUDED == TRUE
|
||||
#endif ///__BTC_SDP_H__
|
||||
|
@ -90,5 +90,6 @@ void btc_spp_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
void btc_spp_arg_deep_free(btc_msg_t *msg);
|
||||
|
||||
esp_err_t spp_send_data_to_btc(uint32_t handle, int len, uint8_t *p_data, esp_spp_mode_t spp_mode);
|
||||
void btc_spp_get_profile_status(esp_spp_profile_status_t *param);
|
||||
#endif ///defined BTC_SPP_INCLUDED && BTC_SPP_INCLUDED == TRUE
|
||||
#endif ///__BTC_SPP_H__
|
||||
|
@ -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
|
||||
*/
|
||||
@ -1252,4 +1252,20 @@ esp_err_t btc_l2cap_vfs_unregister(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void btc_l2cap_get_protocol_status(esp_bt_l2cap_protocol_status_t *param)
|
||||
{
|
||||
if (is_l2cap_init()) {
|
||||
param->l2cap_inited = true;
|
||||
osi_mutex_lock(&l2cap_local_param.l2cap_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
for (size_t i = 1; i <= BTA_JV_MAX_L2C_CONN; i++) {
|
||||
if (l2cap_local_param.l2cap_slots[i] != NULL && l2cap_local_param.l2cap_slots[i]->connected) {
|
||||
param->conn_num++;
|
||||
}
|
||||
}
|
||||
osi_mutex_unlock(&l2cap_local_param.l2cap_slot_mutex);
|
||||
} else {
|
||||
param->l2cap_inited = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endif ///defined BTC_L2CAP_INCLUDED && BTC_L2CAP_INCLUDED == TRUE
|
||||
|
@ -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
|
||||
*/
|
||||
@ -1340,4 +1340,20 @@ void btc_sdp_cb_handler(btc_msg_t *msg)
|
||||
btc_sdp_cb_arg_deep_free(msg);
|
||||
}
|
||||
|
||||
void btc_sdp_get_protocol_status(esp_sdp_protocol_status_t *param)
|
||||
{
|
||||
if (is_sdp_init()) {
|
||||
param->sdp_inited = true;
|
||||
osi_mutex_lock(&sdp_local_param.sdp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
for (size_t i = 0; i <= SDP_MAX_RECORDS; i++) {
|
||||
if (sdp_local_param.sdp_slots[i] != NULL && sdp_local_param.sdp_slots[i]->state == SDP_RECORD_ALLOCED) {
|
||||
param->records_num++;
|
||||
}
|
||||
}
|
||||
osi_mutex_unlock(&sdp_local_param.sdp_slot_mutex);
|
||||
} else {
|
||||
param->sdp_inited = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endif ///defined BTC_SDP_INCLUDED && BTC_SDP_INCLUDED == TRUE
|
||||
|
@ -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
|
||||
*/
|
||||
@ -1687,4 +1687,20 @@ static void btc_spp_vfs_unregister(void)
|
||||
btc_spp_cb_to_app(ESP_SPP_VFS_UNREGISTER_EVT, ¶m);
|
||||
}
|
||||
|
||||
void btc_spp_get_profile_status(esp_spp_profile_status_t *param)
|
||||
{
|
||||
if (is_spp_init()) {
|
||||
param->spp_inited = true;
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
|
||||
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->connected) {
|
||||
param->conn_num++;
|
||||
}
|
||||
}
|
||||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||
} else {
|
||||
param->spp_inited = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endif ///defined BTC_SPP_INCLUDED && BTC_SPP_INCLUDED == TRUE
|
||||
|
@ -53,6 +53,7 @@
|
||||
#define SLIP_DYNAMIC_MEMORY TRUE
|
||||
#define LLCP_DYNAMIC_MEMORY TRUE
|
||||
#define BTC_SBC_DEC_DYNAMIC_MEMORY TRUE
|
||||
#define BTC_GAP_BT_DYNAMIC_MEMORY TRUE
|
||||
|
||||
#else /* #if UC_BT_BLE_DYNAMIC_ENV_MEMORY */
|
||||
#define BTU_DYNAMIC_MEMORY FALSE
|
||||
@ -87,6 +88,7 @@
|
||||
#define SLIP_DYNAMIC_MEMORY FALSE
|
||||
#define LLCP_DYNAMIC_MEMORY FALSE
|
||||
#define BTC_SBC_DEC_DYNAMIC_MEMORY FALSE
|
||||
#define BTC_GAP_BT_DYNAMIC_MEMORY FALSE
|
||||
|
||||
#endif /* #if UC_BT_BLE_DYNAMIC_ENV_MEMORY */
|
||||
|
||||
|
Reference in New Issue
Block a user