summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/osx/osxbtutility.mm
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2022-11-10 22:42:26 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2022-11-10 22:42:26 +0200
commite957d4810b05d8453e163d7bcdcab42d3c60a7bb (patch)
tree76ed3d969c478042f8ca747bf425b0e5d2e893dc /src/bluetooth/osx/osxbtutility.mm
parent47c424c7990061714bd3108e3fbaa4339ba411b9 (diff)
parenta6f5b79169991ffde38643d7b1a04d6a9de137bf (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.8' into tqtc/lts-5.15-opensourcev5.15.8-lts-lgpl
Diffstat (limited to 'src/bluetooth/osx/osxbtutility.mm')
-rw-r--r--src/bluetooth/osx/osxbtutility.mm19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/bluetooth/osx/osxbtutility.mm b/src/bluetooth/osx/osxbtutility.mm
index c7fa7c42..3d41a224 100644
--- a/src/bluetooth/osx/osxbtutility.mm
+++ b/src/bluetooth/osx/osxbtutility.mm
@@ -42,6 +42,7 @@
#include "osxbtutility_p.h"
#include "qbluetoothuuid.h"
+#include <QtCore/qoperatingsystemversion.h>
#include <QtCore/qendian.h>
#include <QtCore/qstring.h>
@@ -76,6 +77,8 @@ const int defaultLEScanTimeoutMS = 25000;
// We use it only on iOS for now:
const int maxValueLength = 512;
+NSString *const bluetoothUsageKey = @"NSBluetoothAlwaysUsageDescription";
+
QString qt_address(NSString *address)
{
if (address && address.length) {
@@ -351,6 +354,22 @@ ObjCStrongReference<NSMutableData> mutable_data_from_bytearray(const QByteArray
return result;
}
+bool qt_appNeedsBluetoothUsageDescription()
+{
+#ifdef Q_OS_MACOS
+ return QOperatingSystemVersion::current() > QOperatingSystemVersion::MacOSBigSur;
+#endif
+ return true;
+}
+
+bool qt_appPlistContainsDescription(NSString *key)
+{
+ Q_ASSERT(key);
+
+ NSDictionary<NSString *, id> *infoDict = NSBundle.mainBundle.infoDictionary;
+ return !!infoDict[key];
+}
+
// A small RAII class for a dispatch queue.
class SerialDispatchQueue
{