summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2022-05-16 18:16:37 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2022-05-16 18:16:37 +0300
commit15f809f2a7f555c2bdb8ac152bd187e313a2838c (patch)
tree81e1b646fc591390df518190b3ba6e7fdc040f4b
parent83ca3a2471560f09d723157322adc0b5c33ed914 (diff)
parent42bef3553361d7e56c0d6dea8604f795c815bcee (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.5' into tqtc/lts-5.15-opensourcev5.15.5-lts-lgpl
-rw-r--r--.qmake.conf2
-rw-r--r--src/bluetooth/osx/osxbtledeviceinquiry.mm10
-rw-r--r--src/bluetooth/osx/osxbtutility.mm14
-rw-r--r--src/bluetooth/qlowenergycontroller_android.cpp9
4 files changed, 24 insertions, 11 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 163ffef2..e62ae21d 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -2,4 +2,4 @@ load(qt_build_config)
DEFINES += QT_NO_FOREACH QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST
-MODULE_VERSION = 5.15.4
+MODULE_VERSION = 5.15.5
diff --git a/src/bluetooth/osx/osxbtledeviceinquiry.mm b/src/bluetooth/osx/osxbtledeviceinquiry.mm
index 70b96ab7..e64ac1db 100644
--- a/src/bluetooth/osx/osxbtledeviceinquiry.mm
+++ b/src/bluetooth/osx/osxbtledeviceinquiry.mm
@@ -218,7 +218,15 @@ QT_USE_NAMESPACE
[elapsedTimer startWithTimeout:inquiryTimeoutMS step:timeStepMS];
}
- [manager scanForPeripheralsWithServices:nil options:nil];
+ // ### Qt 6.x: remove the use of env. variable, as soon as a proper public API is in place.
+ bool envOk = false;
+ const int env = qEnvironmentVariableIntValue("QT_BLUETOOTH_SCAN_ENABLE_DUPLICATES", &envOk);
+ if (envOk && env) {
+ [manager scanForPeripheralsWithServices:nil
+ options:@{CBCentralManagerScanOptionAllowDuplicatesKey : @YES}];
+ } else {
+ [manager scanForPeripheralsWithServices:nil options:nil];
+ }
} // Else we ignore.
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) || QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_13)
} else if (state == CBManagerStateUnsupported || state == CBManagerStateUnauthorized) {
diff --git a/src/bluetooth/osx/osxbtutility.mm b/src/bluetooth/osx/osxbtutility.mm
index e17006de..c7fa7c42 100644
--- a/src/bluetooth/osx/osxbtutility.mm
+++ b/src/bluetooth/osx/osxbtutility.mm
@@ -233,11 +233,17 @@ CFStrongReference<CFUUIDRef> cf_uuid(const QBluetoothUuid &qtUuid)
ObjCStrongReference<CBUUID> cb_uuid(const QBluetoothUuid &qtUuid)
{
- CFStrongReference<CFUUIDRef> cfUuid(cf_uuid(qtUuid));
- if (!cfUuid)
- return ObjCStrongReference<CBUUID>();
+ bool ok = false;
+ const auto asUInt16 = qToBigEndian(qtUuid.toUInt16(&ok));
+ const auto asUInt128 = qtUuid.toUInt128();
- ObjCStrongReference<CBUUID> cbUuid([CBUUID UUIDWithCFUUID:cfUuid], true); //true == retain.
+ const NSUInteger length = ok ? sizeof asUInt16 : sizeof asUInt128;
+ const void *bytes = &asUInt128;
+ if (ok)
+ bytes = &asUInt16;
+
+ NSData *uuidData = [NSData dataWithBytes:bytes length:length];
+ ObjCStrongReference<CBUUID> cbUuid([CBUUID UUIDWithData:uuidData], true); // true == retain.
return cbUuid;
}
diff --git a/src/bluetooth/qlowenergycontroller_android.cpp b/src/bluetooth/qlowenergycontroller_android.cpp
index e0a59ddd..e0f3eef7 100644
--- a/src/bluetooth/qlowenergycontroller_android.cpp
+++ b/src/bluetooth/qlowenergycontroller_android.cpp
@@ -502,7 +502,7 @@ void QLowEnergyControllerPrivateAndroid::servicesDiscovered(
if (errorCode == QLowEnergyController::NoError) {
//Android delivers all services in one go
- const QStringList list = foundServices.split(QStringLiteral(" "), Qt::SkipEmptyParts);
+ const QStringList list = foundServices.split(QChar::Space, Qt::SkipEmptyParts);
for (const QString &entry : list) {
const QBluetoothUuid service(entry);
if (service.isNull())
@@ -550,8 +550,7 @@ void QLowEnergyControllerPrivateAndroid::serviceDetailsDiscoveryFinished(
uuid.object<jstring>());
if (javaIncludes.isValid()) {
const QStringList list = javaIncludes.toString()
- .split(QStringLiteral(" "),
- Qt::SkipEmptyParts);
+ .split(QChar::Space, Qt::SkipEmptyParts);
for (const QString &entry : list) {
const QBluetoothUuid service(entry);
if (service.isNull())
@@ -928,8 +927,8 @@ static QAndroidJniObject createJavaAdvertiseData(const QLowEnergyAdvertisingData
!data.localName().isEmpty());
builder = builder.callObjectMethod("setIncludeTxPowerLevel", "(Z)Landroid/bluetooth/le/AdvertiseData$Builder;",
data.includePowerLevel());
- for (const auto service: data.services())
- {
+ const auto services = data.services();
+ for (const auto &service : services) {
builder = builder.callObjectMethod("addServiceUuid",
"(Landroid/os/ParcelUuid;)Landroid/bluetooth/le/AdvertiseData$Builder;",
javaParcelUuidfromQtUuid(service).object());