Skip to content

Commit 0f89b4a

Browse files
jrintahajhedberg
authored andcommitted
tests: bluetooth: tester: add filter list flag to start discovery
Implement Start Discovery command Accept Filter List filtering. Add a flag to the command's flags field to enable filtering. Signed-off-by: Jori Rintahaka <[email protected]> Signed-off-by: Johan Hedberg <[email protected]>
1 parent 6f29739 commit 0f89b4a

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

tests/bluetooth/tester/src/btp/btp_gap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ struct btp_gap_stop_advertising_rp {
134134
#define BTP_GAP_DISCOVERY_FLAG_LE_ACTIVE_SCAN 0x08
135135
#define BTP_GAP_DISCOVERY_FLAG_LE_OBSERVE 0x10
136136
#define BTP_GAP_DISCOVERY_FLAG_OWN_ID_ADDR 0x20
137+
#define BTP_GAP_DISCOVERY_FLAG_USE_FILTER_LIST 0x40
137138

138139
#define BTP_GAP_START_DISCOVERY 0x0c
139140
struct btp_gap_start_discovery_cmd {

tests/bluetooth/tester/src/btp_gap.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,10 +1198,25 @@ static uint8_t start_discovery(const void *cmd, uint16_t cmd_len,
11981198
return br_start_discovery(cp);
11991199
}
12001200

1201-
/* Start LE scanning */
1202-
if (bt_le_scan_start(cp->flags & BTP_GAP_DISCOVERY_FLAG_LE_ACTIVE_SCAN ?
1203-
BT_LE_SCAN_ACTIVE : BT_LE_SCAN_PASSIVE,
1204-
device_found) < 0) {
1201+
struct bt_le_scan_param scan_param = {
1202+
.type = BT_LE_SCAN_TYPE_PASSIVE,
1203+
.options = BT_LE_SCAN_OPT_FILTER_DUPLICATE,
1204+
.interval = BT_GAP_SCAN_FAST_INTERVAL,
1205+
.window = BT_GAP_SCAN_FAST_WINDOW,
1206+
.timeout = 0,
1207+
.interval_coded = 0,
1208+
.window_coded = 0,
1209+
};
1210+
1211+
if (cp->flags & BTP_GAP_DISCOVERY_FLAG_LE_ACTIVE_SCAN) {
1212+
scan_param.type = BT_LE_SCAN_TYPE_ACTIVE;
1213+
}
1214+
1215+
if (cp->flags & BTP_GAP_DISCOVERY_FLAG_USE_FILTER_LIST) {
1216+
scan_param.options |= BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST;
1217+
}
1218+
1219+
if (bt_le_scan_start(&scan_param, device_found) < 0) {
12051220
LOG_ERR("Failed to start scanning");
12061221
return BTP_STATUS_FAILED;
12071222
}

0 commit comments

Comments
 (0)