Bluetooth: host: Refactor out advertiser roles from hci_core to adv

Refactor out the advertiser roles handling from hci_core.c to its own
source file in adv.c.
Advertising roles consists of legacy and extended advertiser, and
periodic advertiser.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2021-03-08 14:30:34 +01:00 committed by Johan Hedberg
commit 53cea4719d
7 changed files with 1671 additions and 1629 deletions

View file

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

1635
subsys/bluetooth/host/adv.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,21 @@
/*
* Copyright (c) 2017-2021 Nordic Semiconductor ASA
* Copyright (c) 2015-2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
void bt_le_adv_resume(void);
struct bt_le_ext_adv *bt_le_adv_lookup_legacy(void);
void bt_le_adv_delete_legacy(void);
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 *data);
int bt_le_adv_set_enable_ext(struct bt_le_ext_adv *adv,
bool enable,
const struct bt_le_ext_adv_start_param *param);
int bt_le_adv_set_enable_legacy(struct bt_le_ext_adv *adv, bool enable);

View file

@ -29,6 +29,7 @@
#include "hci_core.h"
#include "id.h"
#include "adv.h"
#include "conn_internal.h"
#include "l2cap_internal.h"
#include "keys.h"

File diff suppressed because it is too large Load diff

View file

@ -364,21 +364,6 @@ void bt_setup_public_id_addr(void);
void bt_finalize_init(void);
int bt_le_adv_start_internal(const struct bt_le_adv_param *param,
const struct bt_data *ad, size_t ad_len,
const struct bt_data *sd, size_t sd_len,
const bt_addr_le_t *peer);
void bt_le_adv_resume(void);
int bt_le_adv_set_enable_legacy(struct bt_le_ext_adv *adv, bool enable);
int bt_le_adv_set_enable_ext(struct bt_le_ext_adv *adv,
bool enable,
const struct bt_le_ext_adv_start_param *param);
struct bt_le_ext_adv *bt_le_adv_lookup_legacy(void);
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 *data);
void bt_hci_host_num_completed_packets(struct net_buf *buf);
/* HCI event handlers */
@ -406,3 +391,7 @@ 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);
/* Adv HCI event handlers */
void bt_hci_le_adv_set_terminated(struct net_buf *buf);
void bt_hci_le_scan_req_received(struct net_buf *buf);

View file

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