mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
feat(ble_iso): Minor update for some ISO internal functions
This commit is contained in:
@@ -481,23 +481,6 @@ int bt_le_bluedroid_scan_stop(void)
|
||||
return bluedroid_err_to_errno(status);
|
||||
}
|
||||
|
||||
int bt_le_bluedroid_iso_disconnect(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
tBTM_STATUS status;
|
||||
|
||||
LOG_DBG("[B]IsoDisconn[0x%03x][%02x]", conn_handle, reason);
|
||||
|
||||
/* No direct_hci variant: HCI Disconnect returns Command_Status;
|
||||
* outcome arrives via BTM_BLE_ISO_CIS_DISCONNECTED_EVT. */
|
||||
status = BTM_BleDisconCis(conn_handle, reason);
|
||||
|
||||
if (status != BTM_SUCCESS) {
|
||||
LOG_ERR("[B]IsoDisconnFail[0x%03x][%02x]", conn_handle, status);
|
||||
}
|
||||
|
||||
return bluedroid_err_to_errno(status);
|
||||
}
|
||||
|
||||
int bt_le_bluedroid_gap_init(void)
|
||||
{
|
||||
BTM_BleGapRegisterCallback(gap_app_cb);
|
||||
|
||||
@@ -21,8 +21,6 @@ int bt_le_bluedroid_scan_start(const struct bt_le_scan_param *param);
|
||||
|
||||
int bt_le_bluedroid_scan_stop(void);
|
||||
|
||||
int bt_le_bluedroid_iso_disconnect(uint16_t conn_handle, uint8_t reason);
|
||||
|
||||
int bt_le_bluedroid_gap_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -15,9 +15,11 @@ extern "C" {
|
||||
|
||||
struct net_buf;
|
||||
|
||||
int bt_le_bluedroid_hci_iso_cmd_send_sync(uint16_t opcode,
|
||||
struct net_buf *buf,
|
||||
struct net_buf **rsp);
|
||||
int bt_le_bluedroid_iso_cmd_send_sync(uint16_t opcode,
|
||||
struct net_buf *buf,
|
||||
struct net_buf **rsp);
|
||||
|
||||
int bt_le_bluedroid_iso_disconnect(uint16_t conn_handle, uint8_t reason);
|
||||
|
||||
int bt_le_bluedroid_iso_init(void);
|
||||
|
||||
|
||||
@@ -749,9 +749,9 @@ static int hci_cmd_remove_iso_data_path(struct net_buf *buf, struct net_buf **rs
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bt_le_bluedroid_hci_iso_cmd_send_sync(uint16_t opcode,
|
||||
struct net_buf *buf,
|
||||
struct net_buf **rsp)
|
||||
int bt_le_bluedroid_iso_cmd_send_sync(uint16_t opcode,
|
||||
struct net_buf *buf,
|
||||
struct net_buf **rsp)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -1197,8 +1197,44 @@ static int iso_enable_cis(void)
|
||||
|
||||
return bluedroid_err_to_errno(status);
|
||||
}
|
||||
|
||||
static int iso_disable_cis(void)
|
||||
{
|
||||
tBTM_STATUS status;
|
||||
|
||||
#if USE_DIRECT_HCI
|
||||
/* HCI LE Set Host Feature: Bit_Number(1) | Bit_Value(1).
|
||||
* bit 32 = LE ISO Channels (Host Support). */
|
||||
uint8_t cmd_params[2] = { 32, 0 };
|
||||
|
||||
status = bt_le_bluedroid_hci_send_sync(HCI_BLE_SET_HOST_FEATURE,
|
||||
cmd_params, sizeof(cmd_params),
|
||||
NULL, 0);
|
||||
#else /* USE_DIRECT_HCI */
|
||||
status = BTM_BleSetHostFeature(32, 0);
|
||||
#endif /* USE_DIRECT_HCI */
|
||||
|
||||
return bluedroid_err_to_errno(status);
|
||||
}
|
||||
#endif /* CONFIG_BT_ISO_UNICAST */
|
||||
|
||||
int bt_le_bluedroid_iso_disconnect(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
tBTM_STATUS status;
|
||||
|
||||
LOG_DBG("[B]IsoDisconn[0x%03x][%02x]", conn_handle, reason);
|
||||
|
||||
/* No direct_hci variant: HCI Disconnect returns Command_Status;
|
||||
* outcome arrives via BTM_BLE_ISO_CIS_DISCONNECTED_EVT. */
|
||||
status = BTM_BleDisconCis(conn_handle, reason);
|
||||
|
||||
if (status != BTM_SUCCESS) {
|
||||
LOG_ERR("[B]IsoDisconnFail[0x%03x][%02x]", conn_handle, status);
|
||||
}
|
||||
|
||||
return bluedroid_err_to_errno(status);
|
||||
}
|
||||
|
||||
int bt_le_bluedroid_iso_init(void)
|
||||
{
|
||||
#if CONFIG_BT_ISO_UNICAST
|
||||
@@ -1245,17 +1281,7 @@ void bt_le_bluedroid_iso_deinit(void)
|
||||
{
|
||||
#if CONFIG_BT_ISO_UNICAST
|
||||
/* Mirror bt_le_iso_init() which enables bit 32 only on unicast build. */
|
||||
#if USE_DIRECT_HCI
|
||||
{
|
||||
uint8_t cmd_params[2] = { 32, 0 };
|
||||
|
||||
bt_le_bluedroid_hci_send_sync(HCI_BLE_SET_HOST_FEATURE,
|
||||
cmd_params, sizeof(cmd_params),
|
||||
NULL, 0);
|
||||
}
|
||||
#else /* USE_DIRECT_HCI */
|
||||
BTM_BleSetHostFeature(32, 0);
|
||||
#endif /* USE_DIRECT_HCI */
|
||||
iso_disable_cis();
|
||||
#endif /* CONFIG_BT_ISO_UNICAST */
|
||||
|
||||
#if CONFIG_BT_ISO_RX
|
||||
|
||||
@@ -287,8 +287,3 @@ int bt_le_nimble_scan_stop(void)
|
||||
|
||||
return nimble_err_to_errno(rc);
|
||||
}
|
||||
|
||||
int bt_le_nimble_iso_disconnect(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
return nimble_err_to_errno(ble_gap_iso_disconnect(conn_handle, reason));
|
||||
}
|
||||
|
||||
@@ -21,8 +21,6 @@ int bt_le_nimble_scan_start(const struct bt_le_scan_param *param, ble_gap_event_
|
||||
|
||||
int bt_le_nimble_scan_stop(void);
|
||||
|
||||
int bt_le_nimble_iso_disconnect(uint16_t conn_handle, uint8_t reason);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -19,6 +19,8 @@ int bt_le_nimble_iso_cmd_send_sync(uint16_t opcode,
|
||||
struct net_buf *buf,
|
||||
struct net_buf **rsp);
|
||||
|
||||
int bt_le_nimble_iso_disconnect(uint16_t conn_handle, uint8_t reason);
|
||||
|
||||
int bt_le_nimble_iso_init(void);
|
||||
|
||||
void bt_le_nimble_iso_deinit(void);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <../host/iso_internal.h>
|
||||
|
||||
#include "../src/ble_hs_priv.h"
|
||||
#include "host/ble_gap.h"
|
||||
#include "host/ble_hs_iso.h"
|
||||
#include "host/ble_hs_iso_hci.h"
|
||||
|
||||
@@ -838,6 +839,11 @@ static int iso_disable_cis(void)
|
||||
}
|
||||
#endif /* CONFIG_BT_ISO_UNICAST */
|
||||
|
||||
int bt_le_nimble_iso_disconnect(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
return nimble_err_to_errno(ble_gap_iso_disconnect(conn_handle, reason));
|
||||
}
|
||||
|
||||
int bt_le_nimble_iso_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -71,7 +71,7 @@ int bt_hci_cmd_send_sync(uint16_t opcode,
|
||||
LOG_DBG("HciCmdSendSync[%04x]", opcode);
|
||||
|
||||
#if CONFIG_BT_BLUEDROID_ENABLED
|
||||
return bt_le_bluedroid_hci_iso_cmd_send_sync(opcode, buf, rsp);
|
||||
return bt_le_bluedroid_iso_cmd_send_sync(opcode, buf, rsp);
|
||||
#else
|
||||
return bt_le_nimble_iso_cmd_send_sync(opcode, buf, rsp);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user