summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/osx/osxbtutility.mm
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2017-05-19 09:05:48 +0200
committerAlex Blasche <alexander.blasche@qt.io>2017-05-19 09:06:07 +0200
commitca5490859338f28e30104668a353275d23df1ec6 (patch)
tree98df1ca5a4cb3852f03496bb0bf4e13d838063a2 /src/bluetooth/osx/osxbtutility.mm
parent4976498621fb05804201dad52eab2c59d94f0da3 (diff)
parent4593b79d84b9c8cc818d3c30e3882d699228339f (diff)
Merge remote-tracking branch 'gerrit/5.9' into btle
Diffstat (limited to 'src/bluetooth/osx/osxbtutility.mm')
-rw-r--r--src/bluetooth/osx/osxbtutility.mm18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/bluetooth/osx/osxbtutility.mm b/src/bluetooth/osx/osxbtutility.mm
index 29159cdb..1508c89f 100644
--- a/src/bluetooth/osx/osxbtutility.mm
+++ b/src/bluetooth/osx/osxbtutility.mm
@@ -48,6 +48,9 @@
#ifndef QT_IOS_BLUETOOTH
#import <IOBluetooth/objc/IOBluetoothSDPUUID.h>
+#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12, __IPHONE_NA)
+#import <CoreBluetooth/CBUUID.h>
+#endif
#endif
@@ -69,6 +72,8 @@ Q_LOGGING_CATEGORY(QT_BT_OSX, "qt.bluetooth.ios")
namespace OSXBluetooth {
const int defaultLEScanTimeoutMS = 25000;
+// We use it only on iOS for now:
+const int maxValueLength = 512;
QString qt_address(NSString *address)
{
@@ -314,6 +319,19 @@ ObjCStrongReference<NSData> data_from_bytearray(const QByteArray & qtData)
return result;
}
+ObjCStrongReference<NSMutableData> mutable_data_from_bytearray(const QByteArray &qtData)
+{
+ using MutableData = ObjCStrongReference<NSMutableData>;
+
+ if (!qtData.size())
+ return MutableData([[NSMutableData alloc] init], false);
+
+ MutableData result([[NSMutableData alloc] initWithLength:qtData.size()], false);
+ [result replaceBytesInRange:NSMakeRange(0, qtData.size())
+ withBytes:qtData.constData()];
+ return result;
+}
+
// A small RAII class for a dispatch queue.
class SerialDispatchQueue
{