summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/osx/osxbtcentralmanager.mm
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2015-10-01 10:33:42 +0200
committerTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2015-10-08 07:13:20 +0000
commit371818e71839280abafae858e9bb53c4ee6b9e5e (patch)
tree9dacde59e220ca9b79a218d8d24c9806fe9cee6d /src/bluetooth/osx/osxbtcentralmanager.mm
parent81a8a8771f987ebfefbffc1a7a4003cbf0a1760d (diff)
CoreBluetooth - update for iOS 9.0
New SDK removed deprecated properties/methods and we have a compilation error as a result. Use performSelector instead of direct calls to make sure: 1. it compiles 2. it calls an existing method. Task-number:QTBUG-48518 Change-Id: I10a2d062f9e71229a1e218d9d167a4132b97b6ab Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/osx/osxbtcentralmanager.mm')
-rw-r--r--src/bluetooth/osx/osxbtcentralmanager.mm19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/bluetooth/osx/osxbtcentralmanager.mm b/src/bluetooth/osx/osxbtcentralmanager.mm
index 08905da8..614e4ae5 100644
--- a/src/bluetooth/osx/osxbtcentralmanager.mm
+++ b/src/bluetooth/osx/osxbtcentralmanager.mm
@@ -201,8 +201,8 @@ using namespace QT_NAMESPACE;
return QLowEnergyController::ConnectionError;
}
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9, __IPHONE_6_0)
- if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_9, QSysInfo::MV_IOS_6_0)) {
+#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9, __IPHONE_7_0)
+ if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_9, QSysInfo::MV_IOS_7_0)) {
const quint128 qtUuidData(deviceUuid.toUInt128());
// STATIC_ASSERT on sizes would be handy!
uuid_t uuidData = {};
@@ -229,6 +229,12 @@ using namespace QT_NAMESPACE;
return QLowEnergyController::NoError;
}
#endif
+ // Either SDK or the target is below 10.9/7.0
+ if (![manager respondsToSelector:@selector(retrievePeripherals:)]) {
+ qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "failed to retrive a peripheral";
+ return QLowEnergyController::UnknownRemoteDeviceError;
+ }
+
OSXBluetooth::CFStrongReference<CFUUIDRef> cfUuid(OSXBluetooth::cf_uuid(deviceUuid));
if (!cfUuid) {
qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "failed to create CFUUID object";
@@ -238,7 +244,7 @@ using namespace QT_NAMESPACE;
[uuids addObject:(id)cfUuid.data()];
// Unfortunately, with old Core Bluetooth this call is asynchronous ...
managerState = OSXBluetooth::CentralManagerConnecting;
- [manager retrievePeripherals:uuids];
+ [manager performSelector:@selector(retrievePeripherals:) withObject:uuids.data()];
return QLowEnergyController::NoError;
}
@@ -272,7 +278,12 @@ using namespace QT_NAMESPACE;
if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_9, QSysInfo::MV_IOS_7_0))
return peripheral.state == CBPeripheralStateConnected;
#endif
- return peripheral.isConnected;
+ // Either SDK or the target is below 10.9/7.0 ...
+ if (![peripheral respondsToSelector:@selector(isConnected)])
+ return false;
+
+ // Ugly cast to deal with id being a pointer ...
+ return reinterpret_cast<quintptr>([peripheral performSelector:@selector(isConnected)]);
}
- (void)disconnectFromDevice