Bluetooth: controller: hci: Add HCI_Set_Connectionless_CTE_TX_Enable cmd

Add implementation of HCI_Set_Connecitonless_CTE_TX_Enable
command to HCI. Add scratch implementation of command handling
functions to controller.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
This commit is contained in:
Piotr Pryga 2021-01-10 22:53:55 -08:00 committed by Carles Cufí
commit f36b7a8732
4 changed files with 45 additions and 0 deletions

View file

@ -1464,6 +1464,12 @@ struct bt_hci_cp_le_set_privacy_mode {
uint8_t mode;
} __packed;
#define BT_HCI_OP_LE_SET_CL_CTE_TX_ENABLE BT_OP(BT_OGF_LE, 0x0052)
struct bt_hci_cp_le_set_cl_cte_tx_enable {
uint8_t handle;
uint8_t cte_enable;
} __packed;
/* Min and max Constant Tone Extension length in 8us units */
#define BT_HCI_LE_CTE_LEN_MIN 0x2
#define BT_HCI_LE_CTE_LEN_MAX 0x14

View file

@ -2449,6 +2449,27 @@ static void le_df_set_cl_cte_tx_params(struct net_buf *buf,
*evt = cmd_complete_status(status);
}
static void le_df_set_cl_cte_enable(struct net_buf *buf, struct net_buf **evt)
{
struct bt_hci_cp_le_set_cl_cte_tx_enable *cmd = (void *)buf->data;
uint8_t status;
uint8_t handle;
if (adv_cmds_ext_check(evt)) {
return;
}
status = ll_adv_set_by_hci_handle_get(cmd->handle, &handle);
if (status) {
*evt = cmd_complete_status(status);
return;
}
status = ll_df_set_cl_cte_tx_enable(handle, cmd->cte_enable);
*evt = cmd_complete_status(status);
}
#endif /* CONFIG_BT_CTLR_DF_ADV_CTE_TX */
#if IS_ENABLED(CONFIG_BT_CTLR_DF_CONN_CTE_RSP)
@ -3509,6 +3530,9 @@ static int controller_cmd_handle(uint16_t ocf, struct net_buf *cmd,
case BT_OCF(BT_HCI_OP_LE_SET_CL_CTE_TX_PARAMS):
le_df_set_cl_cte_tx_params(cmd, evt);
break;
case BT_OCF(BT_HCI_OP_LE_SET_CL_CTE_TX_ENABLE):
le_df_set_cl_cte_enable(cmd, evt);
break;
#endif /* CONFIG_BT_CTLR_DF_ADV_CTE_TX */
case BT_OCF(BT_HCI_OP_LE_READ_ANT_INFO):
le_df_read_ant_inf(cmd, evt);

View file

@ -303,6 +303,9 @@ uint8_t ll_df_set_cl_cte_tx_params(uint8_t adv_handle, uint8_t cte_len,
uint8_t cte_type, uint8_t cte_count,
uint8_t num_ant_ids, uint8_t *ant_ids);
/* Enables or disables CTE TX for periodic advertising */
uint8_t ll_df_set_cl_cte_tx_enable(uint8_t adv_handle, uint8_t cte_enable);
/* Provides information about antennae switching and sampling settings */
uint8_t ll_df_set_conn_cte_tx_params(uint16_t handle, uint8_t cte_types,
uint8_t switching_patterns_len,

View file

@ -193,6 +193,18 @@ uint8_t ll_df_set_cl_cte_tx_params(uint8_t adv_handle, uint8_t cte_len,
return BT_HCI_ERR_SUCCESS;
}
/* @brief Function enables or disables CTE TX for periodic advertising.
*
* @param[in] handle Advertising set handle.
* @param[in] cte_enable Enable or disable CTE TX
*
* @return Status of command completion.
*/
uint8_t ll_df_set_cl_cte_tx_enable(uint8_t adv_handle, uint8_t cte_enable)
{
return BT_HCI_ERR_CMD_DISALLOWED;
}
/* @brief Function sets CTE transmission parameters for a connection.
*
* @param[in]handle Connection handle.