summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2019-09-12 11:55:37 +0200
committerLiang Qi <liang.qi@qt.io>2019-09-12 12:36:07 +0200
commit9ebd29eafed687ae19ec02aa0bd566f60377ceec (patch)
treef70f9d0f4fae4ee369a892f71a6f323c1113cfc3 /src
parent2c6dcc643f29c212fca0ead123a377e96b9a17c9 (diff)
parentc1803d266854c6f71994705133e5b2b93a060d1e (diff)
Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts: src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm src/bluetooth/qbluetoothserver_osx.mm src/bluetooth/qbluetoothserviceinfo_osx.mm src/bluetooth/qbluetoothsocket_osx.mm Change-Id: I24485ae835560fa1e57007fb684f6532db3e7922
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/android/localdevicebroadcastreceiver.cpp12
-rw-r--r--src/bluetooth/doc/src/bluetooth-overview.qdoc7
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp5
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_android.cpp11
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_osx.mm2
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_p.h2
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_winrt.cpp2
-rw-r--r--src/bluetooth/qbluetoothtransferreply_osx.mm10
-rw-r--r--src/bluetooth/qlowenergycontroller_android.cpp2
-rw-r--r--src/bluetooth/qlowenergycontroller_bluezdbus.cpp4
10 files changed, 31 insertions, 26 deletions
diff --git a/src/bluetooth/android/localdevicebroadcastreceiver.cpp b/src/bluetooth/android/localdevicebroadcastreceiver.cpp
index e3b01987..78aecc12 100644
--- a/src/bluetooth/android/localdevicebroadcastreceiver.cpp
+++ b/src/bluetooth/android/localdevicebroadcastreceiver.cpp
@@ -189,6 +189,14 @@ void LocalDeviceBroadcastReceiver::onReceive(JNIEnv *env, jobject context, jobje
return;
case 0: //BluetoothDevice.PAIRING_VARIANT_PIN
{
+ qCDebug(QT_BT_ANDROID) << "Pairing : PAIRING_VARIANT_PIN -> use Android default handling";
+
+ // The section below is disabled because this Android pairing variant
+ // requires the user to enter a pin. Since QBluetoothLocalDevice does
+ // not have a setPin() equivalent which might be used to return the user's value.
+ // For now we ignore this request. If an app ignores such requests,
+ // Android shows a "fall-back" pin code entry form.
+ /*
//generate a random key
const QString pin = QStringLiteral("%1").arg(QRandomGenerator::global()->bounded(1000000),
6, 10, QLatin1Char('0'));
@@ -225,10 +233,12 @@ void LocalDeviceBroadcastReceiver::onReceive(JNIEnv *env, jobject context, jobje
}
const QBluetoothAddress address(bluetoothDevice.callObjectMethod<jstring>("getAddress").toString());
- emit pairingDisplayPinCode(address, pin);
+ emit pairingDisplayPinCode(address, pin);*/
+ break;
}
case 2: //BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION
{
+ qCDebug(QT_BT_ANDROID) << "Pairing : PAIRING_VARIANT_PASSKEY_CONFIRMATION";
keyExtra = valueForStaticField(JavaNames::BluetoothDevice,
JavaNames::ExtraPairingKey);
key = intentObject.callMethod<jint>("getIntExtra",
diff --git a/src/bluetooth/doc/src/bluetooth-overview.qdoc b/src/bluetooth/doc/src/bluetooth-overview.qdoc
index 902a13b7..33ccaa33 100644
--- a/src/bluetooth/doc/src/bluetooth-overview.qdoc
+++ b/src/bluetooth/doc/src/bluetooth-overview.qdoc
@@ -47,7 +47,12 @@
\li Receive advertisement from Bluetooth Low Energy device.
\endlist
- Note that the Object Push Profile is not supported on Android.
+ Note that the Object Push Profile is not supported on Android and Windows.
+
+ Note that parts of RFCOMM functionality cannot be configured by Qt on Windows.
+ A service's \l {ServiceClassIds} and \l {ProtocolDescriptorList} are filled automatically by
+ Windows. Therefore registering a service with custom values for these fields might not yield the
+ expected result on Windows.
Note that the Received Signal Strength Indicator (RSSI), as well as
the Manufacturer Specific Data advertised by Bluetooth LE devices are
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
index 3407d280..5376ad2f 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
@@ -52,6 +52,7 @@
#include <QtCore/QLoggingCategory>
#include <QtCore/qmutex.h>
#include <QtCore/private/qeventdispatcher_winrt_p.h>
+#include <QtCore/qmutex.h>
#include <robuffer.h>
#include <wrl.h>
@@ -866,10 +867,8 @@ void QBluetoothDeviceDiscoveryAgentPrivate::stop()
disconnectAndClearWorker();
emit q->canceled();
}
- if (leScanTimer) {
+ if (leScanTimer)
leScanTimer->stop();
- worker->deleteLater();
- }
}
void QBluetoothDeviceDiscoveryAgentPrivate::registerDevice(const QBluetoothDeviceInfo &info)
diff --git a/src/bluetooth/qbluetoothlocaldevice_android.cpp b/src/bluetooth/qbluetoothlocaldevice_android.cpp
index 40e4c2d4..2995d368 100644
--- a/src/bluetooth/qbluetoothlocaldevice_android.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice_android.cpp
@@ -69,8 +69,6 @@ QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(
this, &QBluetoothLocalDevicePrivate::processConnectDeviceChanges);
connect(receiver, &LocalDeviceBroadcastReceiver::pairingDisplayConfirmation,
this, &QBluetoothLocalDevicePrivate::processDisplayConfirmation);
- connect(receiver, &LocalDeviceBroadcastReceiver::pairingDisplayPinCode,
- this, &QBluetoothLocalDevicePrivate::processDisplayPinCode);
}
QBluetoothLocalDevicePrivate::~QBluetoothLocalDevicePrivate()
@@ -206,15 +204,6 @@ void QBluetoothLocalDevicePrivate::processDisplayConfirmation(const QBluetoothAd
return;
emit q_ptr->pairingDisplayConfirmation(address, pin);
-}
-
-void QBluetoothLocalDevicePrivate::processDisplayPinCode(const QBluetoothAddress &address, const QString &pin)
-{
- // only send pairing notification for pairing requests issued by
- // this QBluetoothLocalDevice instance
- if (pendingPairing(address) == -1)
- return;
-
emit q_ptr->pairingDisplayPinCode(address, pin);
}
diff --git a/src/bluetooth/qbluetoothlocaldevice_osx.mm b/src/bluetooth/qbluetoothlocaldevice_osx.mm
index 52b7bba8..e7dd9906 100644
--- a/src/bluetooth/qbluetoothlocaldevice_osx.mm
+++ b/src/bluetooth/qbluetoothlocaldevice_osx.mm
@@ -149,7 +149,7 @@ QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(QBluetoothLocalDevice
bool QBluetoothLocalDevicePrivate::isValid() const
{
- return hostController;
+ return hostController.data();
}
void QBluetoothLocalDevicePrivate::requestPairing(const QBluetoothAddress &address, Pairing pairing)
diff --git a/src/bluetooth/qbluetoothlocaldevice_p.h b/src/bluetooth/qbluetoothlocaldevice_p.h
index 28e7ed53..d86ab22f 100644
--- a/src/bluetooth/qbluetoothlocaldevice_p.h
+++ b/src/bluetooth/qbluetoothlocaldevice_p.h
@@ -129,7 +129,6 @@ private slots:
QBluetoothLocalDevice::Pairing pairing);
void processConnectDeviceChanges(const QBluetoothAddress &address, bool isConnectEvent);
void processDisplayConfirmation(const QBluetoothAddress &address, const QString &pin);
- void processDisplayPinCode(const QBluetoothAddress &address, const QString &pin);
private:
QBluetoothLocalDevice *q_ptr;
@@ -254,6 +253,7 @@ class QBluetoothLocalDevicePrivate : public QObject
public:
QBluetoothLocalDevicePrivate(QBluetoothLocalDevice *q,
QBluetoothAddress = QBluetoothAddress());
+ ~QBluetoothLocalDevicePrivate();
bool isValid() const;
diff --git a/src/bluetooth/qbluetoothlocaldevice_winrt.cpp b/src/bluetooth/qbluetoothlocaldevice_winrt.cpp
index ae794db0..6e8b1966 100644
--- a/src/bluetooth/qbluetoothlocaldevice_winrt.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice_winrt.cpp
@@ -114,6 +114,8 @@ QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(QBluetoothLocalDevice
GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Devices_Bluetooth_BluetoothDevice).Get(), &mStatics);
}
+QBluetoothLocalDevicePrivate::~QBluetoothLocalDevicePrivate() = default;
+
bool QBluetoothLocalDevicePrivate::isValid() const
{
return (mStatics != nullptr && mLEStatics != nullptr);
diff --git a/src/bluetooth/qbluetoothtransferreply_osx.mm b/src/bluetooth/qbluetoothtransferreply_osx.mm
index 65c8f82d..40a747f8 100644
--- a/src/bluetooth/qbluetoothtransferreply_osx.mm
+++ b/src/bluetooth/qbluetoothtransferreply_osx.mm
@@ -136,13 +136,13 @@ QBluetoothTransferReplyOSXPrivate::~QBluetoothTransferReplyOSXPrivate()
// The OBEX session will be closed then. If
// somehow IOBluetooth/OBEX still has a reference to our
// session, it will not call any of delegate's callbacks.
- if (session)
+ if (session.data())
[session closeSession];
}
bool QBluetoothTransferReplyOSXPrivate::isActive() const
{
- return agent || (session && [session hasActiveRequest]);
+ return agent.data() || (session.data() && [session hasActiveRequest]);
}
bool QBluetoothTransferReplyOSXPrivate::startOPP(const QBluetoothAddress &device)
@@ -218,7 +218,7 @@ void QBluetoothTransferReplyOSXPrivate::sendConnect(const QBluetoothAddress &dev
void QBluetoothTransferReplyOSXPrivate::sendPut()
{
Q_ASSERT_X(inputStream, Q_FUNC_INFO, "invalid input stream (null)");
- Q_ASSERT_X(session, Q_FUNC_INFO, "invalid OBEX session (nil)");
+ Q_ASSERT_X(session.data(), Q_FUNC_INFO, "invalid OBEX session (nil)");
Q_ASSERT_X([session isConnected], Q_FUNC_INFO, "not connected");
Q_ASSERT_X(![session hasActiveRequest], Q_FUNC_INFO,
"session already has an active request");
@@ -268,7 +268,7 @@ void QBluetoothTransferReplyOSXPrivate::OBEXConnectError(OBEXError errorCode, OB
Q_UNUSED(errorCode)
Q_UNUSED(response)
- if (session) {
+ if (session.data()) {
setReplyError(QBluetoothTransferReply::SessionError,
QCoreApplication::translate(TRANSFER_REPLY, TR_CONNECT_FAILED));
} else {
@@ -283,7 +283,7 @@ void QBluetoothTransferReplyOSXPrivate::OBEXConnectError(OBEXError errorCode, OB
void QBluetoothTransferReplyOSXPrivate::OBEXConnectSuccess()
{
// Now that OBEX connect succeeded, we can send an OBEX put request.
- if (!session) {
+ if (!session.data()) {
// We're still in OBEXConnect(), it'll take care of next steps.
return;
}
diff --git a/src/bluetooth/qlowenergycontroller_android.cpp b/src/bluetooth/qlowenergycontroller_android.cpp
index 35d943fc..86e6ade7 100644
--- a/src/bluetooth/qlowenergycontroller_android.cpp
+++ b/src/bluetooth/qlowenergycontroller_android.cpp
@@ -940,7 +940,7 @@ static QAndroidJniObject createJavaAdvertiseData(const QLowEnergyAdvertisingData
env->SetByteArrayRegion(nativeData, 0, nativeSize,
reinterpret_cast<const jbyte*>(data.manufacturerData().constData()));
builder = builder.callObjectMethod("addManufacturerData",
- "(I[B])Landroid/bluetooth/le/AdvertiseData$Builder;",
+ "(I[B)Landroid/bluetooth/le/AdvertiseData$Builder;",
data.manufacturerId(), nativeData);
env->DeleteLocalRef(nativeData);
diff --git a/src/bluetooth/qlowenergycontroller_bluezdbus.cpp b/src/bluetooth/qlowenergycontroller_bluezdbus.cpp
index 4e5f3430..2a0fafdf 100644
--- a/src/bluetooth/qlowenergycontroller_bluezdbus.cpp
+++ b/src/bluetooth/qlowenergycontroller_bluezdbus.cpp
@@ -340,7 +340,7 @@ void QLowEnergyControllerPrivateBluezDBus::connectToDevice()
QDBusPendingReply<> reply = device->Connect();
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this,
- [=](QDBusPendingCallWatcher* call) {
+ [this](QDBusPendingCallWatcher* call) {
QDBusPendingReply<> reply = *call;
if (reply.isError()) {
qCDebug(QT_BT_BLUEZ) << "BTLE_DBUS::connect() failed"
@@ -362,7 +362,7 @@ void QLowEnergyControllerPrivateBluezDBus::disconnectFromDevice()
QDBusPendingReply<> reply = device->Disconnect();
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this,
- [=](QDBusPendingCallWatcher* call) {
+ [this](QDBusPendingCallWatcher* call) {
QDBusPendingReply<> reply = *call;
if (reply.isError()) {
qCDebug(QT_BT_BLUEZ) << "BTLE_DBUS::disconnect() failed"