Skip to content

Commit f36b7a8

Browse files
ppryga-nordiccarlescufi
authored andcommitted
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 <[email protected]>
1 parent 9d711d6 commit f36b7a8

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

include/bluetooth/hci.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,12 @@ struct bt_hci_cp_le_set_privacy_mode {
14641464
uint8_t mode;
14651465
} __packed;
14661466

1467+
#define BT_HCI_OP_LE_SET_CL_CTE_TX_ENABLE BT_OP(BT_OGF_LE, 0x0052)
1468+
struct bt_hci_cp_le_set_cl_cte_tx_enable {
1469+
uint8_t handle;
1470+
uint8_t cte_enable;
1471+
} __packed;
1472+
14671473
/* Min and max Constant Tone Extension length in 8us units */
14681474
#define BT_HCI_LE_CTE_LEN_MIN 0x2
14691475
#define BT_HCI_LE_CTE_LEN_MAX 0x14

subsys/bluetooth/controller/hci/hci.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,6 +2449,27 @@ static void le_df_set_cl_cte_tx_params(struct net_buf *buf,
24492449

24502450
*evt = cmd_complete_status(status);
24512451
}
2452+
2453+
static void le_df_set_cl_cte_enable(struct net_buf *buf, struct net_buf **evt)
2454+
{
2455+
struct bt_hci_cp_le_set_cl_cte_tx_enable *cmd = (void *)buf->data;
2456+
uint8_t status;
2457+
uint8_t handle;
2458+
2459+
if (adv_cmds_ext_check(evt)) {
2460+
return;
2461+
}
2462+
2463+
status = ll_adv_set_by_hci_handle_get(cmd->handle, &handle);
2464+
if (status) {
2465+
*evt = cmd_complete_status(status);
2466+
return;
2467+
}
2468+
2469+
status = ll_df_set_cl_cte_tx_enable(handle, cmd->cte_enable);
2470+
2471+
*evt = cmd_complete_status(status);
2472+
}
24522473
#endif /* CONFIG_BT_CTLR_DF_ADV_CTE_TX */
24532474

24542475
#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,
35093530
case BT_OCF(BT_HCI_OP_LE_SET_CL_CTE_TX_PARAMS):
35103531
le_df_set_cl_cte_tx_params(cmd, evt);
35113532
break;
3533+
case BT_OCF(BT_HCI_OP_LE_SET_CL_CTE_TX_ENABLE):
3534+
le_df_set_cl_cte_enable(cmd, evt);
3535+
break;
35123536
#endif /* CONFIG_BT_CTLR_DF_ADV_CTE_TX */
35133537
case BT_OCF(BT_HCI_OP_LE_READ_ANT_INFO):
35143538
le_df_read_ant_inf(cmd, evt);

subsys/bluetooth/controller/include/ll.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ uint8_t ll_df_set_cl_cte_tx_params(uint8_t adv_handle, uint8_t cte_len,
303303
uint8_t cte_type, uint8_t cte_count,
304304
uint8_t num_ant_ids, uint8_t *ant_ids);
305305

306+
/* Enables or disables CTE TX for periodic advertising */
307+
uint8_t ll_df_set_cl_cte_tx_enable(uint8_t adv_handle, uint8_t cte_enable);
308+
306309
/* Provides information about antennae switching and sampling settings */
307310
uint8_t ll_df_set_conn_cte_tx_params(uint16_t handle, uint8_t cte_types,
308311
uint8_t switching_patterns_len,

subsys/bluetooth/controller/ll_sw/ull_df.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@ uint8_t ll_df_set_cl_cte_tx_params(uint8_t adv_handle, uint8_t cte_len,
193193
return BT_HCI_ERR_SUCCESS;
194194
}
195195

196+
/* @brief Function enables or disables CTE TX for periodic advertising.
197+
*
198+
* @param[in] handle Advertising set handle.
199+
* @param[in] cte_enable Enable or disable CTE TX
200+
*
201+
* @return Status of command completion.
202+
*/
203+
uint8_t ll_df_set_cl_cte_tx_enable(uint8_t adv_handle, uint8_t cte_enable)
204+
{
205+
return BT_HCI_ERR_CMD_DISALLOWED;
206+
}
207+
196208
/* @brief Function sets CTE transmission parameters for a connection.
197209
*
198210
* @param[in]handle Connection handle.

0 commit comments

Comments
 (0)