Bluetooth: host: Align usage of cte_type in DF host implementation

The CTE type is used in two ways by HCI layer:
1) single value representing particular CTE type: AoA, AoD 1 us,
  AoD 2 us
2) bit-filed where bits 0-2 represent particular CTE types AoA
  AoD 1 us, AoD 2 us

The bit-field is used to inform Controller about allowed types
of CTE, hence single value carries more than one value.
To avoid confusion between these use cases in code that refers
to case 1) all named cte_type (singular form). For case 2)
cte_types (plural form) is used.

There is an enumeration that is used for both cases:
bt_df_cte_type. For cte_type only single value from the
enumeration may be assigned to variable except
BT_DF_CTE_TYPE_NONE and BT_DF_CTE_TYPE_ALL.
For cte_types all enum members may be used. Ocasionally
BT_DF_CTE_TYPE_NONE may be excluded. If that is true,
it is described in code documentation.

Thanks to that applications are released from requirement
to include hci.h header file.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
This commit is contained in:
Piotr Pryga 2021-12-28 22:17:20 +01:00 committed by Carles Cufí
commit 3b5c1efc16
6 changed files with 53 additions and 35 deletions

View file

@ -61,7 +61,12 @@ enum bt_df_packet_status {
struct bt_df_adv_cte_tx_param {
/** Length of CTE in 8us units. */
uint8_t cte_len;
/** CTE Type: AoA, AoD 1us slots, AoD 2us slots. */
/**
* @brief CTE type.
*
* Allowed values are defined by @ref bt_df_cte_type, except BT_DF_CTE_TYPE_NONE and
* BT_DF_CTE_TYPE_ALL.
*/
uint8_t cte_type;
/** Number of CTE to transmit in each periodic adv interval. */
uint8_t cte_count;
@ -80,8 +85,12 @@ struct bt_df_adv_cte_tx_param {
* for correctness.
*/
struct bt_df_per_adv_sync_cte_rx_param {
/* Bitmap with allowed CTE types (@ref bt_df_cte_type). */
uint8_t cte_type;
/**
* @brief Bitfield with allowed CTE types.
*
* Allowed values are defined by @ref bt_df_cte_type, except BT_DF_CTE_TYPE_NONE.
*/
uint8_t cte_types;
/** Antenna switching slots (@ref bt_df_antenna_switching_slot). */
uint8_t slot_durations;
/** Max number of CTEs to receive. Min is 1, max is 10, 0 means receive continuously. */
@ -114,8 +123,12 @@ struct bt_df_per_adv_sync_iq_samples_report {
};
struct bt_df_conn_cte_rx_param {
/* Bitmap with allowed CTE types (@ref bt_df_cte_type). */
uint8_t cte_type;
/**
* @brief Bitfield with allowed CTE types.
*
* Allowed values are defined by @ref bt_df_cte_type, except BT_DF_CTE_TYPE_NONE.
*/
uint8_t cte_types;
/** Antenna switching slots (@ref bt_df_antenna_switching_slot). */
uint8_t slot_durations;
/** Length of antenna switch pattern. */