summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-06 09:16:02 +0200
committerLiang Qi <liang.qi@qt.io>2016-05-06 09:16:02 +0200
commitcaded2edf69e8a60897653ace1e10b72199c7427 (patch)
tree1b28cd7578195ca3d7e14c83ccf181adbe2476ec
parent9677182c07b22f5f1f4fdff3f1fce6a28f76b662 (diff)
parent54c9cd9e28bc6f0a2fa5118cfdbe922d71db6623 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: examples/nfc/corkboard/corkboard.pro Change-Id: I5d1ea0a8e21a1b55dbf744c2f4b469bc51f05c7a
-rw-r--r--examples/bluetooth/chat/chat.pro3
-rw-r--r--examples/bluetooth/picturetransfer/picturetransfer.pro5
-rw-r--r--examples/nfc/annotatedurl/annotatedurl.cpp4
-rw-r--r--examples/nfc/corkboard/corkboard.pro11
-rw-r--r--examples/nfc/ndefeditor/textrecord.ui21
-rw-r--r--src/bluetooth/bluetooth.pro6
-rw-r--r--src/bluetooth/dummy/dummy.pri2
-rw-r--r--src/bluetooth/dummy/dummy_helper.cpp53
-rw-r--r--src/bluetooth/dummy/dummy_helper_p.h56
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent.cpp2
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp3
-rw-r--r--src/bluetooth/qbluetoothlocaldevice.cpp4
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_p.cpp2
-rw-r--r--src/bluetooth/qbluetoothserver_p.cpp2
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent.cpp7
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_p.cpp2
-rw-r--r--src/bluetooth/qbluetoothserviceinfo.cpp54
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_p.cpp2
-rw-r--r--src/bluetooth/qbluetoothsocket.cpp12
-rw-r--r--src/bluetooth/qbluetoothsocket_p.cpp2
-rw-r--r--src/bluetooth/qbluetoothtransfermanager.cpp6
-rw-r--r--src/bluetooth/qbluetoothuuid.cpp9
-rw-r--r--src/bluetooth/qlowenergycontroller_p.cpp2
-rw-r--r--src/nfc/qnearfieldmanager.h4
-rw-r--r--src/nfc/qnearfieldmanager_android.cpp5
-rw-r--r--src/nfc/qnearfieldtarget_android.cpp9
-rw-r--r--src/nfc/qnearfieldtarget_android_p.h2
-rw-r--r--tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp3
-rw-r--r--tests/bttestui/btlocaldevice.cpp2
29 files changed, 224 insertions, 71 deletions
diff --git a/examples/bluetooth/chat/chat.pro b/examples/bluetooth/chat/chat.pro
index 5cf6ab9f..7bc5c8bd 100644
--- a/examples/bluetooth/chat/chat.pro
+++ b/examples/bluetooth/chat/chat.pro
@@ -14,3 +14,6 @@ OTHER_FILES += \
Button.qml
#DEFINES += QMLJSDEBUGGER
+
+target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/chat
+INSTALLS += target
diff --git a/examples/bluetooth/picturetransfer/picturetransfer.pro b/examples/bluetooth/picturetransfer/picturetransfer.pro
index 0eee46a2..077673e9 100644
--- a/examples/bluetooth/picturetransfer/picturetransfer.pro
+++ b/examples/bluetooth/picturetransfer/picturetransfer.pro
@@ -21,5 +21,8 @@ SOURCES += \
filetransfer.cpp \
main.cpp
+target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/picturetransfer
+INSTALLS += target
-
+EXAMPLE_FILES += \
+ icon.png
diff --git a/examples/nfc/annotatedurl/annotatedurl.cpp b/examples/nfc/annotatedurl/annotatedurl.cpp
index cf7dd17a..a07aadcc 100644
--- a/examples/nfc/annotatedurl/annotatedurl.cpp
+++ b/examples/nfc/annotatedurl/annotatedurl.cpp
@@ -77,8 +77,8 @@ AnnotatedUrl::AnnotatedUrl(QObject *parent)
SLOT(handleMessage(QNdefMessage,QNearFieldTarget*)));
//! [QNearFieldManager register handler]
- if (result != -1)
- return;
+ if (result < 0)
+ qWarning() << "Platform does not support NDEF message handler registration";
manager->startTargetDetection();
connect(manager, SIGNAL(targetDetected(QNearFieldTarget*)),
diff --git a/examples/nfc/corkboard/corkboard.pro b/examples/nfc/corkboard/corkboard.pro
index 93142568..9d1de4b3 100644
--- a/examples/nfc/corkboard/corkboard.pro
+++ b/examples/nfc/corkboard/corkboard.pro
@@ -13,9 +13,10 @@ OTHER_FILES += \
corkboards.qml \
Mode.qml
-android {
-OTHER_FILES += \
- android/AndroidManifest.xml
-
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
-}
+
+target.path = $$[QT_INSTALL_EXAMPLES]/nfc/corkboard
+INSTALLS += target
+
+EXAMPLE_FILES += \
+ icon.png
diff --git a/examples/nfc/ndefeditor/textrecord.ui b/examples/nfc/ndefeditor/textrecord.ui
deleted file mode 100644
index eedd2d83..00000000
--- a/examples/nfc/ndefeditor/textrecord.ui
+++ /dev/null
@@ -1,21 +0,0 @@
-<ui version="4.0">
- <author/>
- <comment/>
- <exportmacro/>
- <class>TextRecord</class>
- <widget class="QWidget" name="TextRecord">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- </widget>
- <pixmapfunction/>
- <connections/>
-</ui>
diff --git a/src/bluetooth/bluetooth.pro b/src/bluetooth/bluetooth.pro
index a5d6aebe..a614516f 100644
--- a/src/bluetooth/bluetooth.pro
+++ b/src/bluetooth/bluetooth.pro
@@ -120,7 +120,8 @@ config_bluez:qtHaveModule(dbus) {
ANDROID_PERMISSIONS = \
android.permission.BLUETOOTH \
- android.permission.BLUETOOTH_ADMIN
+ android.permission.BLUETOOTH_ADMIN \
+ android.permission.ACCESS_COARSE_LOCATION # since Android 6.0 (API lvl 23)
ANDROID_BUNDLED_JAR_DEPENDENCIES = \
jar/QtAndroidBluetooth-bundled.jar:org.qtproject.qt5.android.bluetooth.QtBluetoothBroadcastReceiver
ANDROID_JAR_DEPENDENCIES = \
@@ -199,7 +200,8 @@ config_bluez:qtHaveModule(dbus) {
SOURCES -= qlowenergycontroller.cpp
} else {
message("Unsupported Bluetooth platform, will not build a working QtBluetooth library.")
- message("Either no Qt D-Bus found or no BlueZ headers.")
+ message("Either no Qt D-Bus found or no BlueZ headers available.")
+ include(dummy/dummy.pri)
SOURCES += \
qbluetoothdevicediscoveryagent_p.cpp \
qbluetoothlocaldevice_p.cpp \
diff --git a/src/bluetooth/dummy/dummy.pri b/src/bluetooth/dummy/dummy.pri
new file mode 100644
index 00000000..49aa076c
--- /dev/null
+++ b/src/bluetooth/dummy/dummy.pri
@@ -0,0 +1,2 @@
+HEADERS += dummy/dummy_helper_p.h
+SOURCES += dummy/dummy_helper.cpp
diff --git a/src/bluetooth/dummy/dummy_helper.cpp b/src/bluetooth/dummy/dummy_helper.cpp
new file mode 100644
index 00000000..fc78ea2f
--- /dev/null
+++ b/src/bluetooth/dummy/dummy_helper.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QGlobalStatic>
+#include <QtCore/QLoggingCategory>
+
+#include "dummy_helper_p.h"
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(QT_BT)
+
+Q_GLOBAL_STATIC_WITH_ARGS(bool, dummyWarningPrinted, (false))
+
+void printDummyWarning()
+{
+ if (!*dummyWarningPrinted()) {
+ qCWarning(QT_BT) << "Dummy backend running. Qt Bluetooth module is non-functional.";
+ *dummyWarningPrinted() = true;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/bluetooth/dummy/dummy_helper_p.h b/src/bluetooth/dummy/dummy_helper_p.h
new file mode 100644
index 00000000..f548ac36
--- /dev/null
+++ b/src/bluetooth/dummy/dummy_helper_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DUMMY_HELPER_H
+#define DUMMY_HELPER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "QtCore/qglobal.h"
+
+QT_BEGIN_NAMESPACE
+
+void printDummyWarning();
+
+QT_END_NAMESPACE
+
+#endif // DUMMY_HELPER_H
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent.cpp
index 6558a8f7..b6faee75 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent.cpp
@@ -70,6 +70,8 @@ QT_BEGIN_NAMESPACE
of devices. However not every platform can detect both types of devices.
On platforms with this limitation (for example iOS only suports Low Energy discovery),
the discovery process will limit the search to the type which is supported.
+
+ \note Since Android 6.0 the ability to detect devices requires ACCESS_COARSE_LOCATION.
*/
/*!
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp
index a232482f..09076d6d 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp
@@ -42,6 +42,8 @@
#include "qbluetoothaddress.h"
#include "qbluetoothuuid.h"
+#include "dummy/dummy_helper_p.h"
+
#define QT_DEVICEDISCOVERY_DEBUG
QT_BEGIN_NAMESPACE
@@ -54,6 +56,7 @@ QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate(
q_ptr(parent)
{
Q_UNUSED(deviceAdapter);
+ printDummyWarning();
}
QBluetoothDeviceDiscoveryAgentPrivate::~QBluetoothDeviceDiscoveryAgentPrivate()
diff --git a/src/bluetooth/qbluetoothlocaldevice.cpp b/src/bluetooth/qbluetoothlocaldevice.cpp
index 85177cf3..b2e2adcf 100644
--- a/src/bluetooth/qbluetoothlocaldevice.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice.cpp
@@ -175,6 +175,10 @@ bool QBluetoothLocalDevice::isValid() const
\fn QBluetoothLocalDevice::address() const
Returns the MAC address of this Bluetooth device.
+
+ \note On Android, this function always returns the constant
+ value \c {02:00:00:00:00:00} as local address starting with Android 6.0.
+ The programmatic access to the device's local MAC address was removed.
*/
/*!
diff --git a/src/bluetooth/qbluetoothlocaldevice_p.cpp b/src/bluetooth/qbluetoothlocaldevice_p.cpp
index b54027ef..efeeee5d 100644
--- a/src/bluetooth/qbluetoothlocaldevice_p.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice_p.cpp
@@ -41,6 +41,7 @@
#include "qbluetoothaddress.h"
#include "qbluetoothlocaldevice_p.h"
+#include "dummy/dummy_helper_p.h"
QT_BEGIN_NAMESPACE
@@ -48,6 +49,7 @@ QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) :
QObject(parent),
d_ptr(0)
{
+ printDummyWarning();
registerQBluetoothLocalDeviceMetaType();
}
diff --git a/src/bluetooth/qbluetoothserver_p.cpp b/src/bluetooth/qbluetoothserver_p.cpp
index 43d7fe9f..e12598fa 100644
--- a/src/bluetooth/qbluetoothserver_p.cpp
+++ b/src/bluetooth/qbluetoothserver_p.cpp
@@ -40,12 +40,14 @@
#include "qbluetoothserver.h"
#include "qbluetoothserver_p.h"
#include "qbluetoothsocket.h"
+#include "dummy/dummy_helper_p.h"
QT_BEGIN_NAMESPACE
QBluetoothServerPrivate::QBluetoothServerPrivate(QBluetoothServiceInfo::Protocol sType)
: maxPendingConnections(1), serverType(sType), m_lastError(QBluetoothServer::NoError)
{
+ printDummyWarning();
if (sType == QBluetoothServiceInfo::RfcommProtocol)
socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
else
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.cpp b/src/bluetooth/qbluetoothservicediscoveryagent.cpp
index a3df47de..fa1aba9d 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent.cpp
@@ -217,7 +217,9 @@ QList<QBluetoothServiceInfo> QBluetoothServiceDiscoveryAgent::discoveredServices
}
/*!
Sets the UUID filter to \a uuids. Only services matching the UUIDs in \a uuids will be
- returned.
+ returned. The matching applies to the service's
+ \l {QBluetoothServiceInfo::ServiceId}{ServiceId} and \l {QBluetoothServiceInfo::ServiceClassIds} {ServiceClassIds}
+ attributes.
An empty UUID list is equivalent to a list containing only QBluetoothUuid::PublicBrowseGroup.
@@ -234,6 +236,9 @@ void QBluetoothServiceDiscoveryAgent::setUuidFilter(const QList<QBluetoothUuid>
This is an overloaded member function, provided for convenience.
Sets the UUID filter to a list containing the single element \a uuid.
+ The matching applies to the service's \l {QBluetoothServiceInfo::ServiceId}{ServiceId}
+ and \l {QBluetoothServiceInfo::ServiceClassIds} {ServiceClassIds}
+ attributes.
\sa uuidFilter()
*/
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_p.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_p.cpp
index f7e09957..fe3fd75f 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_p.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_p.cpp
@@ -39,6 +39,7 @@
#include "qbluetoothservicediscoveryagent.h"
#include "qbluetoothservicediscoveryagent_p.h"
+#include "dummy/dummy_helper_p.h"
QT_BEGIN_NAMESPACE
@@ -47,6 +48,7 @@ QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate(c
deviceDiscoveryAgent(0), mode(QBluetoothServiceDiscoveryAgent::MinimalDiscovery),
singleDevice(false)
{
+ printDummyWarning();
Q_UNUSED(deviceAdapter);
}
diff --git a/src/bluetooth/qbluetoothserviceinfo.cpp b/src/bluetooth/qbluetoothserviceinfo.cpp
index 4ff028b7..d2920d78 100644
--- a/src/bluetooth/qbluetoothserviceinfo.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo.cpp
@@ -543,81 +543,89 @@ QBluetoothServiceInfo &QBluetoothServiceInfo::operator=(const QBluetoothServiceI
return *this;
}
-static void dumpAttributeVariant(const QVariant &var, const QString indent)
+static void dumpAttributeVariant(QDebug dbg, const QVariant &var, const QString& indent)
{
switch (int(var.type())) {
case QMetaType::Void:
- qDebug("%sEmpty", indent.toLocal8Bit().constData());
+ dbg << QString::asprintf("%sEmpty\n", indent.toUtf8().constData());
break;
case QMetaType::UChar:
- qDebug("%suchar %u", indent.toLocal8Bit().constData(), var.toUInt());
+ dbg << QString::asprintf("%suchar %u\n", indent.toUtf8().constData(), var.toUInt());
break;
case QMetaType::UShort:
- qDebug("%sushort %u", indent.toLocal8Bit().constData(), var.toUInt());
+ dbg << QString::asprintf("%sushort %u\n", indent.toUtf8().constData(), var.toUInt());
break;
case QMetaType::UInt:
- qDebug("%suint %u", indent.toLocal8Bit().constData(), var.toUInt());
+ dbg << QString::asprintf("%suint %u\n", indent.toUtf8().constData(), var.toUInt());
break;
case QMetaType::Char:
- qDebug("%schar %d", indent.toLocal8Bit().constData(), var.toInt());
+ dbg << QString::asprintf("%schar %d\n", indent.toUtf8().constData(), var.toInt());
break;
case QMetaType::Short:
- qDebug("%sshort %d", indent.toLocal8Bit().constData(), var.toInt());
+ dbg << QString::asprintf("%sshort %d\n", indent.toUtf8().constData(), var.toInt());
break;
case QMetaType::Int:
- qDebug("%sint %d", indent.toLocal8Bit().constData(), var.toInt());
+ dbg << QString::asprintf("%sint %d\n", indent.toUtf8().constData(), var.toInt());
break;
case QMetaType::QString:
- qDebug("%sstring %s", indent.toLocal8Bit().constData(), var.toString().toLocal8Bit().constData());
+ dbg << QString::asprintf("%sstring %s\n", indent.toUtf8().constData(),
+ var.toString().toUtf8().constData());
break;
case QMetaType::Bool:
- qDebug("%sbool %d", indent.toLocal8Bit().constData(), var.toBool());
+ dbg << QString::asprintf("%sbool %d\n", indent.toUtf8().constData(), var.toBool());
break;
case QMetaType::QUrl:
- qDebug("%surl %s", indent.toLocal8Bit().constData(), var.toUrl().toString().toLocal8Bit().constData());
+ dbg << QString::asprintf("%surl %s\n", indent.toUtf8().constData(),
+ var.toUrl().toString().toUtf8().constData());
break;
case QVariant::UserType:
if (var.userType() == qMetaTypeId<QBluetoothUuid>()) {
QBluetoothUuid uuid = var.value<QBluetoothUuid>();
switch (uuid.minimumSize()) {
case 0:
- qDebug("%suuid NULL", indent.toLocal8Bit().constData());
+ dbg << QString::asprintf("%suuid NULL\n", indent.toUtf8().constData());
break;
case 2:
- qDebug("%suuid %04x", indent.toLocal8Bit().constData(), uuid.toUInt16());
+ dbg << QString::asprintf("%suuid2 %04x\n", indent.toUtf8().constData(),
+ uuid.toUInt16());
break;
case 4:
- qDebug("%suuid %08x", indent.toLocal8Bit().constData(), uuid.toUInt32());
+ dbg << QString::asprintf("%suuid %08x\n", indent.toUtf8().constData(),
+ uuid.toUInt32());
break;
case 16:
- qDebug("%suuid %s", indent.toLocal8Bit().constData(), QByteArray(reinterpret_cast<const char *>(uuid.toUInt128().data), 16).toHex().constData());
+ dbg << QString::asprintf("%suuid %s\n",
+ indent.toUtf8().constData(),
+ QByteArray(reinterpret_cast<const char *>(uuid.toUInt128().data), 16).toHex().constData());
break;
default:
- qDebug("%suuid ???", indent.toLocal8Bit().constData());
- ;
+ dbg << QString::asprintf("%suuid ???\n", indent.toUtf8().constData());
}
} else if (var.userType() == qMetaTypeId<QBluetoothServiceInfo::Sequence>()) {
- qDebug("%sSequence", indent.toLocal8Bit().constData());
+ dbg << QString::asprintf("%sSequence\n", indent.toUtf8().constData());
const QBluetoothServiceInfo::Sequence *sequence = static_cast<const QBluetoothServiceInfo::Sequence *>(var.data());
foreach (const QVariant &v, *sequence)
- dumpAttributeVariant(v, indent + QLatin1Char('\t'));
+ dumpAttributeVariant(dbg, v, indent + QLatin1Char('\t'));
} else if (var.userType() == qMetaTypeId<QBluetoothServiceInfo::Alternative>()) {
- qDebug("%sAlternative", indent.toLocal8Bit().constData());
+ dbg << QString::asprintf("%sAlternative\n", indent.toUtf8().constData());
const QBluetoothServiceInfo::Alternative *alternative = static_cast<const QBluetoothServiceInfo::Alternative *>(var.data());
foreach (const QVariant &v, *alternative)
- dumpAttributeVariant(v, indent + QLatin1Char('\t'));
+ dumpAttributeVariant(dbg, v, indent + QLatin1Char('\t'));
}
break;
default:
- qDebug("%sunknown variant type %d", indent.toLocal8Bit().constData(), var.userType());
+ dbg << QString::asprintf("%sunknown variant type %d\n", indent.toUtf8().constData(),
+ var.userType());
}
}
QDebug operator<<(QDebug dbg, const QBluetoothServiceInfo &info)
{
+ QDebugStateSaver saver(dbg);
+ dbg.noquote() << "\n";
foreach (quint16 id, info.attributes()) {
- dumpAttributeVariant(info.attribute(id), QString::fromLatin1("(%1)\t").arg(id));
+ dumpAttributeVariant(dbg, info.attribute(id), QString::fromLatin1("(%1)\t").arg(id));
}
return dbg;
}
diff --git a/src/bluetooth/qbluetoothserviceinfo_p.cpp b/src/bluetooth/qbluetoothserviceinfo_p.cpp
index 716876be..00e38ba2 100644
--- a/src/bluetooth/qbluetoothserviceinfo_p.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo_p.cpp
@@ -39,11 +39,13 @@
#include "qbluetoothserviceinfo.h"
#include "qbluetoothserviceinfo_p.h"
+#include "dummy/dummy_helper_p.h"
QT_BEGIN_NAMESPACE
QBluetoothServiceInfoPrivate::QBluetoothServiceInfoPrivate()
{
+ printDummyWarning();
}
QBluetoothServiceInfoPrivate::~QBluetoothServiceInfoPrivate()
diff --git a/src/bluetooth/qbluetoothsocket.cpp b/src/bluetooth/qbluetoothsocket.cpp
index bb8e6512..8504ebd9 100644
--- a/src/bluetooth/qbluetoothsocket.cpp
+++ b/src/bluetooth/qbluetoothsocket.cpp
@@ -354,7 +354,8 @@ void QBluetoothSocket::connectToService(const QBluetoothServiceInfo &service, Op
d->connectToService(service.device().address(), service.serverChannel(), openMode);
} else {
// try doing service discovery to see if we can find the socket
- if(service.serviceUuid().isNull()){
+ if (service.serviceUuid().isNull()
+ && !service.serviceClassUuids().contains(QBluetoothUuid::SerialPort)) {
qCWarning(QT_BT) << "No port, no PSM, and no UUID provided, unable to connect";
return;
}
@@ -599,7 +600,7 @@ void QBluetoothSocket::doDeviceDiscovery(const QBluetoothServiceInfo &service, O
Q_D(QBluetoothSocket);
setSocketState(QBluetoothSocket::ServiceLookupState);
- qCDebug(QT_BT) << "Starting discovery";
+ qCDebug(QT_BT) << "Starting Bluetooth Socket discovery";
if(d->discoveryAgent) {
d->discoveryAgent->stop();
@@ -616,11 +617,12 @@ void QBluetoothSocket::doDeviceDiscovery(const QBluetoothServiceInfo &service, O
d->openMode = openMode;
+ QList<QBluetoothUuid> filterUuids = service.serviceClassUuids();
if(!service.serviceUuid().isNull())
- d->discoveryAgent->setUuidFilter(service.serviceUuid());
+ filterUuids.append(service.serviceUuid());
- if(!service.serviceClassUuids().isEmpty())
- d->discoveryAgent->setUuidFilter(service.serviceClassUuids());
+ if (!filterUuids.isEmpty())
+ d->discoveryAgent->setUuidFilter(filterUuids);
// we have to ID the service somehow
Q_ASSERT(!d->discoveryAgent->uuidFilter().isEmpty());
diff --git a/src/bluetooth/qbluetoothsocket_p.cpp b/src/bluetooth/qbluetoothsocket_p.cpp
index c05846c3..f61f3d87 100644
--- a/src/bluetooth/qbluetoothsocket_p.cpp
+++ b/src/bluetooth/qbluetoothsocket_p.cpp
@@ -39,6 +39,7 @@
#include "qbluetoothsocket.h"
#include "qbluetoothsocket_p.h"
+#include "dummy/dummy_helper_p.h"
QT_BEGIN_NAMESPACE
@@ -49,6 +50,7 @@ QBluetoothSocketPrivate::QBluetoothSocketPrivate()
socketError(QBluetoothSocket::NoSocketError),
secFlags(QBluetooth::NoSecurity)
{
+ printDummyWarning();
}
QBluetoothSocketPrivate::~QBluetoothSocketPrivate()
diff --git a/src/bluetooth/qbluetoothtransfermanager.cpp b/src/bluetooth/qbluetoothtransfermanager.cpp
index 34d972f0..f4720564 100644
--- a/src/bluetooth/qbluetoothtransfermanager.cpp
+++ b/src/bluetooth/qbluetoothtransfermanager.cpp
@@ -44,6 +44,8 @@
#include "qbluetoothtransferreply_bluez_p.h"
#elif QT_OSX_BLUETOOTH
#include "qbluetoothtransferreply_osx_p.h"
+#else
+#include "dummy/dummy_helper_p.h"
#endif
QT_BEGIN_NAMESPACE
@@ -117,6 +119,10 @@ QBluetoothTransferReply *QBluetoothTransferManager::put(const QBluetoothTransfer
connect(reply, SIGNAL(finished(QBluetoothTransferReply*)), this, SIGNAL(finished(QBluetoothTransferReply*)));
return reply;
#else
+ // Android and iOS have no implementation
+#if !defined(QT_ANDROID_BLUETOOTH) && !defined(QT_IOS_BLUETOOTH)
+ printDummyWarning();
+#endif
Q_UNUSED(request);
Q_UNUSED(data);
return 0;
diff --git a/src/bluetooth/qbluetoothuuid.cpp b/src/bluetooth/qbluetoothuuid.cpp
index 3d9ab504..bc00aa95 100644
--- a/src/bluetooth/qbluetoothuuid.cpp
+++ b/src/bluetooth/qbluetoothuuid.cpp
@@ -608,9 +608,12 @@ QT_WARNING_POP
}
/*!
- Constructs a new Bluetooth UUID from the \a uuid string.
-
- The string must be in the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
+ Creates a QBluetoothUuid object from the string \a uuid,
+ which must be formatted as five hex fields separated by '-',
+ e.g., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex digit.
+ The curly braces shown here are optional, but it is normal to include them.
+ If the conversion fails, a null UUID is created. See \l QUuid::toString() for an
+ explanation of how the five hex fields map to the public data members in QUuid.
*/
QBluetoothUuid::QBluetoothUuid(const QString &uuid)
: QUuid(uuid)
diff --git a/src/bluetooth/qlowenergycontroller_p.cpp b/src/bluetooth/qlowenergycontroller_p.cpp
index 6d42984e..149b6adf 100644
--- a/src/bluetooth/qlowenergycontroller_p.cpp
+++ b/src/bluetooth/qlowenergycontroller_p.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qlowenergycontroller_p.h"
+#include "dummy/dummy_helper_p.h"
QT_BEGIN_NAMESPACE
@@ -47,6 +48,7 @@ QLowEnergyControllerPrivate::QLowEnergyControllerPrivate()
error(QLowEnergyController::NoError),
lastLocalHandle(0)
{
+ printDummyWarning();
registerQLowEnergyControllerMetaType();
}
diff --git a/src/nfc/qnearfieldmanager.h b/src/nfc/qnearfieldmanager.h
index 0d5176d9..2cf69823 100644
--- a/src/nfc/qnearfieldmanager.h
+++ b/src/nfc/qnearfieldmanager.h
@@ -77,6 +77,10 @@ public:
bool startTargetDetection();
void stopTargetDetection();
+ //TODO Qt 6 Consider removal of this registration mechanism
+ //None of the currently supported platforms supports the feature
+ //or in fact the implementation (on Android) is not what the
+ //function is supposed to do.
int registerNdefMessageHandler(QObject *object, const char *method);
int registerNdefMessageHandler(QNdefRecord::TypeNameFormat typeNameFormat,
const QByteArray &type,
diff --git a/src/nfc/qnearfieldmanager_android.cpp b/src/nfc/qnearfieldmanager_android.cpp
index 8fbd4371..d7db6ecf 100644
--- a/src/nfc/qnearfieldmanager_android.cpp
+++ b/src/nfc/qnearfieldmanager_android.cpp
@@ -192,6 +192,10 @@ void QNearFieldManagerPrivateImpl::stopTargetDetection()
updateReceiveState();
}
+// FIXME This is supposed to be a platform registration. A message that
+// matches the given NDEF filter should restart the current application.
+// The implementation below only works as long as the current application
+// is running. It is not a platform wide registration on Android.
int QNearFieldManagerPrivateImpl::registerNdefMessageHandler(QObject *object, const QMetaMethod &method)
{
ndefMessageHandlers.append(QPair<QPair<int, QObject *>, QMetaMethod>(QPair<int, QObject *>(m_handlerID, object), method));
@@ -200,6 +204,7 @@ int QNearFieldManagerPrivateImpl::registerNdefMessageHandler(QObject *object, co
return m_handlerID++;
}
+// FIXME see above
int QNearFieldManagerPrivateImpl::registerNdefMessageHandler(const QNdefFilter &filter,
QObject *object, const QMetaMethod &method)
{
diff --git a/src/nfc/qnearfieldtarget_android.cpp b/src/nfc/qnearfieldtarget_android.cpp
index 0e3836f3..e0c1616d 100644
--- a/src/nfc/qnearfieldtarget_android.cpp
+++ b/src/nfc/qnearfieldtarget_android.cpp
@@ -310,12 +310,12 @@ void NearFieldTarget::checkIsTargetLost()
QString techStr = m_techList.first();
QAndroidJniObject tagTech = getTagTechnology(techStr);
tagTech.callMethod<void>("connect");
- if (catchJavaExceptions()) {
+ if (catchJavaExceptions(false)) {
handleTargetLost();
return;
}
tagTech.callMethod<void>("close");
- if (catchJavaExceptions())
+ if (catchJavaExceptions(false))
handleTargetLost();
}
@@ -442,11 +442,12 @@ QByteArray NearFieldTarget::jbyteArrayToQByteArray(const jbyteArray &byteArray)
return resultArray;
}
-bool NearFieldTarget::catchJavaExceptions() const
+bool NearFieldTarget::catchJavaExceptions(bool verbose) const
{
QAndroidJniEnvironment env;
if (env->ExceptionCheck()) {
- env->ExceptionDescribe();
+ if (verbose)
+ env->ExceptionDescribe();
env->ExceptionClear();
return true;
}
diff --git a/src/nfc/qnearfieldtarget_android_p.h b/src/nfc/qnearfieldtarget_android_p.h
index e9351a64..94bb394d 100644
--- a/src/nfc/qnearfieldtarget_android_p.h
+++ b/src/nfc/qnearfieldtarget_android_p.h
@@ -99,7 +99,7 @@ protected:
void handleTargetLost();
QAndroidJniObject getTagTechnology(const QString &tech) const;
QByteArray jbyteArrayToQByteArray(const jbyteArray &byteArray) const;
- bool catchJavaExceptions() const;
+ bool catchJavaExceptions(bool verbose = true) const;
protected:
QAndroidJniObject m_intent;
diff --git a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
index a8358dea..701e1825 100644
--- a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
+++ b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
@@ -611,8 +611,7 @@ void tst_QLowEnergyController::verifyServiceProperties(
temp = QString("00002a02-0000-1000-8000-00805f9b34fb");
QCOMPARE(chars[2].uuid(), QBluetoothUuid(temp));
HANDLE_COMPARE(chars[2].handle(), QLowEnergyHandle(0x7));
- QCOMPARE(chars[2].properties(),
- (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QVERIFY(chars[2].properties() & QLowEnergyCharacteristic::Read);
QCOMPARE(chars[2].value(), QByteArray::fromHex("00"));
QVERIFY(chars[2].isValid());
QCOMPARE(chars[2].descriptors().count(), 0);
diff --git a/tests/bttestui/btlocaldevice.cpp b/tests/bttestui/btlocaldevice.cpp
index b2bcaf1d..5b84794c 100644
--- a/tests/bttestui/btlocaldevice.cpp
+++ b/tests/bttestui/btlocaldevice.cpp
@@ -411,7 +411,7 @@ void BtLocalDevice::connectToServiceViaSearch()
socket->setPreferredSecurityFlags(securityFlags);
QBluetoothServiceInfo info = foundTestServers.at(0);
- socket->connectToService(info.device().address(), QBluetoothUuid(QString(TEST_SERVICE_UUID)));
+ socket->connectToService(info);
} else {
qWarning() << "Perform search for test service before triggering this function";
}