diff options
author | Mike Krus <mike.krus@kdab.com> | 2016-09-26 23:30:26 +0100 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2016-09-28 07:10:41 +0000 |
commit | e53f828a1644fab1821a7696c190777a3bbb1880 (patch) | |
tree | b6ac55419308a4de3e95c9c83d83031012d3a430 /src/bluetooth/osx/osxbtledeviceinquiry.mm | |
parent | 9dba73f30505ed7c220055788fba3cd201848fdb (diff) |
Handle iOS 10 deprecated data structures
iOS 10 (and tvOS 10) deprecates CBCentralManagerState enum
(and associated values). Replaced by CBManagerState enum.
Change-Id: I1c1bb0691403deaa6330949516846961c76865f5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/osx/osxbtledeviceinquiry.mm')
-rw-r--r-- | src/bluetooth/osx/osxbtledeviceinquiry.mm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/bluetooth/osx/osxbtledeviceinquiry.mm b/src/bluetooth/osx/osxbtledeviceinquiry.mm index f3a95820..5cf9b193 100644 --- a/src/bluetooth/osx/osxbtledeviceinquiry.mm +++ b/src/bluetooth/osx/osxbtledeviceinquiry.mm @@ -204,8 +204,13 @@ using namespace QT_NAMESPACE; dispatch_queue_t leQueue(qt_LE_queue()); Q_ASSERT(leQueue); +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) + const CBManagerState cbState(central.state); + if (cbState == CBManagerStatePoweredOn) { +#else const CBCentralManagerState cbState(central.state); if (cbState == CBCentralManagerStatePoweredOn) { +#endif if (internalState == InquiryStarting) { internalState = InquiryActive; // Scan time is actually 10 seconds. Having a block with such delay can prevent @@ -220,7 +225,11 @@ using namespace QT_NAMESPACE; }); [manager scanForPeripheralsWithServices:nil options:nil]; } // Else we ignore. +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) + } else if (state == CBManagerStateUnsupported || state == CBManagerStateUnauthorized) { +#else } else if (state == CBCentralManagerStateUnsupported || state == CBCentralManagerStateUnauthorized) { +#endif if (internalState == InquiryActive) { [manager stopScan]; // Not sure how this is possible at all, probably, can never happen. @@ -230,7 +239,11 @@ using namespace QT_NAMESPACE; } [manager setDelegate:nil]; +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) + } else if (cbState == CBManagerStatePoweredOff) { +#else } else if (cbState == CBCentralManagerStatePoweredOff) { +#endif if (internalState == InquiryStarting) { #ifndef Q_OS_OSX // On iOS a user can see at this point an alert asking to enable |