Bluetooth: Use continuous scanning when initiating LE connections

Since we always do passive scanning and wait for a connectable
advertising event it makes sense to request continous scanning when we
issue the HCI_LE_Create_Connection. This way we minimize the risk of
loosing any advertising packets.

Change-Id: Ie314e15243aede00d1fb3be9532efb74518b293d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2015-11-30 13:12:39 +02:00 committed by Anas Nashif
commit 5e607f93b9

View file

@ -404,11 +404,14 @@ static int hci_le_create_conn(const bt_addr_le_t *addr)
cp = net_buf_add(buf, sizeof(*cp));
memset(cp, 0x0, sizeof(*cp));
/* Interval == window for continuous scanning */
cp->scan_interval = sys_cpu_to_le16(0x0060);
cp->scan_window = cp->scan_interval;
bt_addr_le_copy(&cp->peer_addr, addr);
cp->conn_interval_max = sys_cpu_to_le16(0x0028);
cp->conn_interval_min = sys_cpu_to_le16(0x0018);
cp->scan_interval = sys_cpu_to_le16(0x0060);
cp->scan_window = sys_cpu_to_le16(0x0030);
cp->supervision_timeout = sys_cpu_to_le16(0x07D0);
return bt_hci_cmd_send_sync(BT_HCI_OP_LE_CREATE_CONN, buf, NULL);