diff --git a/emulator/le.c b/emulator/le.c
index 6ffa0d4..82ae573 100644
--- a/emulator/le.c
+++ b/emulator/le.c
int adv_timeout_id;
int scan_timeout_id;
bool scan_window_active;
+ uint8_t scan_chan_idx;
uint8_t event_mask[16];
uint16_t manufacturer;
fprintf(stderr, "Write to /dev/vhci failed (%m)\n");
}
-static void send_adv_pkt(struct bt_le *hci)
+static void send_adv_pkt(struct bt_le *hci, uint8_t channel)
{
struct bt_phy_pkt_adv pkt;
memset(&pkt, 0, sizeof(pkt));
+ pkt.chan_idx = channel;
pkt.pdu_type = hci->le_adv_type;
pkt.tx_addr_type = hci->le_adv_own_addr_type;
switch (hci->le_adv_own_addr_type) {
struct bt_le *hci = user_data;
unsigned int msec, min_msec, max_msec;
- send_adv_pkt(hci);
+ if (hci->le_adv_channel_map & 0x01)
+ send_adv_pkt(hci, 37);
+ if (hci->le_adv_channel_map & 0x02)
+ send_adv_pkt(hci, 38);
+ if (hci->le_adv_channel_map & 0x04)
+ send_adv_pkt(hci, 39);
min_msec = (hci->le_adv_min_interval * 625) / 1000;
max_msec = (hci->le_adv_max_interval * 625) / 1000;
!hci->scan_window_active) {
msec = (hci->le_scan_window * 625) / 1000;
hci->scan_window_active = true;
+
+ hci->scan_chan_idx++;
+ if (hci->scan_chan_idx > 39)
+ hci->scan_chan_idx = 37;
} else {
msec = ((hci->le_scan_interval -
hci->le_scan_window) * 625) / 1000;
return false;
hci->scan_window_active = true;
+ hci->scan_chan_idx = 37;
return true;
}
struct bt_hci_evt_le_adv_report *evt = (void *) buf;
uint8_t tx_addr_type, tx_addr[6];
+ if (hci->scan_chan_idx != pkt->chan_idx)
+ break;
+
resolve_peer_addr(hci, pkt->tx_addr_type, pkt->tx_addr,
&tx_addr_type, tx_addr);
diff --git a/emulator/phy.h b/emulator/phy.h
index 9abfd68..d5efa51 100644
--- a/emulator/phy.h
+++ b/emulator/phy.h
#define BT_PHY_PKT_ADV 0x0001
struct bt_phy_pkt_adv {
+ uint8_t chan_idx;
uint8_t pdu_type;
uint8_t tx_addr_type;
uint8_t tx_addr[6];
#define BT_PHY_PKT_CONN 0x0002
struct bt_phy_pkt_conn {
+ uint8_t chan_idx;
uint8_t link_type;
uint8_t tx_addr_type;
uint8_t tx_addr[6];