28#include <zephyr/types.h>
29#include <zephyr/sys/slist.h>
30#include <zephyr/bluetooth/bluetooth.h>
31#include <zephyr/bluetooth/uuid.h>
32#include <zephyr/bluetooth/conn.h>
44#define BT_SCAN_NAME_FILTER 0x01
47#define BT_SCAN_ADDR_FILTER 0x02
50#define BT_SCAN_UUID_FILTER 0x04
53#define BT_SCAN_APPEARANCE_FILTER 0x08
56#define BT_SCAN_SHORT_NAME_FILTER 0x10
59#define BT_SCAN_MANUFACTURER_DATA_FILTER 0x20
62#define BT_SCAN_ALL_FILTER 0x3F
223 const struct bt_uuid *
uuid[CONFIG_BT_SCAN_UUID_CNT];
314#define BT_SCAN_CB_INIT(_name, \
319 static const struct cb_data _name ## _data = { \
320 .filter_match = match_fun, \
321 .filter_no_match = no_match_fun, \
322 .connecting_error = error_fun, \
323 .connecting = connecting_fun, \
325 static struct bt_scan_cb _name = { \
326 .cb_addr = &_name ## _data, \
329#define BT_SCAN_CB_INIT(_name, \
334 static const struct cb_data _name ## _data = { \
335 .filter_match = match_fun, \
336 .filter_no_match = no_match_fun, \
338 static struct bt_scan_cb _name = { \
339 .cb_addr = &_name ## _data, \
389 struct bt_conn *conn);
452#if CONFIG_BT_SCAN_FILTER_ENABLE
void bt_scan_filter_disable(void)
Function for disabling filtering.
bt_scan_filter_type
Types of filters.
Definition scan.h:78
@ BT_SCAN_FILTER_TYPE_APPEARANCE
Definition scan.h:92
@ BT_SCAN_FILTER_TYPE_SHORT_NAME
Definition scan.h:83
@ BT_SCAN_FILTER_TYPE_NAME
Definition scan.h:80
@ BT_SCAN_FILTER_TYPE_UUID
Definition scan.h:89
@ BT_SCAN_FILTER_TYPE_ADDR
Definition scan.h:86
@ BT_SCAN_FILTER_TYPE_MANUFACTURER_DATA
Definition scan.h:95
bt_scan_type
Scan types.
Definition scan.h:68
@ BT_SCAN_TYPE_SCAN_ACTIVE
Definition scan.h:73
@ BT_SCAN_TYPE_SCAN_PASSIVE
Definition scan.h:70
void bt_scan_update_init_conn_params(struct bt_le_conn_param *new_conn_param)
Function to update initial connection parameters.
int bt_scan_params_set(struct bt_le_scan_param *scan_param)
Function for changing the scanning parameters.
int bt_scan_start(enum bt_scan_type scan_type)
Function for starting scanning.
int bt_scan_filter_enable(uint8_t mode, bool match_all)
Function for enabling filtering.
int bt_scan_filter_status_get(struct bt_filter_status *status)
Function for getting filter status.
int bt_scan_blocklist_device_add(const bt_addr_le_t *addr)
Add a new device to the blocklist.
void bt_scan_blocklist_clear(void)
Clear the blocklist of the scanning module device.
void bt_scan_cb_register(struct bt_scan_cb *cb)
Register scanning callbacks.
int bt_scan_stop(void)
Function for stopping scanning.
void bt_scan_conn_attempts_filter_clear(void)
Clear connection attempts filter.
int bt_scan_filter_add(enum bt_scan_filter_type type, const void *data)
Function for adding any type of filter to the scanning.
void bt_scan_init(const struct bt_scan_init_param *init)
Function for initializing the Scanning Module.
void bt_scan_update_connect_if_match(bool connect_if_match)
Function to update the autoconnect flag after a filter match.
void bt_scan_filter_remove_all(void)
Function for removing all set filters.
struct bt_scan_filter_info manufacturer_data
Definition scan.h:133
struct bt_scan_filter_info addr
Definition scan.h:124
struct bt_scan_filter_info appearance
Definition scan.h:130
struct bt_scan_filter_info uuid
Definition scan.h:127
bool all_mode
Definition scan.h:115
struct bt_scan_filter_info short_name
Definition scan.h:121
struct bt_scan_filter_info name
Definition scan.h:118
Filter status structure.
Definition scan.h:113
bool match
Definition scan.h:209
const bt_addr_le_t * addr
Definition scan.h:212
Address filter status structure, used to inform the application which address filter is matched.
Definition scan.h:207
uint8_t adv_type
Definition scan.h:142
int8_t rssi
Definition scan.h:145
Advertising info structure.
Definition scan.h:138
const uint16_t * appearance
Definition scan.h:237
bool match
Definition scan.h:234
Appearance filter status structure, used to inform the application which appearance filter is matched...
Definition scan.h:232
const struct cb_data * cb_addr
Definition scan.h:405
sys_snode_t node
Definition scan.h:406
Scanning callback structure.
Definition scan.h:404
struct net_buf_simple * adv_data
Definition scan.h:298
const struct bt_le_scan_recv_info * recv_info
Definition scan.h:288
const struct bt_le_conn_param * conn_param
Definition scan.h:291
Structure containing device data needed to establish connection and advertising information.
Definition scan.h:286
bool enabled
Definition scan.h:105
uint8_t cnt
Definition scan.h:108
Filter information structure.
Definition scan.h:103
struct bt_scan_name_filter_status short_name
Definition scan.h:268
struct bt_scan_appearance_filter_status appearance
Definition scan.h:277
struct bt_scan_uuid_filter_status uuid
Definition scan.h:274
struct bt_scan_manufacturer_data_filter_status manufacturer_data
Definition scan.h:280
struct bt_scan_name_filter_status name
Definition scan.h:265
struct bt_scan_addr_filter_status addr
Definition scan.h:271
Structure for setting the filter status.
Definition scan.h:263
const struct bt_le_conn_param * conn_param
Definition scan.h:187
const struct bt_le_scan_param * scan_param
Definition scan.h:175
bool connect_if_match
Definition scan.h:181
Structure for Scanning Module initialization.
Definition scan.h:170
uint8_t len
Definition scan.h:251
const uint8_t * data
Definition scan.h:248
bool match
Definition scan.h:245
Manufacturer data filter status structure, used to inform the application which manufacturer data fil...
Definition scan.h:243
uint8_t data_len
Definition scan.h:165
uint8_t * data
Definition scan.h:162
A helper structure to set filters for the manufacturer data.
Definition scan.h:160
uint8_t len
Definition scan.h:201
bool match
Definition scan.h:195
const char * name
Definition scan.h:198
Name filter status structure, used to inform the application which name filter is matched.
Definition scan.h:193
uint8_t min_len
Definition scan.h:155
const char * name
Definition scan.h:152
A helper structure to set filters for the name.
Definition scan.h:150
uint8_t count
Definition scan.h:226
const struct bt_uuid * uuid[1]
Definition scan.h:223
bool match
Definition scan.h:220
UUID filter status structure, used to inform the application which UUID filters are matched.
Definition scan.h:218
void(* filter_match)(struct bt_scan_device_info *device_info, struct bt_scan_filter_match *filter_match, bool connectable)
Scan filter matched.
Definition scan.h:357
void(* connecting)(struct bt_scan_device_info *device_info, struct bt_conn *conn)
Connecting data.
Definition scan.h:388
void(* filter_no_match)(struct bt_scan_device_info *device_info, bool connectable)
Scan filter unmatched. The device was not found.
Definition scan.h:371
void(* connecting_error)(struct bt_scan_device_info *device_info)
Error when connecting.
Definition scan.h:380
Data for scanning callback structure.
Definition scan.h:349