From 21b56895cb60e4d68b9e79b44b18cdb79b747e8c Mon Sep 17 00:00:00 2001 From: Javier Date: Sat, 26 Jul 2014 17:54:59 +0200 Subject: reduce scanning duty cycle to allow for BT coex --- gatocentralmanager.cpp | 2 +- gatosocket.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gatocentralmanager.cpp b/gatocentralmanager.cpp index 0d3efd9..4e6458b 100644 --- a/gatocentralmanager.cpp +++ b/gatocentralmanager.cpp @@ -86,7 +86,7 @@ void GatoCentralManager::scanForPeripheralsWithServices(const QList &u hci_le_set_scan_enable(d->hci, 0, 0, d->timeout); rc = hci_le_set_scan_parameters(d->hci, scan_type, - htobs(0x0010), htobs(0x0010), + htobs(0x0100), htobs(0x0030), 0 /* Public address */, 0 /* No filter ? */, d->timeout); diff --git a/gatosocket.cpp b/gatosocket.cpp index c29b154..5d30c6f 100644 --- a/gatosocket.cpp +++ b/gatosocket.cpp @@ -20,8 +20,6 @@ #include -#include - #include #include #include @@ -167,7 +165,7 @@ void GatoSocket::writeNotify() int soerror = 0; socklen_t len = sizeof(soerror); if (::getsockopt(fd, SOL_SOCKET, SO_ERROR, &soerror, &len) != 0) { - // An error while reading the error? + // An error while reading the error qErrnoWarning("Could not get L2 socket options"); close(); return; @@ -180,6 +178,12 @@ void GatoSocket::writeNotify() s = StateConnected; emit connected(); + + bt_security bt_sec; + len = sizeof(bt_sec); + if (::getsockopt(fd, SOL_BLUETOOTH, BT_SECURITY, &bt_sec, &len) == 0) { + qDebug() << "Established a bluetooth channel with security level " << bt_sec.level; + } } else if (s == StateConnected) { if (!writeQueue.isEmpty()) { if (transmit(writeQueue.head())) { -- cgit v1.2.3