Bluetooth: host: Refactor out scan roles from hci_core to scan

Refactor out the scan roles handling from hci_core.c to its own source
file in scan.c.
Scan roles consists of regular scanning and synchronization to
periodic advertiser.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2021-03-08 14:30:19 +01:00 committed by Johan Hedberg
commit be6797ed64
6 changed files with 1608 additions and 1561 deletions

View file

@ -36,6 +36,10 @@ if(CONFIG_BT_HCI_HOST)
hci_common.c hci_common.c
id.c id.c
) )
zephyr_library_sources_ifdef(
CONFIG_BT_OBSERVER
scan.c
)
zephyr_library_sources_ifdef( zephyr_library_sources_ifdef(
CONFIG_BT_HOST_CRYPTO CONFIG_BT_HOST_CRYPTO
crypto.c crypto.c

File diff suppressed because it is too large Load diff

View file

@ -342,6 +342,7 @@ bool bt_le_conn_params_valid(const struct bt_le_conn_param *param);
int bt_le_set_data_len(struct bt_conn *conn, uint16_t tx_octets, uint16_t tx_time); int bt_le_set_data_len(struct bt_conn *conn, uint16_t tx_octets, uint16_t tx_time);
int bt_le_set_phy(struct bt_conn *conn, uint8_t all_phys, int bt_le_set_phy(struct bt_conn *conn, uint8_t all_phys,
uint8_t pref_tx_phy, uint8_t pref_rx_phy, uint8_t phy_opts); uint8_t pref_tx_phy, uint8_t pref_rx_phy, uint8_t phy_opts);
uint8_t bt_get_phy(uint8_t hci_phy);
int bt_le_scan_update(bool fast_scan); int bt_le_scan_update(bool fast_scan);
@ -378,8 +379,6 @@ int bt_le_adv_set_enable(struct bt_le_ext_adv *adv, bool enable);
void bt_le_ext_adv_foreach(void (*func)(struct bt_le_ext_adv *adv, void *data), void bt_le_ext_adv_foreach(void (*func)(struct bt_le_ext_adv *adv, void *data),
void *data); void *data);
int bt_le_scan_set_enable(uint8_t enable);
void bt_hci_host_num_completed_packets(struct net_buf *buf); void bt_hci_host_num_completed_packets(struct net_buf *buf);
/* HCI event handlers */ /* HCI event handlers */
@ -397,3 +396,13 @@ void hci_evt_auth_complete(struct net_buf *buf);
/* ECC HCI event handlers */ /* ECC HCI event handlers */
void bt_hci_evt_le_pkey_complete(struct net_buf *buf); void bt_hci_evt_le_pkey_complete(struct net_buf *buf);
void bt_hci_evt_le_dhkey_complete(struct net_buf *buf); void bt_hci_evt_le_dhkey_complete(struct net_buf *buf);
/* Scan HCI event handlers */
void bt_hci_le_adv_report(struct net_buf *buf);
void bt_hci_le_scan_timeout(struct net_buf *buf);
void bt_hci_le_adv_ext_report(struct net_buf *buf);
void bt_hci_le_per_adv_sync_established(struct net_buf *buf);
void bt_hci_le_per_adv_report(struct net_buf *buf);
void bt_hci_le_per_adv_sync_lost(struct net_buf *buf);
void bt_hci_le_biginfo_adv_report(struct net_buf *buf);
void bt_hci_le_past_received(struct net_buf *buf);

View file

@ -13,6 +13,7 @@
#include "hci_core.h" #include "hci_core.h"
#include "id.h" #include "id.h"
#include "scan.h"
#include "smp.h" #include "smp.h"
#include "conn_internal.h" #include "conn_internal.h"
#include "keys.h" #include "keys.h"

1562
subsys/bluetooth/host/scan.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,12 @@
/*
* Copyright (c) 2017-2021 Nordic Semiconductor ASA
* Copyright (c) 2015-2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
void bt_scan_reset(void);
bool bt_id_scan_random_addr_check(void);
int bt_le_scan_set_enable(uint8_t enable);