summaryrefslogtreecommitdiffstats
path: root/src/bluetooth
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-02-16 21:52:03 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-02-16 21:52:03 +0100
commiteef68dea35960670c1a1a1431d4541e1ed19c781 (patch)
tree097e6575b0cbc43704077d76372c986dcce3c998 /src/bluetooth
parentfa2389dd0a6df58d73d221654db36ff791b96e43 (diff)
parentc87458961f29064ab69a308526b0243debcdf1f7 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: .qmake.conf src/bluetooth/qlowenergycontroller_bluez.cpp Change-Id: I00f45a2a22a045e7836f2caeb76cc5599ced6279
Diffstat (limited to 'src/bluetooth')
-rw-r--r--src/bluetooth/android/inputstreamthread.cpp2
-rw-r--r--src/bluetooth/android/inputstreamthread_p.h2
-rw-r--r--src/bluetooth/bluez/hcimanager.cpp2
-rw-r--r--src/bluetooth/doc/src/bluetooth-index.qdoc26
-rw-r--r--src/bluetooth/qlowenergycontroller.cpp3
-rw-r--r--src/bluetooth/qlowenergycontroller_android.cpp4
-rw-r--r--src/bluetooth/qlowenergycontroller_bluez.cpp19
-rw-r--r--src/bluetooth/qlowenergycontroller_p.cpp4
-rw-r--r--src/bluetooth/qlowenergycontroller_p.h2
9 files changed, 59 insertions, 5 deletions
diff --git a/src/bluetooth/android/inputstreamthread.cpp b/src/bluetooth/android/inputstreamthread.cpp
index eef72230..ecd9218e 100644
--- a/src/bluetooth/android/inputstreamthread.cpp
+++ b/src/bluetooth/android/inputstreamthread.cpp
@@ -71,7 +71,7 @@ bool InputStreamThread::run()
return true;
}
-bool InputStreamThread::bytesAvailable() const
+qint64 InputStreamThread::bytesAvailable() const
{
QMutexLocker locker(&m_mutex);
return m_socket_p->buffer.size();
diff --git a/src/bluetooth/android/inputstreamthread_p.h b/src/bluetooth/android/inputstreamthread_p.h
index be8dcbb6..741333ac 100644
--- a/src/bluetooth/android/inputstreamthread_p.h
+++ b/src/bluetooth/android/inputstreamthread_p.h
@@ -67,7 +67,7 @@ class InputStreamThread : public QObject
public:
explicit InputStreamThread(QBluetoothSocketPrivate *socket_p);
- bool bytesAvailable() const;
+ qint64 bytesAvailable() const;
bool run();
qint64 readData(char *data, qint64 maxSize);
diff --git a/src/bluetooth/bluez/hcimanager.cpp b/src/bluetooth/bluez/hcimanager.cpp
index 35ce2184..cf2f2a0f 100644
--- a/src/bluetooth/bluez/hcimanager.cpp
+++ b/src/bluetooth/bluez/hcimanager.cpp
@@ -145,7 +145,7 @@ int HciManager::hciForAddress(const QBluetoothAddress &deviceAdapter)
int result = memcmp(&adapter, &devInfo.bdaddr, sizeof(bdaddr_t));
if (result == 0 || deviceAdapter.isNull()) // addresses match
- return devRequest->dev_id;
+ return devInfo.dev_id;
}
return -1;
diff --git a/src/bluetooth/doc/src/bluetooth-index.qdoc b/src/bluetooth/doc/src/bluetooth-index.qdoc
index 8e5f1d35..8ea4c7f9 100644
--- a/src/bluetooth/doc/src/bluetooth-index.qdoc
+++ b/src/bluetooth/doc/src/bluetooth-index.qdoc
@@ -75,6 +75,32 @@ import statement in your \c .qml file:
\li \l {Qt Bluetooth C++ Classes}{C++ Classes}
\endlist
+\section2 Logging Categories
+
+The \l QtBluetooth module exports the following
+\l {Configuring Categories}{logging categories}:
+
+\table
+\header
+ \li Logging Category
+ \li Description
+\row
+ \li qt.bluetooth
+ \li Enables logging of cross platform code path in QtBluetooth
+\row
+ \li qt.bluetooth.android
+ \li Enables logging of the Android implementation
+\row
+ \li qt.bluetooth.bluez
+ \li Enables logging of the BLuez/Linux implementation
+\row
+ \li qt.bluetooth.ios
+ \li Enables logging of the iOS implementation
+\row
+ \li qt.bluetooth.osx
+ \li Enables logging of the OS X implementation
+\endtable
+
\section2 Examples
\list
\li QML
diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp
index 838bbd0d..c39a797b 100644
--- a/src/bluetooth/qlowenergycontroller.cpp
+++ b/src/bluetooth/qlowenergycontroller.cpp
@@ -486,6 +486,7 @@ QLowEnergyController::QLowEnergyController(
d->remoteDevice = remoteDevice;
d->localAdapter = QBluetoothLocalDevice().address();
d->addressType = QLowEnergyController::PublicAddress;
+ d->init();
}
/*!
@@ -513,6 +514,7 @@ QLowEnergyController::QLowEnergyController(
d->localAdapter = QBluetoothLocalDevice().address();
d->addressType = QLowEnergyController::PublicAddress;
d->remoteName = remoteDeviceInfo.name();
+ d->init();
}
/*!
@@ -541,6 +543,7 @@ QLowEnergyController::QLowEnergyController(
d->role = CentralRole;
d->remoteDevice = remoteDevice;
d->localAdapter = localDevice;
+ d->init();
}
/*!
diff --git a/src/bluetooth/qlowenergycontroller_android.cpp b/src/bluetooth/qlowenergycontroller_android.cpp
index df3aaa54..f740abc7 100644
--- a/src/bluetooth/qlowenergycontroller_android.cpp
+++ b/src/bluetooth/qlowenergycontroller_android.cpp
@@ -58,6 +58,10 @@ QLowEnergyControllerPrivate::~QLowEnergyControllerPrivate()
{
}
+void QLowEnergyControllerPrivate::init()
+{
+}
+
void QLowEnergyControllerPrivate::connectToDevice()
{
// required to pass unit test on default backend
diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp
index 06586192..729847f9 100644
--- a/src/bluetooth/qlowenergycontroller_bluez.cpp
+++ b/src/bluetooth/qlowenergycontroller_bluez.cpp
@@ -263,7 +263,10 @@ QLowEnergyControllerPrivate::QLowEnergyControllerPrivate()
{
registerQLowEnergyControllerMetaType();
qRegisterMetaType<QList<QLowEnergyHandle> >();
+}
+void QLowEnergyControllerPrivate::init()
+{
hciManager = new HciManager(localAdapter, this);
if (!hciManager->isValid())
return;
@@ -602,7 +605,12 @@ void QLowEnergyControllerPrivate::l2cpReadyRead()
break;
}
- Q_ASSERT(!openRequests.isEmpty());
+ if (openRequests.isEmpty()) {
+ qCWarning(QT_BT_BLUEZ) << "Received unexpected packet from peer, disconnecting.";
+ disconnectFromDevice();
+ return;
+ }
+
const Request request = openRequests.dequeue();
processReply(request, incomingPacket);
@@ -1074,7 +1082,14 @@ void QLowEnergyControllerPrivate::processReply(
Q_ASSERT(!p.isNull());
if (isErrorResponse) {
- readServiceValues(p->uuid, false); //read descriptor values
+ if (keys.count() == 1) {
+ // no more descriptors to discover
+ readServiceValues(p->uuid, false); //read descriptor values
+ } else {
+ // hop to the next descriptor
+ keys.removeFirst();
+ discoverNextDescriptor(p, keys, keys.first());
+ }
break;
}
diff --git a/src/bluetooth/qlowenergycontroller_p.cpp b/src/bluetooth/qlowenergycontroller_p.cpp
index eae0a43c..b4bd9a0f 100644
--- a/src/bluetooth/qlowenergycontroller_p.cpp
+++ b/src/bluetooth/qlowenergycontroller_p.cpp
@@ -54,6 +54,10 @@ QLowEnergyControllerPrivate::~QLowEnergyControllerPrivate()
{
}
+void QLowEnergyControllerPrivate::init()
+{
+}
+
void QLowEnergyControllerPrivate::connectToDevice()
{
// required to pass unit test on default backend
diff --git a/src/bluetooth/qlowenergycontroller_p.h b/src/bluetooth/qlowenergycontroller_p.h
index 51ea5a83..6e231dd1 100644
--- a/src/bluetooth/qlowenergycontroller_p.h
+++ b/src/bluetooth/qlowenergycontroller_p.h
@@ -111,6 +111,8 @@ public:
QLowEnergyControllerPrivate();
~QLowEnergyControllerPrivate();
+ void init();
+
void setError(QLowEnergyController::Error newError);
bool isValidLocalAdapter();