diff options
Diffstat (limited to 'src/bluetooth/osx/osxbtcentralmanager.mm')
-rw-r--r-- | src/bluetooth/osx/osxbtcentralmanager.mm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/bluetooth/osx/osxbtcentralmanager.mm b/src/bluetooth/osx/osxbtcentralmanager.mm index 55a06021..f7218ca6 100644 --- a/src/bluetooth/osx/osxbtcentralmanager.mm +++ b/src/bluetooth/osx/osxbtcentralmanager.mm @@ -1032,10 +1032,19 @@ QT_END_NAMESPACE { using namespace OSXBluetooth; +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) + const CBManagerState state = central.state; +#else const CBCentralManagerState state = central.state; +#endif +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) + 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 @@ -1045,7 +1054,11 @@ QT_END_NAMESPACE } // Let's check some states we do not like first: +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) + 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; @@ -1061,7 +1074,11 @@ QT_END_NAMESPACE return; } +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) + if (state == CBManagerStatePoweredOff) { +#else if (state == CBCentralManagerStatePoweredOff) { +#endif managerState = CentralManagerIdle; if (managerState == CentralManagerUpdating) { // I've seen this instead of Unsupported on OS X. @@ -1076,7 +1093,11 @@ QT_END_NAMESPACE return; } +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) + if (state == CBManagerStatePoweredOn) { +#else if (state == CBCentralManagerStatePoweredOn) { +#endif if (managerState == CentralManagerUpdating && !disconnectPending) { managerState = CentralManagerIdle; [self retrievePeripheralAndConnect]; |