bluetooth: conn: add api for getting tx power level

Added a new Bluetooth API that can be used to read the current and
maximum transmit power level of the radio. The reading operation is
performed over HCI.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
This commit is contained in:
Kamil Piszczek 2020-07-06 10:01:04 -04:00 committed by Carles Cufí
commit fd8d03bd8b
2 changed files with 78 additions and 0 deletions

View file

@ -370,6 +370,19 @@ struct bt_conn_remote_info {
};
};
/** LE Transmit Power Level Structure */
struct bt_conn_le_tx_power {
/** Input: 1M, 2M, Coded S2 or Coded S8 */
uint8_t phy;
/** Output: current transmit power level */
int8_t current_level;
/** Output: maximum transmit power level */
int8_t max_level;
};
/** @brief Get connection info
*
* @param conn Connection object.
@ -397,6 +410,17 @@ int bt_conn_get_info(const struct bt_conn *conn, struct bt_conn_info *info);
int bt_conn_get_remote_info(struct bt_conn *conn,
struct bt_conn_remote_info *remote_info);
/** @brief Get connection transmit power level.
*
* @param conn Connection object.
* @param tx_power_level Transmit power level descriptor.
*
* @return Zero on success or (negative) error code on failure.
* @return -ENOBUFS HCI command buffer is not available.
*/
int bt_conn_le_get_tx_power_level(struct bt_conn *conn,
struct bt_conn_le_tx_power *tx_power_level);
/** @brief Update the connection parameters.
*
* If the local device is in the peripheral role then updating the connection