summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-06-27 11:47:22 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-06-27 11:47:22 +0200
commite31df00987b6d9c8558ceb812bb68be71106d773 (patch)
treea8a259477410620f8f5f30fa8c2e4c900496d15a
parent7beb4375483f74cc5be501dbcd91c82a80178936 (diff)
parent094be0786f75ed33564c6096778510dab4500eb8 (diff)
Merge branch '5.3' into dev
Conflicts: .qmake.conf src/bluetooth/qbluetoothlocaldevice_bluez.cpp src/bluetooth/qbluetoothlocaldevice_p.h src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp Change-Id: Ifb0c01eb8bffbffcd2416ea8d7bf1d36eb1c70f2
-rw-r--r--dist/changes-5.3.07
-rw-r--r--dist/changes-5.3.189
-rw-r--r--examples/bluetooth/btfiletransfer/remoteselector.cpp35
-rw-r--r--examples/bluetooth/btfiletransfer/remoteselector.h2
-rw-r--r--src/bluetooth/android/jni_android.cpp4
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent.h1
-rw-r--r--src/bluetooth/qbluetoothlocaldevice.cpp10
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_bluez.cpp56
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_p.h3
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp2
-rw-r--r--src/bluetooth/qbluetoothsocket.h1
-rw-r--r--src/bluetooth/qbluetoothtransferreply.h1
-rw-r--r--tests/bttestui/btlocaldevice.cpp2
13 files changed, 188 insertions, 25 deletions
diff --git a/dist/changes-5.3.0 b/dist/changes-5.3.0
index 97754515..b5c4dc86 100644
--- a/dist/changes-5.3.0
+++ b/dist/changes-5.3.0
@@ -45,7 +45,7 @@ QtBluetooth
* Test application added. This application enables easier testing
and debugging of the various API features.
- - BluetoothDiscoveryModel:
+ - BluetoothDiscoveryModel (QML):
* Improved error handling of device discovery process.
* Fixed incorrect behavior when changing from device to service discovery
and vice versa.
@@ -120,6 +120,7 @@ Android
- [QTBUG-33792] QtBluetooth has been ported to Android.
BlackBerry 10:
+--------------
- [QTBUG-36626] Fixed a memory leak in QBluetoothServer::listen().
- Fixed incomplete implementation of QBluetoothServer::close().
@@ -132,7 +133,7 @@ BlackBerry 10:
together with a QFile.
Bluez/Linux
--------
+-----------
- The handling of powered-off local Bluetooth adapters was improved.
- Fixed memory leaks in service and device discovery classes.
@@ -150,5 +151,3 @@ Bluez/Linux
- Fixed failing call to QBluetoothServer::listen(QBluetoothAddress) if the passed
address was null.
-
-
diff --git a/dist/changes-5.3.1 b/dist/changes-5.3.1
new file mode 100644
index 00000000..1fa17203
--- /dev/null
+++ b/dist/changes-5.3.1
@@ -0,0 +1,89 @@
+Qt 5.3.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.3.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ http://qt-project.org/doc/qt-5.3
+
+The Qt version 5.3 series is binary compatible with the 5.2.x series.
+Applications compiled for 5.2 will continue to run with 5.3.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ http://bugreports.qt-project.org/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* General *
+****************************************************************************
+
+General Improvements
+--------------------
+
+ - [QTBUG-38140] Changed btchat example to use full service discovery to
+ increase chance of finding remote services. Some platforms such as Android
+ may not be able to find remote services via a minimal service discovery.
+
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+QtBluetooth
+-----------
+
+ - QML BluetoothDiscoveryModel:
+ * Fixed inconsistent behavior whereby the QML model never reset its
+ content while the underlying QBluetoothServiceDiscoveryAgent instance
+ did reset. This caused the QML model to show an incomplete list of remote
+ Bluetooth services during its second run.
+
+ - QDebug helper for QBluetoothUuid became aware of QT_NO_DEBUG_STREAM
+ define.
+
+ - QBluetoothSocket:
+ * Fixed duplicate emission of unconnected state in the reconnection
+ case.
+
+ - Fixed crash when calling listen() on the QML BluetoothService type.
+
+ - Added some documentation improvements.
+
+ - Added "classname" entry to all qmldir files enabling QML
+ plug-ins when doing static builds (on iOS).
+
+
+****************************************************************************
+* Platform Specific Changes *
+****************************************************************************
+
+BlackBerry
+----------
+
+ - Converted BlackBerry backend to new Bluetooth C API which was introduced
+ by OS version 10.2.1 or later.
+
+Linux
+-----
+
+ - Fixed accidental double up of remote services entries by
+ QBluetoothServiceDiscoveryAgent due to missing duplication check.
+
+ - QBluetoothSocket:
+ * Fixed internal read buffer corruption during timeouts.
+ * Fixed a crash on reconnect.
+
+ - [QTBUG-38402] Fixed incorrect detection of connected devices and their
+ changes by QBluetoothLocalDevice
+
+ - Implemented handling of <url> xml tag by QBluetoothServiceInfo. This tag is
+ used by Bluez to indicate the SDP entries for DocumentationUrl,
+ ClientExecutableUrl and IconUrl. So far these entries where being ignored.
+
+ - [QTBUG-38399] Ensured correct handling of removed Bluetooth dongles by
+ already instantiated QBluetoothLocalDevice objects.
+
diff --git a/examples/bluetooth/btfiletransfer/remoteselector.cpp b/examples/bluetooth/btfiletransfer/remoteselector.cpp
index 84619a4e..08072d14 100644
--- a/examples/bluetooth/btfiletransfer/remoteselector.cpp
+++ b/examples/bluetooth/btfiletransfer/remoteselector.cpp
@@ -59,7 +59,8 @@ QT_USE_NAMESPACE
RemoteSelector::RemoteSelector(QWidget *parent)
: QDialog(parent), ui(new Ui::RemoteSelector),
- m_localDevice(new QBluetoothLocalDevice), m_pindisplay(0)
+ m_localDevice(new QBluetoothLocalDevice), m_pindisplay(0),
+ m_pairingError(false)
{
ui->setupUi(this);
@@ -85,9 +86,14 @@ RemoteSelector::RemoteSelector(QWidget *parent)
ui->remoteDevices->setColumnWidth(3, 75);
ui->remoteDevices->setColumnWidth(4, 100);
- connect(m_localDevice, SIGNAL(pairingDisplayPinCode(QBluetoothAddress,QString)), this, SLOT(displayPin(QBluetoothAddress,QString)));
- connect(m_localDevice, SIGNAL(pairingDisplayConfirmation(QBluetoothAddress,QString)), this, SLOT(displayConfirmation(QBluetoothAddress,QString)));
- connect(m_localDevice, SIGNAL(pairingFinished(QBluetoothAddress,QBluetoothLocalDevice::Pairing)), this, SLOT(pairingFinished(QBluetoothAddress,QBluetoothLocalDevice::Pairing)));
+ connect(m_localDevice, SIGNAL(pairingDisplayPinCode(QBluetoothAddress,QString)),
+ this, SLOT(displayPin(QBluetoothAddress,QString)));
+ connect(m_localDevice, SIGNAL(pairingDisplayConfirmation(QBluetoothAddress,QString)),
+ this, SLOT(displayConfirmation(QBluetoothAddress,QString)));
+ connect(m_localDevice, SIGNAL(pairingFinished(QBluetoothAddress,QBluetoothLocalDevice::Pairing)),
+ this, SLOT(pairingFinished(QBluetoothAddress,QBluetoothLocalDevice::Pairing)));
+ connect(m_localDevice, SIGNAL(error(QBluetoothLocalDevice::Error)),
+ this, SLOT(pairingError(QBluetoothLocalDevice::Error)));
ui->busyWidget->setMovie(new QMovie(":/icons/busy.gif"));
ui->busyWidget->movie()->start();
@@ -97,8 +103,6 @@ RemoteSelector::RemoteSelector(QWidget *parent)
ui->remoteDevices->clearContents();
ui->remoteDevices->setRowCount(0);
-
-
}
RemoteSelector::~RemoteSelector()
@@ -324,12 +328,13 @@ void RemoteSelector::pairingFinished(const QBluetoothAddress &address, QBluetoot
delete m_pindisplay;
QMessageBox msgBox;
- if (status == QBluetoothLocalDevice::Paired ||
- status == QBluetoothLocalDevice::AuthorizedPaired){
- msgBox.setText("Paired successfully with" + address.toString());
- }
- else {
+ if (m_pairingError) {
msgBox.setText("Pairing failed with " + address.toString());
+ } else if (status == QBluetoothLocalDevice::Paired
+ || status == QBluetoothLocalDevice::AuthorizedPaired) {
+ msgBox.setText("Paired successfully with " + address.toString());
+ } else {
+ msgBox.setText("Pairing released with " + address.toString());
}
if (service.isValid()){
@@ -347,11 +352,19 @@ void RemoteSelector::pairingFinished(const QBluetoothAddress &address, QBluetoot
}
}
+ m_pairingError = false;
msgBox.exec();
ui->remoteDevices->blockSignals(false);
+}
+void RemoteSelector::pairingError(QBluetoothLocalDevice::Error error)
+{
+ if (error != QBluetoothLocalDevice::PairingError)
+ return;
+ m_pairingError = true;
+ pairingFinished(m_service.device().address(), QBluetoothLocalDevice::Unpaired);
}
void RemoteSelector::on_remoteDevices_cellClicked(int row, int column)
diff --git a/examples/bluetooth/btfiletransfer/remoteselector.h b/examples/bluetooth/btfiletransfer/remoteselector.h
index fe1d3966..ec2e4fd5 100644
--- a/examples/bluetooth/btfiletransfer/remoteselector.h
+++ b/examples/bluetooth/btfiletransfer/remoteselector.h
@@ -83,6 +83,7 @@ private:
QFile *m_file;
QBluetoothLocalDevice *m_localDevice;
QPointer<pinDisplay> m_pindisplay;
+ bool m_pairingError;
QString addressToName(const QBluetoothAddress &address);
@@ -98,6 +99,7 @@ private slots:
void on_stopButton_clicked();
void pairingFinished(const QBluetoothAddress &address,QBluetoothLocalDevice::Pairing pairing);
+ void pairingError(QBluetoothLocalDevice::Error error);
void displayPin(const QBluetoothAddress &address, QString pin);
void displayConfirmation(const QBluetoothAddress &address, QString pin);
void displayConfReject();
diff --git a/src/bluetooth/android/jni_android.cpp b/src/bluetooth/android/jni_android.cpp
index ebc46a7c..b7221867 100644
--- a/src/bluetooth/android/jni_android.cpp
+++ b/src/bluetooth/android/jni_android.cpp
@@ -93,7 +93,7 @@ QAndroidJniObject valueForStaticField(JavaNames javaName, JavaNames javaFieldNam
case JavaNames::BluetoothDevice:
className = javaBluetoothDeviceClassName; break;
default:
- qWarning(QT_BT_ANDROID) << "Unknown java class name passed to valueForStaticField():" << javaName;
+ qCWarning(QT_BT_ANDROID) << "Unknown java class name passed to valueForStaticField():" << javaName;
return QAndroidJniObject();
}
@@ -132,7 +132,7 @@ QAndroidJniObject valueForStaticField(JavaNames javaName, JavaNames javaFieldNam
case JavaNames::ExtraUuid:
fieldName = javaExtraUuid; break;
default:
- qWarning(QT_BT_ANDROID) << "Unknown java field name passed to valueForStaticField():" << javaFieldName;
+ qCWarning(QT_BT_ANDROID) << "Unknown java field name passed to valueForStaticField():" << javaFieldName;
return QAndroidJniObject();
}
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent.h b/src/bluetooth/qbluetoothdevicediscoveryagent.h
index 45615e74..89158c53 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent.h
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent.h
@@ -79,6 +79,7 @@ public:
QObject *parent = 0);
~QBluetoothDeviceDiscoveryAgent();
+ // TODO Remove inquiry type in Qt 6 -> not really used anywhere
QBluetoothDeviceDiscoveryAgent::InquiryType inquiryType() const;
void setInquiryType(QBluetoothDeviceDiscoveryAgent::InquiryType type);
diff --git a/src/bluetooth/qbluetoothlocaldevice.cpp b/src/bluetooth/qbluetoothlocaldevice.cpp
index c5b68645..78899d0a 100644
--- a/src/bluetooth/qbluetoothlocaldevice.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice.cpp
@@ -124,8 +124,16 @@ QBluetoothLocalDevice::~QBluetoothLocalDevice()
}
/*!
- Returns true if the QBluetoothLocalDevice represents an available local Bluetooth device;
+ Returns \c true if the QBluetoothLocalDevice represents an available local Bluetooth device;
otherwise return false.
+
+ If the local Bluetooth adapter represented by an instance of this class
+ is removed from the system (e.g. removal of the underlying Bluetooth dongle)
+ then this instance will become invalid. An already invalid QBluetoothLocalDevice instance
+ remains invalid even if the same Bluetooth adapter is returned to
+ the system.
+
+ \sa allDevices()
*/
bool QBluetoothLocalDevice::isValid() const
{
diff --git a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
index 2539dbb5..18493f82 100644
--- a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
@@ -286,7 +286,7 @@ static inline OrgBluezDeviceInterface *getDevice(const QBluetoothAddress &addres
void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pairing pairing)
{
- if (address.isNull() || !isValid()) {
+ if (!isValid() || address.isNull()) {
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
Q_ARG(QBluetoothLocalDevice::Error,
QBluetoothLocalDevice::PairingError));
@@ -636,6 +636,7 @@ QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(QBluetoothLocalDevice
adapterProperties(0),
managerBluez5(0),
agent(0),
+ manager(0),
localAddress(address),
pairingTarget(0),
pairingDiscoveryTimer(0),
@@ -700,6 +701,8 @@ QBluetoothLocalDevicePrivate::~QBluetoothLocalDevicePrivate()
delete managerBluez5;
delete agent;
delete pairingTarget;
+ delete manager;
+
qDeleteAll(devices);
qDeleteAll(deviceChangeMonitors);
}
@@ -709,11 +712,12 @@ void QBluetoothLocalDevicePrivate::initializeAdapter()
if (adapter)
return;
- OrgBluezManagerInterface manager(QStringLiteral("org.bluez"), QStringLiteral("/"),
- QDBusConnection::systemBus());
+ QScopedPointer<OrgBluezManagerInterface> man(new OrgBluezManagerInterface(
+ QStringLiteral("org.bluez"), QStringLiteral("/"),
+ QDBusConnection::systemBus()));
if (localAddress == QBluetoothAddress()) {
- QDBusPendingReply<QDBusObjectPath> reply = manager.DefaultAdapter();
+ QDBusPendingReply<QDBusObjectPath> reply = man->DefaultAdapter();
reply.waitForFinished();
if (reply.isError())
return;
@@ -721,7 +725,7 @@ void QBluetoothLocalDevicePrivate::initializeAdapter()
adapter = new OrgBluezAdapterInterface(QStringLiteral("org.bluez"),
reply.value().path(), QDBusConnection::systemBus());
} else {
- QDBusPendingReply<QList<QDBusObjectPath> > reply = manager.ListAdapters();
+ QDBusPendingReply<QList<QDBusObjectPath> > reply = man->ListAdapters();
reply.waitForFinished();
if (reply.isError())
return;
@@ -733,8 +737,10 @@ void QBluetoothLocalDevicePrivate::initializeAdapter()
QDBusPendingReply<QVariantMap> reply = tmpAdapter->GetProperties();
reply.waitForFinished();
- if (reply.isError())
+ if (reply.isError()) {
+ delete tmpAdapter;
continue;
+ }
QBluetoothAddress path_address(reply.value().value(QStringLiteral("Address")).toString());
@@ -747,6 +753,11 @@ void QBluetoothLocalDevicePrivate::initializeAdapter()
}
}
+ // monitor case when local adapter is removed
+ manager = man.take();
+ connect(manager, SIGNAL(AdapterRemoved(QDBusObjectPath)),
+ this, SLOT(adapterRemoved(QDBusObjectPath)));
+
currentMode = static_cast<QBluetoothLocalDevice::HostMode>(-1);
if (adapter) {
connect(adapter, SIGNAL(PropertyChanged(QString, QDBusVariant)),
@@ -936,6 +947,39 @@ bool QBluetoothLocalDevicePrivate::isValid() const
return adapter || adapterBluez5;
}
+// Bluez 4
+void QBluetoothLocalDevicePrivate::adapterRemoved(const QDBusObjectPath &devicePath)
+{
+ if (!adapter )
+ return;
+
+ if (adapter->path() != devicePath.path())
+ return;
+
+ qCDebug(QT_BT_BLUEZ) << "Adapter" << devicePath.path()
+ << "was removed. Invalidating object.";
+ // the current adapter was removed
+ delete adapter;
+ adapter = 0;
+ manager->deleteLater();
+ manager = 0;
+
+ // stop all pairing related activities
+ if (agent) {
+ QDBusConnection::systemBus().unregisterObject(agent_path);
+ delete agent;
+ agent = 0;
+ }
+
+ delete msgConnection;
+ msgConnection = 0;
+
+ // stop all connectivity monitoring
+ qDeleteAll(devices);
+ devices.clear();
+ connectedDevicesSet.clear();
+}
+
void QBluetoothLocalDevicePrivate::RequestConfirmation(const QDBusObjectPath &in0, uint in1)
{
Q_UNUSED(in0);
diff --git a/src/bluetooth/qbluetoothlocaldevice_p.h b/src/bluetooth/qbluetoothlocaldevice_p.h
index 8edac58c..55086012 100644
--- a/src/bluetooth/qbluetoothlocaldevice_p.h
+++ b/src/bluetooth/qbluetoothlocaldevice_p.h
@@ -61,6 +61,7 @@ class OrgFreedesktopDBusObjectManagerInterface;
class OrgBluezAgentAdaptor;
class OrgBluezDeviceInterface;
class OrgBluezDevice1Interface;
+class OrgBluezManagerInterface;
QT_BEGIN_NAMESPACE
class QDBusPendingCallWatcher;
@@ -137,6 +138,7 @@ public:
OrgFreedesktopDBusObjectManagerInterface *managerBluez5; //Bluez 5
QMap<QString, OrgFreedesktopDBusPropertiesInterface *> deviceChangeMonitors; //Bluez 5
OrgBluezAgentAdaptor *agent;
+ OrgBluezManagerInterface *manager;
QList<QBluetoothAddress> connectedDevices() const;
@@ -167,6 +169,7 @@ public slots:
void _q_deviceRemoved(const QDBusObjectPath &device);
void _q_devicePropertyChanged(const QString &property, const QDBusVariant &value);
bool isValid() const;
+ void adapterRemoved(const QDBusObjectPath &device);
void requestPairingBluez5(const QBluetoothAddress &address,
QBluetoothLocalDevice::Pairing targetPairing);
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp
index 177ce63e..4752a0ab 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp
@@ -651,7 +651,7 @@ QVariant QBluetoothServiceDiscoveryAgentPrivate::readAttributeValue(QXmlStreamRe
}
xml.skipCurrentElement();
return QVariant::fromValue(uuid);
- } else if (xml.name() == QLatin1String("text")) {
+ } else if (xml.name() == QLatin1String("text") || xml.name() == QLatin1String("url")) {
QString value = xml.attributes().value(QStringLiteral("value")).toString();
if (xml.attributes().value(QStringLiteral("encoding")) == QLatin1String("hex"))
value = QString::fromUtf8(QByteArray::fromHex(value.toLatin1()));
diff --git a/src/bluetooth/qbluetoothsocket.h b/src/bluetooth/qbluetoothsocket.h
index 0cc765cd..b06330c7 100644
--- a/src/bluetooth/qbluetoothsocket.h
+++ b/src/bluetooth/qbluetoothsocket.h
@@ -66,6 +66,7 @@ class Q_BLUETOOTH_EXPORT QBluetoothSocket : public QIODevice
public:
+ // TODO Decouple SocketState and SocketError enum values from QAbstractSocket in Qt 6
enum SocketState {
UnconnectedState = QAbstractSocket::UnconnectedState,
ServiceLookupState = QAbstractSocket::HostLookupState,
diff --git a/src/bluetooth/qbluetoothtransferreply.h b/src/bluetooth/qbluetoothtransferreply.h
index a26fe35c..ccf2d71d 100644
--- a/src/bluetooth/qbluetoothtransferreply.h
+++ b/src/bluetooth/qbluetoothtransferreply.h
@@ -84,6 +84,7 @@ public Q_SLOTS:
void abort();
Q_SIGNALS:
+ //TODO Remove QBluetoothTransferReply* parameter in Qt 6
void finished(QBluetoothTransferReply *);
void transferProgress(qint64 bytesTransferred, qint64 bytesTotal);
diff --git a/tests/bttestui/btlocaldevice.cpp b/tests/bttestui/btlocaldevice.cpp
index a30e2406..92446fd0 100644
--- a/tests/bttestui/btlocaldevice.cpp
+++ b/tests/bttestui/btlocaldevice.cpp
@@ -104,6 +104,8 @@ BtLocalDevice::BtLocalDevice(QObject *parent) :
} else {
deviceAgent = 0;
serviceAgent = 0;
+ socket = 0;
+ server = 0;
}
}