mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-11-01 10:06:11 +00:00
nimble/ll: Add HCI Read Transmit Power Level command support
This command is mandatory if central or peripheral roles are supported.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "controller/ble_ll_ctrl.h"
|
||||
#include "controller/ble_ll_scan.h"
|
||||
#include "controller/ble_ll_adv.h"
|
||||
#include "ble_ll_priv.h"
|
||||
#include "ble_ll_conn_priv.h"
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL) || MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
|
||||
@@ -1939,6 +1940,39 @@ ble_ll_conn_hci_wr_auth_pyld_tmo(const uint8_t *cmdbuf, uint8_t len,
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL) || MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
|
||||
int
|
||||
ble_ll_conn_hci_cb_read_tx_pwr(const uint8_t *cmdbuf, uint8_t len,
|
||||
uint8_t *rspbuf, uint8_t *rsplen)
|
||||
{
|
||||
const struct ble_hci_cb_read_tx_pwr_cp *cmd = (const void *)cmdbuf;
|
||||
struct ble_hci_cb_read_tx_pwr_rp *rsp = (void *)rspbuf;
|
||||
struct ble_ll_conn_sm *connsm;
|
||||
uint16_t handle;
|
||||
|
||||
if (len != sizeof(*cmd)) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
if (cmd->type != 0x01) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
handle = le16toh(cmd->conn_handle);
|
||||
connsm = ble_ll_conn_find_by_handle(handle);
|
||||
if (!connsm) {
|
||||
return BLE_ERR_UNK_CONN_ID;
|
||||
}
|
||||
|
||||
rsp->conn_handle = cmd->conn_handle;
|
||||
rsp->tx_level = g_ble_ll_tx_power;
|
||||
|
||||
*rsplen = sizeof(*rsp);
|
||||
|
||||
return BLE_ERR_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_PHY)
|
||||
/**
|
||||
* Read current phy for connection (OGF=8, OCF==0x0030)
|
||||
|
||||
@@ -227,6 +227,9 @@ int ble_ll_conn_hci_wr_auth_pyld_tmo(const uint8_t *cmdbuf, uint8_t len,
|
||||
uint8_t *rspbuf, uint8_t *rsplen);
|
||||
int ble_ll_conn_hci_rd_auth_pyld_tmo(const uint8_t *cmdbuf, uint8_t len,
|
||||
uint8_t *rspbuf, uint8_t *rsplen);
|
||||
int ble_ll_conn_hci_cb_read_tx_pwr(const uint8_t *cmdbuf, uint8_t len,
|
||||
uint8_t *rspbuf, uint8_t *rsplen);
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_SCA_UPDATE)
|
||||
int ble_ll_conn_req_peer_sca(const uint8_t *cmdbuf, uint8_t len,
|
||||
uint8_t *rspbuf, uint8_t *rsplen);
|
||||
|
||||
@@ -1541,6 +1541,11 @@ ble_ll_hci_ctlr_bb_cmd_proc(const uint8_t *cmdbuf, uint8_t len, uint16_t ocf,
|
||||
rc = ble_ll_reset();
|
||||
}
|
||||
break;
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL) || MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
|
||||
case BLE_HCI_OCF_CB_READ_TX_PWR:
|
||||
rc = ble_ll_conn_hci_cb_read_tx_pwr(cmdbuf, len, rspbuf, rsplen);
|
||||
break;
|
||||
#endif
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_CTRL_TO_HOST_FLOW_CONTROL)
|
||||
case BLE_HCI_OCF_CB_SET_CTLR_TO_HOST_FC:
|
||||
rc = ble_ll_hci_cb_set_ctrlr_to_host_fc(cmdbuf, len);
|
||||
|
||||
@@ -45,6 +45,9 @@ static const uint8_t octet_5 = OCTET(
|
||||
);
|
||||
|
||||
static const uint8_t octet_10 = OCTET(
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL) || MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
|
||||
BIT(2) /* HCI Read Transmit Power Level */
|
||||
#endif
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_CTRL_TO_HOST_FLOW_CONTROL)
|
||||
BIT(5) /* HCI Set Controller To Host Flow Control */
|
||||
BIT(6) /* HCI Host Buffer Size */
|
||||
|
||||
Reference in New Issue
Block a user