diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2016-10-11 15:36:14 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2016-10-12 11:30:14 +0200 |
commit | 515ff5b0f9a2245a13cec6f2d37edd1715cdae8c (patch) | |
tree | 3a7748f578d772a5a4e9bcd8b09168657146d695 | |
parent | ca661f332886760f2154ed7ed14550722c554943 (diff) | |
parent | 7b443cd0fdd1940a8bfaad73df5e309a52b7669f (diff) |
Merge remote-tracking branch 'gerrit/5.7' into 5.8v5.8.0-beta1
Conflicts:
src/bluetooth/osx/osxbtledeviceinquiry.mm
src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm
Change-Id: I7dc75c187af73917f31c28b9edfaf8bcf9652a3e
32 files changed, 104 insertions, 117 deletions
diff --git a/src/bluetooth/osx/corebluetoothwrapper_p.h b/src/bluetooth/osx/osxbluetooth_p.h index 1d67c6ba..93842e77 100644 --- a/src/bluetooth/osx/corebluetoothwrapper_p.h +++ b/src/bluetooth/osx/osxbluetooth_p.h @@ -37,8 +37,9 @@ ** ****************************************************************************/ -#ifndef COREBLUETOOTHWRAPPER_P_H -#define COREBLUETOOTHWRAPPER_P_H +#ifndef OSXBLUETOOTH_P_H +#define OSXBLUETOOTH_P_H + // // W A R N I N G @@ -51,37 +52,49 @@ // We mean it. // +#include <QtCore/qglobal.h> + #ifndef QT_OSX_BLUETOOTH -#import <CoreBluetooth/CoreBluetooth.h> +#include <CoreBluetooth/CoreBluetooth.h> #else -#include <QtCore/qglobal.h> +#if QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12) + +#include <CoreBluetooth/CoreBluetooth.h> +#include <IOBluetooth/IOBluetooth.h> + +#else -// CoreBluetooth with SDK 10.9 seems to be broken: the class CBPeripheralManager is enabled on OS X 10.9, +// CoreBluetooth with SDK 10.9 seems to be broken: the class CBPeripheralManager is enabled on macOS // but some of its declarations are using a disabled enum CBPeripheralAuthorizationStatus // (disabled using __attribute__ syntax and NS_ENUM_AVAILABLE macro). // This + -std=c++11 ends with a compilation error. For the SDK 10.9 we can: -// either undefine NS_ENUM_AVAILABLE macro (it works somehow) and redefine it as an empty sequence of pp-tokens or -// define __attribute__ as an empty sequence. Both solutions look quite ugly. +// 1. either undefine NS_ENUM_AVAILABLE macro (it works somehow) and redefine it as an empty sequence +// of pp-tokens or +// 2. define __attribute__ as an empty sequence. Both solutions look quite ugly. #if QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9) && !QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10) -#define CB_ERROR_WORKAROUND_REQUIRED -#endif -#ifdef CB_ERROR_WORKAROUND_REQUIRED +// Must be included BEFORE CoreBluetooth.h: +#include <Foundation/Foundation.h> + +#define CB_ERROR_WORKAROUND_REQUIRED #undef NS_ENUM_AVAILABLE #define NS_ENUM_AVAILABLE(_mac, _ios) -#endif -#import <IOBluetooth/IOBluetooth.h> +#endif // SDK version == 10.9 + +// In SDK below 10.12 IOBluetooth.h includes CoreBluetooth.h. +#include <IOBluetooth/IOBluetooth.h> #ifdef CB_ERROR_WORKAROUND_REQUIRED #undef __attribute__ #undef CB_ERROR_WORKAROUND_REQUIRED -#endif +#endif // WORKAROUND -#endif // QT_OSX_BLUETOOTH +#endif // SDK -#endif // COREBLUETOOTHWRAPPER_P_H +#endif // QT_OSX_BLUETOOTH +#endif // OSXBLUETOOTH_P_H diff --git a/src/bluetooth/osx/osxbt.pri b/src/bluetooth/osx/osxbt.pri index 8d5486f4..13187e4f 100644 --- a/src/bluetooth/osx/osxbt.pri +++ b/src/bluetooth/osx/osxbt.pri @@ -15,7 +15,7 @@ CONFIG(osx) { osx/osxbtsocketlistener_p.h \ osx/osxbtobexsession_p.h \ osx/osxbtledeviceinquiry_p.h \ - osx/corebluetoothwrapper_p.h \ + osx/osxbluetooth_p.h \ osx/osxbtcentralmanager_p.h \ osx/osxbtnotifier_p.h \ osx/osxbtperipheralmanager_p.h @@ -37,7 +37,7 @@ CONFIG(osx) { } else { PRIVATE_HEADERS += osx/osxbtutility_p.h \ osx/osxbtledeviceinquiry_p.h \ - osx/corebluetoothwrapper_p.h \ + osx/osxbluetooth_p.h \ osx/osxbtcentralmanager_p.h \ osx/osxbtnotifier_p.h ios { 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]; diff --git a/src/bluetooth/osx/osxbtcentralmanager_p.h b/src/bluetooth/osx/osxbtcentralmanager_p.h index 5453822f..697d922c 100644 --- a/src/bluetooth/osx/osxbtcentralmanager_p.h +++ b/src/bluetooth/osx/osxbtcentralmanager_p.h @@ -55,18 +55,15 @@ #include "qlowenergyservice.h" #include "qbluetoothuuid.h" #include "osxbtutility_p.h" +#include "osxbluetooth_p.h" #include <QtCore/qbytearray.h> #include <QtCore/qglobal.h> #include <QtCore/qqueue.h> #include <QtCore/qhash.h> -// Foundation.h must be included before corebluetoothwrapper_p.h - -// a workaround for a broken 10.9 SDK. #include <Foundation/Foundation.h> -#include "corebluetoothwrapper_p.h" - @class QT_MANGLE_NAMESPACE(OSXBTCentralManager); QT_BEGIN_NAMESPACE diff --git a/src/bluetooth/osx/osxbtconnectionmonitor.mm b/src/bluetooth/osx/osxbtconnectionmonitor.mm index 6cbe9b01..dcd38726 100644 --- a/src/bluetooth/osx/osxbtconnectionmonitor.mm +++ b/src/bluetooth/osx/osxbtconnectionmonitor.mm @@ -42,10 +42,6 @@ #include <QtCore/qdebug.h> -// Import, since these headers are not protected from the multiple inclusion. -#import <IOBluetooth/objc/IOBluetoothUserNotification.h> -#import <IOBluetooth/objc/IOBluetoothDevice.h> - QT_BEGIN_NAMESPACE namespace OSXBluetooth { diff --git a/src/bluetooth/osx/osxbtconnectionmonitor_p.h b/src/bluetooth/osx/osxbtconnectionmonitor_p.h index 7f95db87..18ffc86a 100644 --- a/src/bluetooth/osx/osxbtconnectionmonitor_p.h +++ b/src/bluetooth/osx/osxbtconnectionmonitor_p.h @@ -52,14 +52,13 @@ // #include "qbluetoothaddress.h" +#include "osxbluetooth_p.h" #include <QtCore/qglobal.h> #include <Foundation/Foundation.h> @class QT_MANGLE_NAMESPACE(OSXBTConnectionMonitor); -@class IOBluetoothUserNotification; -@class IOBluetoothDevice; QT_BEGIN_NAMESPACE diff --git a/src/bluetooth/osx/osxbtdeviceinquiry.mm b/src/bluetooth/osx/osxbtdeviceinquiry.mm index 870a9c88..79a8a92c 100644 --- a/src/bluetooth/osx/osxbtdeviceinquiry.mm +++ b/src/bluetooth/osx/osxbtdeviceinquiry.mm @@ -43,7 +43,6 @@ #include <QtCore/qloggingcategory.h> #include <QtCore/qdebug.h> - QT_BEGIN_NAMESPACE namespace OSXBluetooth { @@ -57,11 +56,7 @@ DeviceInquiryDelegate::~DeviceInquiryDelegate() QT_END_NAMESPACE - -#ifdef QT_NAMESPACE -// We do not want to litter a code with QT_PREPEND_NAMESPACE, right? -using namespace QT_NAMESPACE; -#endif +QT_USE_NAMESPACE @implementation QT_MANGLE_NAMESPACE(OSXBTDeviceInquiry) diff --git a/src/bluetooth/osx/osxbtdeviceinquiry_p.h b/src/bluetooth/osx/osxbtdeviceinquiry_p.h index 13227839..777184f9 100644 --- a/src/bluetooth/osx/osxbtdeviceinquiry_p.h +++ b/src/bluetooth/osx/osxbtdeviceinquiry_p.h @@ -51,10 +51,9 @@ // We mean it. // -#include <QtCore/qglobal.h> +#include "osxbluetooth_p.h" -// We have to import objc code (it does not have inclusion guards). -#import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h> +#include <QtCore/qglobal.h> #include <Foundation/Foundation.h> #include <IOKit/IOReturn.h> diff --git a/src/bluetooth/osx/osxbtdevicepair.mm b/src/bluetooth/osx/osxbtdevicepair.mm index e2d96ce4..dcaa3536 100644 --- a/src/bluetooth/osx/osxbtdevicepair.mm +++ b/src/bluetooth/osx/osxbtdevicepair.mm @@ -66,10 +66,7 @@ PairingDelegate::~PairingDelegate() QT_END_NAMESPACE - -#ifdef QT_NAMESPACE -using namespace QT_NAMESPACE; -#endif +QT_USE_NAMESPACE @implementation QT_MANGLE_NAMESPACE(OSXBTPairing) diff --git a/src/bluetooth/osx/osxbtdevicepair_p.h b/src/bluetooth/osx/osxbtdevicepair_p.h index 35709734..d5db5e35 100644 --- a/src/bluetooth/osx/osxbtdevicepair_p.h +++ b/src/bluetooth/osx/osxbtdevicepair_p.h @@ -53,15 +53,13 @@ #include "qbluetoothaddress.h" #include "osxbtutility_p.h" +#include "osxbluetooth_p.h" #include <QtCore/qglobal.h> #include <Foundation/Foundation.h> -// Only after Foundation.h: -#include "corebluetoothwrapper_p.h" @class QT_MANGLE_NAMESPACE(OSXBTPairing); -@class IOBluetoothDevice; QT_BEGIN_NAMESPACE diff --git a/src/bluetooth/osx/osxbtl2capchannel.mm b/src/bluetooth/osx/osxbtl2capchannel.mm index 3156c0d2..02ec4f90 100644 --- a/src/bluetooth/osx/osxbtl2capchannel.mm +++ b/src/bluetooth/osx/osxbtl2capchannel.mm @@ -45,9 +45,7 @@ #include <QtCore/qloggingcategory.h> #include <QtCore/qdebug.h> -#ifdef QT_NAMESPACE -using namespace QT_NAMESPACE; -#endif +QT_USE_NAMESPACE @implementation QT_MANGLE_NAMESPACE(OSXBTL2CAPChannel) diff --git a/src/bluetooth/osx/osxbtl2capchannel_p.h b/src/bluetooth/osx/osxbtl2capchannel_p.h index 7bc88102..a8a08975 100644 --- a/src/bluetooth/osx/osxbtl2capchannel_p.h +++ b/src/bluetooth/osx/osxbtl2capchannel_p.h @@ -51,11 +51,11 @@ // We mean it. // +#include "osxbluetooth_p.h" + #include <QtCore/qglobal.h> #include <Foundation/Foundation.h> -// Only after Foundation.h: -#include "corebluetoothwrapper_p.h" #include <cstddef> @@ -71,8 +71,6 @@ class ChannelDelegate; QT_END_NAMESPACE -@class IOBluetoothDevice; - @interface QT_MANGLE_NAMESPACE(OSXBTL2CAPChannel) : NSObject<IOBluetoothL2CAPChannelDelegate> { QT_PREPEND_NAMESPACE(OSXBluetooth)::ChannelDelegate *delegate; diff --git a/src/bluetooth/osx/osxbtledeviceinquiry.mm b/src/bluetooth/osx/osxbtledeviceinquiry.mm index 7f522c14..8b924d82 100644 --- a/src/bluetooth/osx/osxbtledeviceinquiry.mm +++ b/src/bluetooth/osx/osxbtledeviceinquiry.mm @@ -46,8 +46,6 @@ #include <QtCore/qloggingcategory.h> #include <QtCore/qdebug.h> -#include "corebluetoothwrapper_p.h" - #include <algorithm> QT_BEGIN_NAMESPACE @@ -196,8 +194,13 @@ QT_USE_NAMESPACE dispatch_queue_t leQueue(qt_LE_queue()); Q_ASSERT(leQueue); - const CBCentralManagerState cbState(central.state); - if (cbState == CBCentralManagerStatePoweredOn) { +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) + const CBManagerState state(central.state); + if (state == CBManagerStatePoweredOn) { +#else + const CBCentralManagerState state(central.state); + if (state == CBCentralManagerStatePoweredOn) { +#endif if (internalState == InquiryStarting) { internalState = InquiryActive; @@ -218,8 +221,11 @@ QT_USE_NAMESPACE [manager scanForPeripheralsWithServices:nil options:nil]; } // Else we ignore. - } else if (cbState == CBCentralManagerStateUnsupported - || cbState == CBCentralManagerStateUnauthorized) { +#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, @@ -232,7 +238,11 @@ QT_USE_NAMESPACE } [manager setDelegate:nil]; - } else if (cbState == CBCentralManagerStatePoweredOff) { +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) + } else if (state == CBManagerStatePoweredOff) { +#else + } else if (state == CBCentralManagerStatePoweredOff) { +#endif if (internalState == InquiryStarting) { #ifndef Q_OS_OSX // On iOS a user can see at this point an alert asking to diff --git a/src/bluetooth/osx/osxbtledeviceinquiry_p.h b/src/bluetooth/osx/osxbtledeviceinquiry_p.h index d79272be..b58904e6 100644 --- a/src/bluetooth/osx/osxbtledeviceinquiry_p.h +++ b/src/bluetooth/osx/osxbtledeviceinquiry_p.h @@ -54,6 +54,7 @@ #include "qbluetoothdevicediscoveryagent.h" #include "qbluetoothdeviceinfo.h" #include "osxbtutility_p.h" +#include "osxbluetooth_p.h" #include <QtCore/qelapsedtimer.h> #include <QtCore/qglobal.h> @@ -61,9 +62,6 @@ #include <Foundation/Foundation.h> -@class CBCentralManager; -@class CBPeripheral; - QT_BEGIN_NAMESPACE class QBluetoothUuid; diff --git a/src/bluetooth/osx/osxbtobexsession.mm b/src/bluetooth/osx/osxbtobexsession.mm index 9fd82487..b8e604c8 100644 --- a/src/bluetooth/osx/osxbtobexsession.mm +++ b/src/bluetooth/osx/osxbtobexsession.mm @@ -405,11 +405,7 @@ bool check_abort_event(const OBEXSessionEvent *e, OBEXError &error, OBEXOpCode & QT_END_NAMESPACE -#ifdef QT_NAMESPACE - -using namespace QT_NAMESPACE; - -#endif +QT_USE_NAMESPACE @interface QT_MANGLE_NAMESPACE(OSXBTOBEXSession) (PrivateAPI) diff --git a/src/bluetooth/osx/osxbtobexsession_p.h b/src/bluetooth/osx/osxbtobexsession_p.h index dfb3d48a..78c93452 100644 --- a/src/bluetooth/osx/osxbtobexsession_p.h +++ b/src/bluetooth/osx/osxbtobexsession_p.h @@ -48,15 +48,12 @@ // We mean it. // +#include "osxbluetooth_p.h" + #include <QtCore/qvariant.h> #include <QtCore/qglobal.h> #include <Foundation/Foundation.h> -// Only after Foundation.h: -#include "corebluetoothwrapper_p.h" - -@class IOBluetoothOBEXSession; -@class IOBluetoothDevice; @class QT_MANGLE_NAMESPACE(OSXBTOBEXSession); diff --git a/src/bluetooth/osx/osxbtperipheralmanager_p.h b/src/bluetooth/osx/osxbtperipheralmanager_p.h index 481a9fab..30ddd073 100644 --- a/src/bluetooth/osx/osxbtperipheralmanager_p.h +++ b/src/bluetooth/osx/osxbtperipheralmanager_p.h @@ -58,11 +58,9 @@ #include <deque> #include <map> -// Foundation.h must be included before corebluetoothwrapper_p.h - -// a workaround for a broken 10.9 SDK. #include <Foundation/Foundation.h> -#include "corebluetoothwrapper_p.h" +#include "osxbluetooth_p.h" QT_BEGIN_NAMESPACE diff --git a/src/bluetooth/osx/osxbtrfcommchannel.mm b/src/bluetooth/osx/osxbtrfcommchannel.mm index 08e8c53a..ea679ec8 100644 --- a/src/bluetooth/osx/osxbtrfcommchannel.mm +++ b/src/bluetooth/osx/osxbtrfcommchannel.mm @@ -42,9 +42,7 @@ #include "qbluetoothaddress.h" #include "osxbtutility_p.h" -#ifdef QT_NAMESPACE -using namespace QT_NAMESPACE; -#endif +QT_USE_NAMESPACE @implementation QT_MANGLE_NAMESPACE(OSXBTRFCOMMChannel) diff --git a/src/bluetooth/osx/osxbtrfcommchannel_p.h b/src/bluetooth/osx/osxbtrfcommchannel_p.h index 89d765d8..bb615559 100644 --- a/src/bluetooth/osx/osxbtrfcommchannel_p.h +++ b/src/bluetooth/osx/osxbtrfcommchannel_p.h @@ -51,14 +51,13 @@ // We mean it. // +#include "osxbluetooth_p.h" + #include <QtCore/qglobal.h> #include <Foundation/Foundation.h> -// Only after Foundation.h: -#include "corebluetoothwrapper_p.h" @class QT_MANGLE_NAMESPACE(OSXBTRFCOMMChannel); -@class IOBluetoothDevice; QT_BEGIN_NAMESPACE diff --git a/src/bluetooth/osx/osxbtsdpinquiry.mm b/src/bluetooth/osx/osxbtsdpinquiry.mm index 490ae234..a0bfdeef 100644 --- a/src/bluetooth/osx/osxbtsdpinquiry.mm +++ b/src/bluetooth/osx/osxbtsdpinquiry.mm @@ -42,12 +42,9 @@ #include "qbluetoothuuid.h" #include "osxbtutility_p.h" - #include <QtCore/qvariant.h> #include <QtCore/qstring.h> -#include "corebluetoothwrapper_p.h" - QT_BEGIN_NAMESPACE namespace OSXBluetooth { @@ -141,10 +138,7 @@ QList<QBluetoothUuid> extract_services_uuids(IOBluetoothDevice *device) QT_END_NAMESPACE - -#ifdef QT_NAMESPACE -using namespace QT_NAMESPACE; -#endif +QT_USE_NAMESPACE using namespace OSXBluetooth; diff --git a/src/bluetooth/osx/osxbtsdpinquiry_p.h b/src/bluetooth/osx/osxbtsdpinquiry_p.h index ea75e649..6b39634e 100644 --- a/src/bluetooth/osx/osxbtsdpinquiry_p.h +++ b/src/bluetooth/osx/osxbtsdpinquiry_p.h @@ -53,6 +53,7 @@ #include "qbluetoothaddress.h" #include "qbluetoothuuid.h" +#include "osxbluetooth_p.h" #include <QtCore/qglobal.h> #include <QtCore/qlist.h> @@ -60,9 +61,6 @@ #include <Foundation/Foundation.h> @class QT_MANGLE_NAMESPACE(OSXBTSDPInquiry); -@class IOBluetoothSDPServiceRecord; -@class IOBluetoothSDPDataElement; -@class IOBluetoothDevice; QT_BEGIN_NAMESPACE diff --git a/src/bluetooth/osx/osxbtservicerecord.mm b/src/bluetooth/osx/osxbtservicerecord.mm index 11dcac88..d12169bb 100644 --- a/src/bluetooth/osx/osxbtservicerecord.mm +++ b/src/bluetooth/osx/osxbtservicerecord.mm @@ -39,14 +39,13 @@ #include "qbluetoothserviceinfo.h" #include "osxbtservicerecord_p.h" +#include "osxbluetooth_p.h" #include <QtCore/qvariant.h> #include <QtCore/qdebug.h> #include <QtCore/qmap.h> #include <QtCore/qurl.h> -#include "corebluetoothwrapper_p.h" - QT_BEGIN_NAMESPACE namespace OSXBluetooth { diff --git a/src/bluetooth/osx/osxbtsocketlistener.mm b/src/bluetooth/osx/osxbtsocketlistener.mm index 5b004f94..52243990 100644 --- a/src/bluetooth/osx/osxbtsocketlistener.mm +++ b/src/bluetooth/osx/osxbtsocketlistener.mm @@ -42,8 +42,6 @@ #include <QtCore/qdebug.h> -#include "corebluetoothwrapper_p.h" - QT_BEGIN_NAMESPACE namespace OSXBluetooth { @@ -56,11 +54,7 @@ SocketListener::~SocketListener() QT_END_NAMESPACE -#ifdef QT_NAMESPACE - -using namespace QT_NAMESPACE; - -#endif +QT_USE_NAMESPACE @implementation QT_MANGLE_NAMESPACE(OSXBTSocketListener) diff --git a/src/bluetooth/osx/osxbtsocketlistener_p.h b/src/bluetooth/osx/osxbtsocketlistener_p.h index 4a362763..afe3eadc 100644 --- a/src/bluetooth/osx/osxbtsocketlistener_p.h +++ b/src/bluetooth/osx/osxbtsocketlistener_p.h @@ -51,14 +51,12 @@ // We mean it. // +#include "osxbluetooth_p.h" + #include <QtCore/qglobal.h> #include <Foundation/Foundation.h> -#include <IOBluetooth/Bluetooth.h> -@class IOBluetoothUserNotification; -@class IOBluetoothRFCOMMChannel; -@class IOBluetoothL2CAPChannel; @class QT_MANGLE_NAMESPACE(OSXBTSocketListener); QT_BEGIN_NAMESPACE diff --git a/src/bluetooth/osx/osxbtutility.mm b/src/bluetooth/osx/osxbtutility.mm index 29159cdb..adbc327b 100644 --- a/src/bluetooth/osx/osxbtutility.mm +++ b/src/bluetooth/osx/osxbtutility.mm @@ -48,6 +48,9 @@ #ifndef QT_IOS_BLUETOOTH #import <IOBluetooth/objc/IOBluetoothSDPUUID.h> +#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12, __IPHONE_NA) +#import <CoreBluetooth/CBUUID.h> +#endif #endif diff --git a/src/bluetooth/osx/osxbtutility_p.h b/src/bluetooth/osx/osxbtutility_p.h index 28ecfec9..2d11692d 100644 --- a/src/bluetooth/osx/osxbtutility_p.h +++ b/src/bluetooth/osx/osxbtutility_p.h @@ -51,15 +51,13 @@ // We mean it. // +#include "osxbluetooth_p.h" + #include <QtCore/qloggingcategory.h> #include <QtCore/qscopedpointer.h> #include <QtCore/qglobal.h> #include <Foundation/Foundation.h> -// Only after Foundation.h! -#include "corebluetoothwrapper_p.h" - -@class CBUUID; QT_BEGIN_NAMESPACE diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm b/src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm index 933049d8..b308f7cc 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm @@ -45,6 +45,8 @@ #include "qbluetoothdeviceinfo.h" #include "osx/osxbtnotifier_p.h" #include "osx/osxbtutility_p.h" +#include "osx/osxbluetooth_p.h" +#include "osx/uistrings_p.h" #include "qbluetoothhostinfo.h" #include "qbluetoothaddress.h" #include "osx/uistrings_p.h" @@ -58,8 +60,6 @@ #include <QtCore/qlist.h> #include <Foundation/Foundation.h> -// Only after Foundation.h: -#include "osx/corebluetoothwrapper_p.h" QT_BEGIN_NAMESPACE diff --git a/src/bluetooth/qbluetoothlocaldevice_osx.mm b/src/bluetooth/qbluetoothlocaldevice_osx.mm index 9fa060d2..45fa310a 100644 --- a/src/bluetooth/qbluetoothlocaldevice_osx.mm +++ b/src/bluetooth/qbluetoothlocaldevice_osx.mm @@ -42,6 +42,7 @@ #include "qbluetoothlocaldevice.h" #include "osx/osxbtdevicepair_p.h" #include "osx/osxbtutility_p.h" +#include "osx/osxbluetooth_p.h" #include <QtCore/qloggingcategory.h> #include <QtCore/qstring.h> @@ -51,8 +52,6 @@ #include <Foundation/Foundation.h> -// Only after Foundation.h: -#include "osx/corebluetoothwrapper_p.h" #include <algorithm> diff --git a/src/bluetooth/qbluetoothserver_osx.mm b/src/bluetooth/qbluetoothserver_osx.mm index 3828263c..8896651d 100644 --- a/src/bluetooth/qbluetoothserver_osx.mm +++ b/src/bluetooth/qbluetoothserver_osx.mm @@ -48,6 +48,7 @@ #include "qbluetoothlocaldevice.h" #include "osx/osxbtutility_p.h" +#include "osx/osxbluetooth_p.h" #include "qbluetoothserver.h" #include "qbluetoothsocket.h" @@ -59,8 +60,6 @@ // Import, since Obj-C headers do not have inclusion guards. #include <Foundation/Foundation.h> -// Only after Foundation.h -#include "osx/corebluetoothwrapper_p.h" #include <limits> diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm b/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm index dc9d4ee9..4a52b379 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm +++ b/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm @@ -43,6 +43,7 @@ #include "osx/osxbtsdpinquiry_p.h" #include "qbluetoothhostinfo.h" #include "osx/osxbtutility_p.h" +#include "osx/osxbluetooth_p.h" #include "osx/uistrings_p.h" #include <QtCore/qloggingcategory.h> @@ -53,8 +54,6 @@ #include <QtCore/qlist.h> #include <Foundation/Foundation.h> -// Only after Foundation.h -#include "osx/corebluetoothwrapper_p.h" QT_BEGIN_NAMESPACE diff --git a/src/bluetooth/qbluetoothserviceinfo_osx.mm b/src/bluetooth/qbluetoothserviceinfo_osx.mm index 67392226..a25653ab 100644 --- a/src/bluetooth/qbluetoothserviceinfo_osx.mm +++ b/src/bluetooth/qbluetoothserviceinfo_osx.mm @@ -42,6 +42,7 @@ #include "qbluetoothserviceinfo.h" #include "qbluetoothdeviceinfo.h" #include "osx/osxbtutility_p.h" +#include "osx/osxbluetooth_p.h" #include <QtCore/qloggingcategory.h> #include <QtCore/qvariant.h> @@ -51,8 +52,6 @@ #include <QtCore/qurl.h> #include <Foundation/Foundation.h> -// Only after Foundation.h: -#include "osx/corebluetoothwrapper_p.h" QT_BEGIN_NAMESPACE diff --git a/src/bluetooth/qbluetoothsocket_p.cpp b/src/bluetooth/qbluetoothsocket_p.cpp index 5ebba4ad..6007b924 100644 --- a/src/bluetooth/qbluetoothsocket_p.cpp +++ b/src/bluetooth/qbluetoothsocket_p.cpp @@ -131,7 +131,7 @@ qint64 QBluetoothSocketPrivate::readData(char *data, qint64 maxSize) Q_Q(QBluetoothSocket); if (state != QBluetoothSocket::ConnectedState) { - errorString = QBluetoothSocket::tr("Cannot write while not connected"); + errorString = QBluetoothSocket::tr("Cannot read while not connected"); q->setSocketError(QBluetoothSocket::OperationError); return -1; } |