summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-10-03 11:22:51 +0200
committerTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-10-04 09:22:20 +0000
commit052e7ce371d4719df778ad8b378bcf1af14d294b (patch)
tree4dd88edd4fa8a107cbdf4b058fc881207cebe721
parentfa76dbf2b865f547b57803a0c38c9a86d8eab5e4 (diff)
CoreBluetooth - fix broken builds (macOS, iOS, tvOS, watchOS)
- With recent SDK changes CoreBluetooth is not in IOBluetooth anymore. This makes corebluetoothwrapper_p.h even uglier, now we have to care about v != 10.9 && v < 10.12; v == 10.9; v >= 10.12. - Using osxbluetooth_p.h we can get rid of forward declarations (for Obj-C classes) and weird includes like <IOBluetooth/IOBluetoothRFCOMChannel.h> - use osxbluetooth_p.h instead (and it will correctly include IOBluetooth/IOBluetooth.h etc.). Change-Id: Ia85ef2e2cc1ac7b15a58864ed25d85a0772e5c86 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/bluetooth/osx/osxbluetooth_p.h (renamed from src/bluetooth/osx/corebluetoothwrapper_p.h)43
-rw-r--r--src/bluetooth/osx/osxbt.pri4
-rw-r--r--src/bluetooth/osx/osxbtcentralmanager_p.h13
-rw-r--r--src/bluetooth/osx/osxbtconnectionmonitor.mm4
-rw-r--r--src/bluetooth/osx/osxbtconnectionmonitor_p.h3
-rw-r--r--src/bluetooth/osx/osxbtdeviceinquiry.mm7
-rw-r--r--src/bluetooth/osx/osxbtdeviceinquiry_p.h5
-rw-r--r--src/bluetooth/osx/osxbtdevicepair.mm5
-rw-r--r--src/bluetooth/osx/osxbtdevicepair_p.h4
-rw-r--r--src/bluetooth/osx/osxbtl2capchannel.mm4
-rw-r--r--src/bluetooth/osx/osxbtl2capchannel_p.h6
-rw-r--r--src/bluetooth/osx/osxbtledeviceinquiry.mm13
-rw-r--r--src/bluetooth/osx/osxbtledeviceinquiry_p.h4
-rw-r--r--src/bluetooth/osx/osxbtobexsession.mm6
-rw-r--r--src/bluetooth/osx/osxbtobexsession_p.h7
-rw-r--r--src/bluetooth/osx/osxbtrfcommchannel.mm4
-rw-r--r--src/bluetooth/osx/osxbtrfcommchannel_p.h5
-rw-r--r--src/bluetooth/osx/osxbtsdpinquiry.mm8
-rw-r--r--src/bluetooth/osx/osxbtsdpinquiry_p.h4
-rw-r--r--src/bluetooth/osx/osxbtservicerecord.mm3
-rw-r--r--src/bluetooth/osx/osxbtsocketlistener.mm8
-rw-r--r--src/bluetooth/osx/osxbtsocketlistener_p.h6
-rw-r--r--src/bluetooth/osx/osxbtutility_p.h6
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm3
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_osx.mm3
-rw-r--r--src/bluetooth/qbluetoothserver_osx.mm3
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_osx.mm3
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_osx.mm3
28 files changed, 61 insertions, 126 deletions
diff --git a/src/bluetooth/osx/corebluetoothwrapper_p.h b/src/bluetooth/osx/osxbluetooth_p.h
index fe057681..95c639b5 100644
--- a/src/bluetooth/osx/corebluetoothwrapper_p.h
+++ b/src/bluetooth/osx/osxbluetooth_p.h
@@ -31,8 +31,9 @@
**
****************************************************************************/
-#ifndef COREBLUETOOTHWRAPPER_P_H
-#define COREBLUETOOTHWRAPPER_P_H
+#ifndef OSXBLUETOOTH_P_H
+#define OSXBLUETOOTH_P_H
+
//
// W A R N I N G
@@ -45,37 +46,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 bb382866..5ca833cc 100644
--- a/src/bluetooth/osx/osxbt.pri
+++ b/src/bluetooth/osx/osxbt.pri
@@ -14,7 +14,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
@@ -34,7 +34,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
diff --git a/src/bluetooth/osx/osxbtcentralmanager_p.h b/src/bluetooth/osx/osxbtcentralmanager_p.h
index 68b32f32..122ee0af 100644
--- a/src/bluetooth/osx/osxbtcentralmanager_p.h
+++ b/src/bluetooth/osx/osxbtcentralmanager_p.h
@@ -49,26 +49,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"
-
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12, __IPHONE_NA)
-#include <CoreBluetooth/CBService.h>
-#include <CoreBluetooth/CBCharacteristic.h>
-#include <CoreBluetooth/CBDescriptor.h>
-#include <CoreBluetooth/CBCentralManager.h>
-#include <CoreBluetooth/CBPeripheral.h>
-#endif
-
@class QT_MANGLE_NAMESPACE(OSXBTCentralManager);
QT_BEGIN_NAMESPACE
diff --git a/src/bluetooth/osx/osxbtconnectionmonitor.mm b/src/bluetooth/osx/osxbtconnectionmonitor.mm
index 8228d135..fdaeaeaa 100644
--- a/src/bluetooth/osx/osxbtconnectionmonitor.mm
+++ b/src/bluetooth/osx/osxbtconnectionmonitor.mm
@@ -36,10 +36,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 38403ca5..76bd6da5 100644
--- a/src/bluetooth/osx/osxbtconnectionmonitor_p.h
+++ b/src/bluetooth/osx/osxbtconnectionmonitor_p.h
@@ -46,14 +46,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 6fb89e20..53881d6b 100644
--- a/src/bluetooth/osx/osxbtdeviceinquiry.mm
+++ b/src/bluetooth/osx/osxbtdeviceinquiry.mm
@@ -37,7 +37,6 @@
#include <QtCore/qloggingcategory.h>
#include <QtCore/qdebug.h>
-
QT_BEGIN_NAMESPACE
namespace OSXBluetooth {
@@ -51,11 +50,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 9589eaff..32a19a1e 100644
--- a/src/bluetooth/osx/osxbtdeviceinquiry_p.h
+++ b/src/bluetooth/osx/osxbtdeviceinquiry_p.h
@@ -45,10 +45,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 41c20b8b..63901803 100644
--- a/src/bluetooth/osx/osxbtdevicepair.mm
+++ b/src/bluetooth/osx/osxbtdevicepair.mm
@@ -61,10 +61,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 6a297eff..359aed44 100644
--- a/src/bluetooth/osx/osxbtdevicepair_p.h
+++ b/src/bluetooth/osx/osxbtdevicepair_p.h
@@ -47,15 +47,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 93e15012..f53632a2 100644
--- a/src/bluetooth/osx/osxbtl2capchannel.mm
+++ b/src/bluetooth/osx/osxbtl2capchannel.mm
@@ -39,9 +39,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 d46584cf..2eaaf334 100644
--- a/src/bluetooth/osx/osxbtl2capchannel_p.h
+++ b/src/bluetooth/osx/osxbtl2capchannel_p.h
@@ -45,11 +45,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>
@@ -65,8 +65,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 5a2f2dbd..df4dab69 100644
--- a/src/bluetooth/osx/osxbtledeviceinquiry.mm
+++ b/src/bluetooth/osx/osxbtledeviceinquiry.mm
@@ -40,13 +40,6 @@
#include <QtCore/qsysinfo.h>
#include <QtCore/qdebug.h>
-#include "corebluetoothwrapper_p.h"
-
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12, __IPHONE_NA)
-#import <CoreBluetooth/CBCentralManager.h>
-#import <CoreBluetooth/CBPeripheral.h>
-#endif
-
QT_BEGIN_NAMESPACE
namespace OSXBluetooth {
@@ -102,11 +95,7 @@ StringStrongReference uuid_as_nsstring(CFUUIDRef uuid)
QT_END_NAMESPACE
-#ifdef QT_NAMESPACE
-
-using namespace QT_NAMESPACE;
-
-#endif
+QT_USE_NAMESPACE
@interface QT_MANGLE_NAMESPACE(OSXBTLEDeviceInquiry) (PrivateAPI) <CBCentralManagerDelegate>
- (void)stopScan;
diff --git a/src/bluetooth/osx/osxbtledeviceinquiry_p.h b/src/bluetooth/osx/osxbtledeviceinquiry_p.h
index 9ca299ea..6ce008fb 100644
--- a/src/bluetooth/osx/osxbtledeviceinquiry_p.h
+++ b/src/bluetooth/osx/osxbtledeviceinquiry_p.h
@@ -48,6 +48,7 @@
#include "qbluetoothdevicediscoveryagent.h"
#include "qbluetoothdeviceinfo.h"
#include "osxbtutility_p.h"
+#include "osxbluetooth_p.h"
#include <QtCore/qelapsedtimer.h>
#include <QtCore/qglobal.h>
@@ -56,9 +57,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 f48da22d..f6c047ca 100644
--- a/src/bluetooth/osx/osxbtobexsession.mm
+++ b/src/bluetooth/osx/osxbtobexsession.mm
@@ -399,11 +399,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 0e72ecea..e06f5310 100644
--- a/src/bluetooth/osx/osxbtobexsession_p.h
+++ b/src/bluetooth/osx/osxbtobexsession_p.h
@@ -42,15 +42,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/osxbtrfcommchannel.mm b/src/bluetooth/osx/osxbtrfcommchannel.mm
index a91f62dc..faee503d 100644
--- a/src/bluetooth/osx/osxbtrfcommchannel.mm
+++ b/src/bluetooth/osx/osxbtrfcommchannel.mm
@@ -36,9 +36,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 5da685b2..9ffbc1fc 100644
--- a/src/bluetooth/osx/osxbtrfcommchannel_p.h
+++ b/src/bluetooth/osx/osxbtrfcommchannel_p.h
@@ -45,14 +45,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 004d9e61..2eaf06ee 100644
--- a/src/bluetooth/osx/osxbtsdpinquiry.mm
+++ b/src/bluetooth/osx/osxbtsdpinquiry.mm
@@ -36,12 +36,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 {
@@ -135,10 +132,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 1744c3f5..9678c5e1 100644
--- a/src/bluetooth/osx/osxbtsdpinquiry_p.h
+++ b/src/bluetooth/osx/osxbtsdpinquiry_p.h
@@ -47,6 +47,7 @@
#include "qbluetoothaddress.h"
#include "qbluetoothuuid.h"
+#include "osxbluetooth_p.h"
#include <QtCore/qglobal.h>
#include <QtCore/qlist.h>
@@ -54,9 +55,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 cd80ee63..2761b13a 100644
--- a/src/bluetooth/osx/osxbtservicerecord.mm
+++ b/src/bluetooth/osx/osxbtservicerecord.mm
@@ -33,14 +33,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 e3124dd1..511fa04d 100644
--- a/src/bluetooth/osx/osxbtsocketlistener.mm
+++ b/src/bluetooth/osx/osxbtsocketlistener.mm
@@ -36,8 +36,6 @@
#include <QtCore/qdebug.h>
-#include "corebluetoothwrapper_p.h"
-
QT_BEGIN_NAMESPACE
namespace OSXBluetooth {
@@ -50,11 +48,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 535153c7..b4c7c0ef 100644
--- a/src/bluetooth/osx/osxbtsocketlistener_p.h
+++ b/src/bluetooth/osx/osxbtsocketlistener_p.h
@@ -45,14 +45,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_p.h b/src/bluetooth/osx/osxbtutility_p.h
index 8816d6f3..f3170c1a 100644
--- a/src/bluetooth/osx/osxbtutility_p.h
+++ b/src/bluetooth/osx/osxbtutility_p.h
@@ -45,16 +45,14 @@
// We mean it.
//
+#include "osxbluetooth_p.h"
+
#include <QtCore/qloggingcategory.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qsysinfo.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 1cfe8286..18cda39b 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm
@@ -39,6 +39,7 @@
#include "osx/osxbtsdpinquiry_p.h"
#include "qbluetoothdeviceinfo.h"
#include "osx/osxbtutility_p.h"
+#include "osx/osxbluetooth_p.h"
#include "osx/uistrings_p.h"
#include "qbluetoothhostinfo.h"
#include "qbluetoothuuid.h"
@@ -52,8 +53,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 b1957d09..24cc2bbc 100644
--- a/src/bluetooth/qbluetoothlocaldevice_osx.mm
+++ b/src/bluetooth/qbluetoothlocaldevice_osx.mm
@@ -36,6 +36,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>
@@ -45,8 +46,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 6b82dd04..99fcf58d 100644
--- a/src/bluetooth/qbluetoothserver_osx.mm
+++ b/src/bluetooth/qbluetoothserver_osx.mm
@@ -42,6 +42,7 @@
#include "qbluetoothlocaldevice.h"
#include "osx/osxbtutility_p.h"
+#include "osx/osxbluetooth_p.h"
#include "qbluetoothserver.h"
#include "qbluetoothsocket.h"
@@ -53,8 +54,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 c3d4a0e6..0990a865 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm
@@ -37,6 +37,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>
@@ -47,8 +48,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 d79156e2..ee19f1dd 100644
--- a/src/bluetooth/qbluetoothserviceinfo_osx.mm
+++ b/src/bluetooth/qbluetoothserviceinfo_osx.mm
@@ -36,6 +36,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>
@@ -46,8 +47,6 @@
#include <QtCore/qurl.h>
#include <Foundation/Foundation.h>
-// Only after Foundation.h:
-#include "osx/corebluetoothwrapper_p.h"
QT_BEGIN_NAMESPACE