diff options
author | Timur Pocheptsov <Timur.Pocheptsov@digia.com> | 2015-02-06 09:49:40 +0100 |
---|---|---|
committer | Timur Pocheptsov <Timur.Pocheptsov@digia.com> | 2015-02-06 11:34:19 +0000 |
commit | f3934083d37149acaa5065dce33fa55bd3dd7c71 (patch) | |
tree | 895b1384b0f559b38343eae3e2cddae57a44e7cb /src/bluetooth/osx/osxbtledeviceinquiry.mm | |
parent | 35be7aecc06f6e2bfe9b6a5a267d77c94dbe3a4a (diff) |
Bluetooth - runtime OS X/iOS version check
Add runtime checks, compile time is not enough.
Change-Id: I1821c9718d4e4af1e2d7989bd1ee7a1f11d5c051
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/osx/osxbtledeviceinquiry.mm')
-rw-r--r-- | src/bluetooth/osx/osxbtledeviceinquiry.mm | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/bluetooth/osx/osxbtledeviceinquiry.mm b/src/bluetooth/osx/osxbtledeviceinquiry.mm index dd5a5c73..6bbddcf9 100644 --- a/src/bluetooth/osx/osxbtledeviceinquiry.mm +++ b/src/bluetooth/osx/osxbtledeviceinquiry.mm @@ -45,6 +45,7 @@ #include "osxbtutility_p.h" #include <QtCore/qloggingcategory.h> +#include <QtCore/qsysinfo.h> #include <QtCore/qdebug.h> #include "corebluetoothwrapper_p.h" @@ -57,7 +58,6 @@ LEDeviceInquiryDelegate::~LEDeviceInquiryDelegate() { } -// TODO: check versions! #if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9, __IPHONE_6_0) QBluetoothUuid qt_uuid(NSUUID *nsUuid) @@ -72,7 +72,7 @@ QBluetoothUuid qt_uuid(NSUUID *nsUuid) return QBluetoothUuid(qtUuidData); } -#else +#endif QBluetoothUuid qt_uuid(CFUUIDRef uuid) { @@ -104,8 +104,6 @@ StringStrongReference uuid_as_nsstring(CFUUIDRef uuid) return StringStrongReference((NSString *)cfStr, false); } -#endif - } @@ -301,17 +299,20 @@ using namespace QT_NAMESPACE; #if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9, __IPHONE_6_0) - if (!peripheral.identifier) { - qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "peripheral without NSUUID"; - return; - } + if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_9, QSysInfo::MV_IOS_6_0)) { + if (!peripheral.identifier) { + qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "peripheral without NSUUID"; + return; + } - if (![peripherals objectForKey:peripheral.identifier]) { - [peripherals setObject:peripheral forKey:peripheral.identifier]; - const QBluetoothUuid deviceUuid(OSXBluetooth::qt_uuid(peripheral.identifier)); - delegate->LEdeviceFound(peripheral, deviceUuid, advertisementData, RSSI); + if (![peripherals objectForKey:peripheral.identifier]) { + [peripherals setObject:peripheral forKey:peripheral.identifier]; + const QBluetoothUuid deviceUuid(OSXBluetooth::qt_uuid(peripheral.identifier)); + delegate->LEdeviceFound(peripheral, deviceUuid, advertisementData, RSSI); + } + return; } -#else +#endif if (!peripheral.UUID) { qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "peripheral without UUID"; return; @@ -323,8 +324,6 @@ using namespace QT_NAMESPACE; const QBluetoothUuid deviceUuid(OSXBluetooth::qt_uuid(peripheral.UUID)); delegate->LEdeviceFound(peripheral, deviceUuid, advertisementData, RSSI); } -#endif - } - (bool)isActive |