summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/osx/osxbtutility.mm
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2017-10-17 07:50:11 +0200
committerAlex Blasche <alexander.blasche@qt.io>2017-10-17 07:50:11 +0200
commit013ad0570844975cd5c72a77d1cfefa30c3ea656 (patch)
tree9fb1d5afc8b29f97a60ca20d514269b9d1658ef2 /src/bluetooth/osx/osxbtutility.mm
parent18af3226765b62312acc8f801cc531fde0d9822b (diff)
parent80d85141aa496583c5cfa6dd0f62d5eb4a8ba660 (diff)
Merge remote-tracking branch 'gerrit/5.9' into 5.10v5.10.0-beta3
Diffstat (limited to 'src/bluetooth/osx/osxbtutility.mm')
-rw-r--r--src/bluetooth/osx/osxbtutility.mm15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/bluetooth/osx/osxbtutility.mm b/src/bluetooth/osx/osxbtutility.mm
index 1508c89f..e17006de 100644
--- a/src/bluetooth/osx/osxbtutility.mm
+++ b/src/bluetooth/osx/osxbtutility.mm
@@ -48,6 +48,7 @@
#ifndef QT_IOS_BLUETOOTH
#import <IOBluetooth/objc/IOBluetoothSDPUUID.h>
+#import <CoreFoundation/CoreFoundation.h>
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12, __IPHONE_NA)
#import <CoreBluetooth/CBUUID.h>
#endif
@@ -164,7 +165,19 @@ QString qt_error_string(IOReturn errorCode)
}
}
-#endif
+void qt_test_iobluetooth_runloop()
+{
+ // IOBluetooth heavily relies on a CFRunLoop machinery in a way it dispatches
+ // its callbacks. Technically, having a QThread with CFRunLoop-based event
+ // dispatcher would suffice. At the moment of writing we do not have such
+ // event dispatcher, so we only can work on the main thread.
+ if (CFRunLoopGetMain() != CFRunLoopGetCurrent()) {
+ qCWarning(QT_BT_OSX) << "IOBluetooth works only on the main thread or a"
+ << "thread with a running CFRunLoop";
+ }
+}
+
+#endif // !QT_IOS_BLUETOOTH
// Apple has: CBUUID, NSUUID, CFUUID, IOBluetoothSDPUUID