mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
feat(bt): Add APIs to control transmit power level
- API to read ACL real RSSI - APIs to read/write tx power of inq/iscan/page/pscan/ACL
This commit is contained in:
@@ -795,6 +795,66 @@ typedef struct {
|
||||
BD_ADDR rem_bda;
|
||||
} tBTM_RSSI_RESULTS;
|
||||
|
||||
#if (ESP_BT_CLASSIC_ENABLE_POWER_CTRL_VSC == TRUE)
|
||||
/* Structure returned with read ACL real RSSI event (in tBTM_CMPL_CB callback function)
|
||||
** in response to BTM_ReadAclRealRSSI call.
|
||||
*/
|
||||
typedef struct {
|
||||
tBTM_STATUS status;
|
||||
UINT8 hci_status;
|
||||
INT8 rssi;
|
||||
BD_ADDR rem_bda;
|
||||
} tBTM_ACL_REAL_RSSI_RESULTS;
|
||||
|
||||
/* Structure returned with read new connection transmit power level event (in tBTM_CMPL_CB callback function)
|
||||
** in response to BTM_ReadNewConnTxPwrLvl call.
|
||||
*/
|
||||
typedef struct {
|
||||
tBTM_STATUS status;
|
||||
UINT8 hci_status;
|
||||
INT8 pwr_lvl_min;
|
||||
INT8 pwr_lvl_max;
|
||||
} tBTM_READ_NEW_CONN_TX_PWR_LVL_RESULTS;
|
||||
|
||||
/* Structure returned with write new connection transmit power level event (in tBTM_CMPL_CB callback function)
|
||||
** in response to BTM_WriteNewConnTxPwrLvl call.
|
||||
*/
|
||||
typedef struct {
|
||||
tBTM_STATUS status;
|
||||
UINT8 hci_status;
|
||||
} tBTM_WRITE_NEW_CONN_TX_PWR_LVL_RESULTS;
|
||||
#endif // #if (ESP_BT_CLASSIC_ENABLE_POWER_CTRL_VSC == TRUE)
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* BR/EDR tx power level type for inq/iscan/page/pscan control */
|
||||
typedef enum {
|
||||
BTM_TX_PWR_LVL_INQ = 0,
|
||||
BTM_TX_PWR_LVL_ISCAN,
|
||||
BTM_TX_PWR_LVL_PAGE,
|
||||
BTM_TX_PWR_LVL_PSCAN,
|
||||
BTM_TX_PWR_LVL_MAX,
|
||||
} tBTM_TX_PWR_LVL_TYPE;
|
||||
|
||||
/* Structure returned with read inq/iscan/page/pscan tx power level event (in tBTM_CMPL_CB callback function)
|
||||
** in response to BTM_ReadBredrTxPwrLvl/BTM_ReadInquiryRspTxPower call.
|
||||
*/
|
||||
typedef struct {
|
||||
tBTM_STATUS status;
|
||||
UINT8 hci_status;
|
||||
INT8 tx_power;
|
||||
tBTM_TX_PWR_LVL_TYPE type;
|
||||
} tBTM_READ_TX_PWR_LVL_RESULTS;
|
||||
|
||||
/* Structure returned with write inq/iscan/page/pscan tx power level event (in tBTM_CMPL_CB callback function)
|
||||
** in response to BTM_WriteBredrTxPwrLvl/BTM_WriteInquiryTxPower call.
|
||||
*/
|
||||
typedef struct {
|
||||
tBTM_STATUS status;
|
||||
UINT8 hci_status;
|
||||
tBTM_TX_PWR_LVL_TYPE type;
|
||||
} tBTM_WRITE_TX_PWR_LVL_RESULTS;
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
/* Structure returned with read channel map event (in tBTM_CMPL_CB callback function)
|
||||
** in response to BTM_ReadChannelMap call.
|
||||
*/
|
||||
@@ -866,16 +926,6 @@ typedef struct {
|
||||
UINT8 hci_status;
|
||||
} tBTM_BLE_SET_CHANNELS_RESULTS;
|
||||
|
||||
/* Structure returned with read inq tx power quality event (in tBTM_CMPL_CB callback function)
|
||||
** in response to BTM_ReadInquiryRspTxPower call.
|
||||
*/
|
||||
typedef struct {
|
||||
tBTM_STATUS status;
|
||||
UINT8 hci_status;
|
||||
INT8 tx_power;
|
||||
} tBTM_INQ_TXPWR_RESULTS;
|
||||
|
||||
|
||||
enum {
|
||||
BTM_ACL_CONN_CMPL_EVT,
|
||||
BTM_ACL_DISCONN_CMPL_EVT
|
||||
@@ -2788,6 +2838,7 @@ tBTM_INQ_INFO *BTM_InqDbNext (tBTM_INQ_INFO *p_cur);
|
||||
//extern
|
||||
tBTM_STATUS BTM_ClearInqDb (BD_ADDR p_bda);
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_ReadInquiryRspTxPower
|
||||
@@ -2802,6 +2853,21 @@ tBTM_STATUS BTM_ClearInqDb (BD_ADDR p_bda);
|
||||
//extern
|
||||
tBTM_STATUS BTM_ReadInquiryRspTxPower (tBTM_CMPL_CB *p_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_WriteInquiryTxPower
|
||||
**
|
||||
** Description This command writes the inquiry transmit power level used
|
||||
** to transmit inquiry response packets.
|
||||
**
|
||||
** Returns BTM_CMD_STARTED if command issued to controller.
|
||||
** BTM_NO_RESOURCES if couldn't allocate memory to issue command
|
||||
** BTM_BUSY if command is already in progress
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_WriteInquiryTxPower(INT8 tx_power, tBTM_CMPL_CB *p_cb);
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
#if SDP_INCLUDED == TRUE
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -3008,6 +3074,88 @@ tBTM_STATUS BTM_SwitchRole (BD_ADDR remote_bd_addr,
|
||||
//extern
|
||||
tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBT_TRANSPORT transport, tBTM_CMPL_CB *p_cb);
|
||||
|
||||
#if (ESP_BT_CLASSIC_ENABLE_POWER_CTRL_VSC == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_ReadAclRealRSSI
|
||||
**
|
||||
** Description This function is called to read ACL real RSSI.
|
||||
** The RSSI of results are returned in the callback.
|
||||
** (tBTM_ACL_REAL_RSSI_RESULTS)
|
||||
**
|
||||
** Returns BTM_CMD_STARTED if command issued to controller.
|
||||
** BTM_NO_RESOURCES if couldn't allocate memory to issue command
|
||||
** BTM_UNKNOWN_ADDR if no active link with bd addr specified
|
||||
** BTM_BUSY if command is already in progress
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_ReadAclRealRSSI(BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_ReadNewConnTxPwrLvl
|
||||
**
|
||||
** Description This function is called to read new connection transmit power level.
|
||||
** The new connection transmit power level value returned in the callback.
|
||||
** (tBTM_READ_NEW_CONN_TX_PWR_LVL_RESULTS)
|
||||
**
|
||||
** Returns BTM_CMD_STARTED if command issued to controller.
|
||||
** BTM_NO_RESOURCES if couldn't allocate memory to issue command
|
||||
** BTM_BUSY if command is already in progress
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_ReadNewConnTxPwrLvl(tBTM_CMPL_CB *p_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_WriteNewConnTxPwrLvl
|
||||
**
|
||||
** Description This function is called to write new connection transmit power level.
|
||||
** The new connection transmit power level value returned in the callback.
|
||||
** (tBTM_WRITE_NEW_CONN_TX_PWR_LVL_RESULTS)
|
||||
**
|
||||
** Returns BTM_CMD_STARTED if command issued to controller.
|
||||
** BTM_NO_RESOURCES if couldn't allocate memory to issue command
|
||||
** BTM_BUSY if command is already in progress
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_WriteNewConnTxPwrLvl(INT8 pwr_lvl_min, INT8 pwr_lvl_max, tBTM_CMPL_CB *p_cb);
|
||||
#endif // #if (ESP_BT_CLASSIC_ENABLE_POWER_CTRL_VSC == TRUE)
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_ReadBredrTxPwrLvl
|
||||
**
|
||||
** Description This function is called to read inq/iscan/page/pscan transmit power level.
|
||||
** The corresponding transmit power level value returned in the callback.
|
||||
** (tBTM_READ_TX_PWR_LVL_RESULTS)
|
||||
**
|
||||
** Returns BTM_CMD_STARTED if command issued to controller.
|
||||
** BTM_NO_RESOURCES if couldn't allocate memory to issue command
|
||||
** BTM_BUSY if command is already in progress
|
||||
** BTM_ILLEGAL_VALUE if type is invalid
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_ReadBredrTxPwrLvl(tBTM_TX_PWR_LVL_TYPE type, tBTM_CMPL_CB *p_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_WriteBredrTxPwrLvl
|
||||
**
|
||||
** Description This function is called to write inq/iscan/page/pscan transmit power level.
|
||||
** The corresponding write status returned in the callback.
|
||||
** (tBTM_WRITE_TX_PWR_LVL_RESULTS)
|
||||
**
|
||||
** Returns BTM_CMD_STARTED if command issued to controller.
|
||||
** BTM_NO_RESOURCES if couldn't allocate memory to issue command
|
||||
** BTM_BUSY if command is already in progress
|
||||
** BTM_ILLEGAL_VALUE if type is invalid
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_WriteBredrTxPwrLvl(tBTM_TX_PWR_LVL_TYPE type, INT8 tx_power, tBTM_CMPL_CB *p_cb);
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_ReadChannelMap
|
||||
|
||||
@@ -169,6 +169,9 @@ typedef void (*tBTU_EVENT_CALLBACK)(BT_HDR *p_hdr);
|
||||
/* BTU internal timer for set page timeout*/
|
||||
#define BTU_TTYPE_BTM_SET_PAGE_TO 111
|
||||
|
||||
/* BTU internal timer for BR/EDR power control*/
|
||||
#define BTU_TTYPE_BTM_BREDR_PWR_CTRL 112
|
||||
|
||||
/* BTU Task Signal */
|
||||
typedef enum {
|
||||
SIG_BTU_START_UP = 0,
|
||||
|
||||
@@ -512,6 +512,15 @@
|
||||
#define HCI_SUBCODE_BT_SET_AFH_REPORTING_MODE 0x09
|
||||
#define HCI_SUBCODE_BT_MASK_RMT_AFH_CH_CLASS 0x0A
|
||||
#define HCI_SUBCODE_BT_WR_AUTO_RATE_INIT_ENABLE 0x0B
|
||||
#define HCI_SUBCODE_BT_RD_ACL_REAL_RSSI 0x11
|
||||
#define HCI_SUBCODE_BT_RD_NEW_CONN_TX_PWR_LVL 0x12
|
||||
#define HCI_SUBCODE_BT_WR_NEW_CONN_TX_PWR_LVL 0x13
|
||||
#define HCI_SUBCODE_BT_RD_PAGE_TX_PWR_LVL 0x14
|
||||
#define HCI_SUBCODE_BT_WR_PAGE_TX_PWR_LVL 0x15
|
||||
#define HCI_SUBCODE_BT_RD_PSCAN_TX_PWR_LVL 0x16
|
||||
#define HCI_SUBCODE_BT_WR_PSCAN_TX_PWR_LVL 0x17
|
||||
#define HCI_SUBCODE_BT_RD_INQ_TX_PWR_LVL 0x18
|
||||
#define HCI_SUBCODE_BT_WR_ISCAN_TX_PWR_LVL 0x19
|
||||
#define HCI_SUBCODE_BT_MAX 0x7F
|
||||
|
||||
#define HCI_ESP_VENDOR_OPCODE_BUILD(ogf, group, subcode) ((ogf << 10) | (group <<7) | (subcode << 0))
|
||||
@@ -561,6 +570,15 @@
|
||||
#define HCI_VENDOR_BT_SET_AFH_REPORTING_MODE HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BT, HCI_SUBCODE_BT_SET_AFH_REPORTING_MODE)
|
||||
#define HCI_VENDOR_BT_MASK_RMT_AFH_CH_CLASS HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BT, HCI_SUBCODE_BT_MASK_RMT_AFH_CH_CLASS)
|
||||
#define HCI_VENDOR_BT_WR_AUTO_RATE_INIT_ENABLE HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BT, HCI_SUBCODE_BT_WR_AUTO_RATE_INIT_ENABLE)
|
||||
#define HCI_VENDOR_BT_RD_ACL_REAL_RSSI HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BT, HCI_SUBCODE_BT_RD_ACL_REAL_RSSI)
|
||||
#define HCI_VENDOR_BT_RD_NEW_CONN_TX_PWR_LVL HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BT, HCI_SUBCODE_BT_RD_NEW_CONN_TX_PWR_LVL)
|
||||
#define HCI_VENDOR_BT_WR_NEW_CONN_TX_PWR_LVL HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BT, HCI_SUBCODE_BT_WR_NEW_CONN_TX_PWR_LVL)
|
||||
#define HCI_VENDOR_BT_RD_PAGE_TX_PWR_LVL HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BT, HCI_SUBCODE_BT_RD_PAGE_TX_PWR_LVL)
|
||||
#define HCI_VENDOR_BT_WR_PAGE_TX_PWR_LVL HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BT, HCI_SUBCODE_BT_WR_PAGE_TX_PWR_LVL)
|
||||
#define HCI_VENDOR_BT_RD_PSCAN_TX_PWR_LVL HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BT, HCI_SUBCODE_BT_RD_PSCAN_TX_PWR_LVL)
|
||||
#define HCI_VENDOR_BT_WR_PSCAN_TX_PWR_LVL HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BT, HCI_SUBCODE_BT_WR_PSCAN_TX_PWR_LVL)
|
||||
#define HCI_VENDOR_BT_RD_INQ_TX_PWR_LVL HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BT, HCI_SUBCODE_BT_RD_INQ_TX_PWR_LVL)
|
||||
#define HCI_VENDOR_BT_WR_ISCAN_TX_PWR_LVL HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BT, HCI_SUBCODE_BT_WR_ISCAN_TX_PWR_LVL)
|
||||
|
||||
/* subcode for multi adv feature */
|
||||
#define BTM_BLE_MULTI_ADV_SET_PARAM 0x01
|
||||
|
||||
@@ -509,6 +509,11 @@ BOOLEAN btsnd_hcic_read_inq_tx_power (void);
|
||||
|
||||
#define HCIC_PARAM_SIZE_R_TX_POWER 0
|
||||
|
||||
/* Write Inquiry Tx Power Level */
|
||||
BOOLEAN btsnd_hcic_write_inq_tx_power (INT8 tx_power);
|
||||
|
||||
#define HCIC_PARAM_SIZE_W_INQ_TX_POWER 1
|
||||
|
||||
/* Read Default Erroneous Data Reporting */
|
||||
BOOLEAN btsnd_hcic_read_default_erroneous_data_rpt (void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user