From 105a85cdf5d751eba34f01855fdae144d0f5af24 Mon Sep 17 00:00:00 2001 From: Piotr Pryga Date: Thu, 22 Apr 2021 11:10:43 +0200 Subject: [PATCH] Bluetooth: host: Add CTE reports receive cb API for per sync Add new callback to periodic advertising sync callback. The callback may be used to receive notification about CTE reports in connectionless mode (periodic advetising sync). Signed-off-by: Piotr Pryga --- include/bluetooth/bluetooth.h | 13 +++++++++++++ include/bluetooth/direction.h | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/include/bluetooth/bluetooth.h b/include/bluetooth/bluetooth.h index 13e363ca53c..5ad323ed22d 100644 --- a/include/bluetooth/bluetooth.h +++ b/include/bluetooth/bluetooth.h @@ -57,6 +57,9 @@ struct bt_conn; /* Don't require everyone to include iso.h */ struct bt_iso_biginfo; +/* Don't require everyone to include direction.h */ +struct bt_df_per_adv_sync_iq_samples_report; + struct bt_le_ext_adv_sent_info { /** The number of advertising events completed. */ uint8_t num_sent; @@ -1243,6 +1246,16 @@ struct bt_le_per_adv_sync_cb { */ void (*biginfo)(struct bt_le_per_adv_sync *sync, const struct bt_iso_biginfo *biginfo); + /** + * @brief Callback for IQ samples report collected when sampling + * CTE received with periodic advertising PDU. + * + * @param sync The periodic advertising sync object. + * @param info Information about the sync event. + */ + void (*cte_report_cb)(struct bt_le_per_adv_sync *sync, + struct bt_df_per_adv_sync_iq_samples_report const *info); + sys_snode_t node; }; diff --git a/include/bluetooth/direction.h b/include/bluetooth/direction.h index e275581c20b..4b535c420a3 100644 --- a/include/bluetooth/direction.h +++ b/include/bluetooth/direction.h @@ -88,6 +88,25 @@ struct bt_df_per_adv_sync_cte_rx_param { const uint8_t *ant_ids; }; +struct bt_df_per_adv_sync_iq_samples_report { + /** Channel index used to receive PDU with CTE that was sampled. */ + uint8_t chan_idx; + /** The RSSI of the PDU with CTE (excluding CTE). */ + int16_t rssi; + /** Id of antenna used to measure the RSSI. */ + uint8_t rssi_ant_id; + /** Type of CTE (@ref BT_DF_CTE_TYPE). */ + uint8_t cte_type; + /** Duration of slots when received CTE type is AoA (@ref BT_DF_ANTENNA_SWITCHING_SLOT). */ + uint8_t slot_durations; + /** Status of received PDU with CTE (@ref BT_DF_RX_POCKET_STATUS). */ + uint8_t packet_status; + /** Number of IQ samples in report. */ + uint8_t sample_count; + /** Pinter to IQ samples data. */ + struct bt_hci_le_iq_sample const *sample; +}; + /** * @brief Set or update the Constant Tone Extension parameters for periodic advertising set. *