Bluetooth: Controller: df: refactor CTE REQ set disable

Add a function that is responsible for set CTE request disabled.
It is a refactoring, to have a single place where CTE request
is_enabled and req_interval are zeroed.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
This commit is contained in:
Piotr Pryga 2022-01-28 21:38:41 +01:00 committed by Carles Cufí
commit f79f9d155d
4 changed files with 13 additions and 2 deletions

View file

@ -1160,8 +1160,7 @@ uint8_t ll_df_set_conn_cte_req_enable(uint16_t handle, uint8_t enable,
}
if (!enable) {
conn->llcp.cte_req.is_enabled = false;
conn->llcp.cte_req.req_interval = 0U;
ull_cp_cte_req_set_disable(conn);
if (conn->llcp.cte_req.is_active) {
struct k_sem sem;

View file

@ -917,6 +917,12 @@ uint8_t ull_cp_cte_req(struct ll_conn *conn, uint8_t min_cte_len, uint8_t cte_ty
return BT_HCI_ERR_SUCCESS;
}
void ull_cp_cte_req_set_disable(struct ll_conn *conn)
{
conn->llcp.cte_req.is_enabled = 0U;
conn->llcp.cte_req.req_interval = 0U;
}
#endif /* CONFIG_BT_CTLR_DF_CONN_CTE_REQ */
static bool pdu_is_expected(struct pdu_data *pdu, struct proc_ctx *ctx)

View file

@ -153,6 +153,11 @@ uint8_t ull_cp_data_length_update(struct ll_conn *conn, uint16_t max_tx_octets,
*/
uint8_t ull_cp_cte_req(struct ll_conn *conn, uint8_t min_cte_len, uint8_t cte_type);
/**
* @brief Set a CTE Request Procedure disabled.
*/
void ull_cp_cte_req_set_disable(struct ll_conn *conn);
/**
* @brief Enable or disable response to CTE Request Procedure.
*/

View file

@ -355,6 +355,7 @@ static void lp_comm_complete(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t
} else {
conn->llcp.cte_req.is_enabled = 0U;
lp_comm_ntf(conn, ctx);
ull_cp_cte_req_set_disable(conn);
}
} else if (ctx->response_opcode == PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND &&
ctx->reject_ext_ind.reject_opcode == PDU_DATA_LLCTRL_TYPE_CTE_REQ) {