diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-11-17 03:02:45 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-11-17 03:02:45 +0100 |
commit | 864536cf3cb50c45f45a9f0b5cebe2c27e550a9f (patch) | |
tree | 9b208f34a37d2b6ae1a74fbfb4372fad61c88894 | |
parent | 3824bab02e173f13c616dac4f61900873f0ff89b (diff) | |
parent | 801def0ca1adb14584a9540069a3d87703d163a7 (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I074fa6330aba92ff08980848032941d123493556
-rw-r--r-- | src/bluetooth/qbluetoothdevicediscoveryagent.cpp | 3 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice_p.cpp | 6 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice_p.h | 29 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothserviceinfo.cpp | 4 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothserviceinfo_winrt.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp | 4 |
6 files changed, 20 insertions, 29 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent.cpp index c9c3fa39..8a5772c4 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent.cpp @@ -75,6 +75,9 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT) 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. + + \note Due to API limitations it is only possible to find devices that have been paired using + Windows' settings on Windows. */ /*! diff --git a/src/bluetooth/qbluetoothlocaldevice_p.cpp b/src/bluetooth/qbluetoothlocaldevice_p.cpp index b93de6a9..793a8311 100644 --- a/src/bluetooth/qbluetoothlocaldevice_p.cpp +++ b/src/bluetooth/qbluetoothlocaldevice_p.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) : QObject(parent), - d_ptr(nullptr) + d_ptr(new QBluetoothLocalDevicePrivate(this, QBluetoothAddress())) { #if !defined(QT_IOS_BLUETOOTH) && !defined(QT_WINRT_BLUETOOTH) printDummyWarning(); @@ -57,9 +57,9 @@ QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) : registerQBluetoothLocalDeviceMetaType(); } -QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &, QObject *parent) : +QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent) : QObject(parent), - d_ptr(nullptr) + d_ptr(new QBluetoothLocalDevicePrivate(this, address)) { registerQBluetoothLocalDeviceMetaType(); } diff --git a/src/bluetooth/qbluetoothlocaldevice_p.h b/src/bluetooth/qbluetoothlocaldevice_p.h index 89dbf9a3..98c62151 100644 --- a/src/bluetooth/qbluetoothlocaldevice_p.h +++ b/src/bluetooth/qbluetoothlocaldevice_p.h @@ -208,37 +208,22 @@ private: void initializeAdapter(); void initializeAdapterBluez5(); }; -#elif defined(QT_WINRT_BLUETOOTH) +#elif !defined(QT_OSX_BLUETOOTH) // winrt and dummy backend class QBluetoothLocalDevicePrivate : public QObject { public: - QBluetoothLocalDevicePrivate(QBluetoothLocalDevice *q, - QBluetoothAddress localAddress = QBluetoothAddress()) - : q_ptr(q) - { - Q_UNUSED(localAddress); - } - - ~QBluetoothLocalDevicePrivate() - { - } - - - bool isValid() const + QBluetoothLocalDevicePrivate(QBluetoothLocalDevice * = nullptr, + QBluetoothAddress = QBluetoothAddress()) { - return true; } -private: - QBluetoothLocalDevice *q_ptr; -}; -#elif !defined(QT_OSX_BLUETOOTH) -class QBluetoothLocalDevicePrivate : public QObject -{ -public: bool isValid() const { +#ifndef QT_WINRT_BLUETOOTH return false; +#else + return true; +#endif } }; #endif diff --git a/src/bluetooth/qbluetoothserviceinfo.cpp b/src/bluetooth/qbluetoothserviceinfo.cpp index 9da1cf78..74b17ac4 100644 --- a/src/bluetooth/qbluetoothserviceinfo.cpp +++ b/src/bluetooth/qbluetoothserviceinfo.cpp @@ -134,6 +134,10 @@ QT_BEGIN_NAMESPACE \value ServiceName Name of the Bluetooth service in the primary language. \value ServiceDescription Description of the Bluetooth service in the primary language. \value ServiceProvider Name of the company / entity that provides the Bluetooth service primary language. + + \note On Windows ServiceClassIds and ProtocolDescriptorList are automatically set to default + values when a service is created. Manually setting values for these attributes will not work and + might lead to unexpected results on this platform. */ /*! diff --git a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp index 04b1872b..45262735 100644 --- a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp +++ b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp @@ -324,7 +324,6 @@ static ComPtr<IBuffer> bufferFromAttribute(const QVariant &attribute) case 0: qCWarning(QT_BT_WINRT) << "Don't know how to register Uuid of length 0"; return nullptr; - break; case 2: qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering Uuid attribute with length 2:" << uuid; hr = writer->WriteByte(TYPE_UUID16); @@ -402,7 +401,7 @@ static ComPtr<IBuffer> bufferFromAttribute(const QVariant &attribute) qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registered sequence attribute with length" << length; } else if (attribute.userType() == qMetaTypeId<QBluetoothServiceInfo::Alternative>()) { qCWarning(QT_BT_WINRT) << "Don't know how to register user type Alternative"; - return false; + return nullptr; } break; default: diff --git a/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp b/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp index acc498cc..4564cf4d 100644 --- a/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp +++ b/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp @@ -185,11 +185,11 @@ void tst_QBluetoothServer::tst_receive() bool localDeviceAvailable = localDev.isValid(); if (localDeviceAvailable) { - // setHostMode is noop on OS X. + // setHostMode is noop on OS X and winrt. setHostMode(address, hostmode); if (hostmode == QBluetoothLocalDevice::HostPoweredOff) { -#ifndef Q_OS_OSX +#if !defined(Q_OS_OSX) && !QT_CONFIG(winrt_bt) QCOMPARE(localDevice.hostMode(), hostmode); #endif } else { |