--- src/bluetooth/osx/osxbtcentralmanager.mm.orig 2015-10-12 21:35:37.000000000 -0700 +++ src/bluetooth/osx/osxbtcentralmanager.mm 2017-09-23 11:09:40.000000000 -0700 @@ -1032,10 +1032,19 @@ using namespace OSXBluetooth; +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) || QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(101300) + const CBManagerState state = central.state; +#else const CBCentralManagerState state = central.state; +#endif +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) || QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(101300) + if (state == CBManagerStateUnknown + || state == CBManagerStateResetting) { +#else if (state == CBCentralManagerStateUnknown || state == CBCentralManagerStateResetting) { +#endif // We still have to wait, docs say: // "The current state of the central manager is unknown; // an update is imminent." or @@ -1051,7 +1060,11 @@ } // Let's check some states we do not like first: +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) || QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(101300) + if (state == CBManagerStateUnsupported || state == CBManagerStateUnauthorized) { +#else if (state == CBCentralManagerStateUnsupported || state == CBCentralManagerStateUnauthorized) { +#endif if (managerState == CentralManagerUpdating) { // We tried to connect just to realize, LE is not supported. Report this. managerState = CentralManagerIdle; @@ -1065,7 +1078,11 @@ return; } +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) || QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(101300) + if (state == CBManagerStatePoweredOff) { +#else if (state == CBCentralManagerStatePoweredOff) { +#endif if (managerState == CentralManagerUpdating) { // I've seen this instead of Unsopported on OS X. managerState = CentralManagerIdle; @@ -1079,7 +1096,11 @@ return; } +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) || QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(101300) + if (state == CBManagerStatePoweredOn) { +#else if (state == CBCentralManagerStatePoweredOn) { +#endif if (managerState == CentralManagerUpdating) { managerState = CentralManagerIdle; const QLowEnergyController::Error status = [self connectToDevice]; --- src/bluetooth/osx/osxbtledeviceinquiry.mm.orig 2017-09-23 10:38:46.000000000 -0700 +++ src/bluetooth/osx/osxbtledeviceinquiry.mm 2017-09-23 11:19:35.000000000 -0700 @@ -216,8 +216,13 @@ return; } +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) || QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(101300) + const CBManagerState state = central.state; + if (state == CBManagerStatePoweredOn) { +#else const CBCentralManagerState state = central.state; if (state == CBCentralManagerStatePoweredOn) { +#endif if (pendingStart) { pendingStart = false; isActive = true; @@ -229,7 +234,11 @@ startTime = QTime::currentTime(); [manager scanForPeripheralsWithServices:nil options:nil]; } // Else we ignore. +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) || QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(101300) + } else if (state == CBManagerStateUnsupported || state == CBManagerStateUnauthorized) { +#else } else if (state == CBCentralManagerStateUnsupported || state == CBCentralManagerStateUnauthorized) { +#endif if (pendingStart) { pendingStart = false; delegate->LEnotSupported(); @@ -242,7 +251,11 @@ [manager stopScan]; delegate->LEdeviceInquiryError(QBluetoothDeviceDiscoveryAgent::PoweredOffError); } +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) || QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(101300) + } else if (state == CBManagerStatePoweredOff) { +#else } else if (state == CBCentralManagerStatePoweredOff) { +#endif if (pendingStart) { pendingStart = false; delegate->LEnotSupported();