summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/osx/osxbtutility.mm
diff options
context:
space:
mode:
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
{