From e53f828a1644fab1821a7696c190777a3bbb1880 Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Mon, 26 Sep 2016 23:30:26 +0100 Subject: 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 Reviewed-by: Alex Blasche --- src/bluetooth/osx/osxbtcentralmanager.mm | 21 +++++++++++++++++++++ src/bluetooth/osx/osxbtledeviceinquiry.mm | 13 +++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/bluetooth/osx/osxbtcentralmanager.mm b/src/bluetooth/osx/osxbtcentralmanager.mm index 6afe03c0..e32a82da 100644 --- a/src/bluetooth/osx/osxbtcentralmanager.mm +++ b/src/bluetooth/osx/osxbtcentralmanager.mm @@ -1072,10 +1072,19 @@ QT_USE_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 @@ -1085,7 +1094,11 @@ QT_USE_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; @@ -1101,7 +1114,11 @@ QT_USE_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. @@ -1116,7 +1133,11 @@ QT_USE_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/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 -- cgit v1.2.3 From 462323dba4f963844e8c9911da27a0d21e4abf43 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sun, 2 Oct 2016 21:19:39 +0200 Subject: Fixed build with MaxOSX10.12 SDK This patch adds missing includes that allows to build the module with the 10.12 SDK and Xcode 8. Change-Id: Ieab48f6a0582b916ceecbbb9a01a4169d6ba53f5 Reviewed-by: Jake Petroules --- src/bluetooth/osx/osxbtcentralmanager_p.h | 8 ++++++++ src/bluetooth/osx/osxbtledeviceinquiry.mm | 5 +++++ src/bluetooth/osx/osxbtutility.mm | 3 +++ 3 files changed, 16 insertions(+) diff --git a/src/bluetooth/osx/osxbtcentralmanager_p.h b/src/bluetooth/osx/osxbtcentralmanager_p.h index 1ff33c12..68b32f32 100644 --- a/src/bluetooth/osx/osxbtcentralmanager_p.h +++ b/src/bluetooth/osx/osxbtcentralmanager_p.h @@ -61,6 +61,14 @@ #include "corebluetoothwrapper_p.h" +#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12, __IPHONE_NA) +#include +#include +#include +#include +#include +#endif + @class QT_MANGLE_NAMESPACE(OSXBTCentralManager); QT_BEGIN_NAMESPACE diff --git a/src/bluetooth/osx/osxbtledeviceinquiry.mm b/src/bluetooth/osx/osxbtledeviceinquiry.mm index 5cf9b193..5a2f2dbd 100644 --- a/src/bluetooth/osx/osxbtledeviceinquiry.mm +++ b/src/bluetooth/osx/osxbtledeviceinquiry.mm @@ -42,6 +42,11 @@ #include "corebluetoothwrapper_p.h" +#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12, __IPHONE_NA) +#import +#import +#endif + QT_BEGIN_NAMESPACE namespace OSXBluetooth { diff --git a/src/bluetooth/osx/osxbtutility.mm b/src/bluetooth/osx/osxbtutility.mm index 08ff699d..32f6f744 100644 --- a/src/bluetooth/osx/osxbtutility.mm +++ b/src/bluetooth/osx/osxbtutility.mm @@ -41,6 +41,9 @@ #ifndef QT_IOS_BLUETOOTH #import +#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12, __IPHONE_NA) +#import +#endif #endif -- cgit v1.2.3 From fa76dbf2b865f547b57803a0c38c9a86d8eab5e4 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 4 Oct 2016 10:04:21 +0200 Subject: Fix misleading error message in QBluetoothSocket Dummy implementation Task-number: QTBUG-56294 Change-Id: I2c27a050294e611f6ee540dbc58cf7f8b30b3fdf Reviewed-by: Christian Kandeler Reviewed-by: Timur Pocheptsov --- src/bluetooth/qbluetoothsocket_p.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bluetooth/qbluetoothsocket_p.cpp b/src/bluetooth/qbluetoothsocket_p.cpp index ca6275d0..c2fffc07 100644 --- a/src/bluetooth/qbluetoothsocket_p.cpp +++ b/src/bluetooth/qbluetoothsocket_p.cpp @@ -125,7 +125,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; } -- cgit v1.2.3 From 052e7ce371d4719df778ad8b378bcf1af14d294b Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 3 Oct 2016 11:22:51 +0200 Subject: 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 - use osxbluetooth_p.h instead (and it will correctly include IOBluetooth/IOBluetooth.h etc.). Change-Id: Ia85ef2e2cc1ac7b15a58864ed25d85a0772e5c86 Reviewed-by: Alex Blasche --- src/bluetooth/osx/corebluetoothwrapper_p.h | 81 ------------------- src/bluetooth/osx/osxbluetooth_p.h | 94 ++++++++++++++++++++++ src/bluetooth/osx/osxbt.pri | 4 +- src/bluetooth/osx/osxbtcentralmanager_p.h | 13 +-- src/bluetooth/osx/osxbtconnectionmonitor.mm | 4 - src/bluetooth/osx/osxbtconnectionmonitor_p.h | 3 +- src/bluetooth/osx/osxbtdeviceinquiry.mm | 7 +- src/bluetooth/osx/osxbtdeviceinquiry_p.h | 5 +- src/bluetooth/osx/osxbtdevicepair.mm | 5 +- src/bluetooth/osx/osxbtdevicepair_p.h | 4 +- src/bluetooth/osx/osxbtl2capchannel.mm | 4 +- src/bluetooth/osx/osxbtl2capchannel_p.h | 6 +- src/bluetooth/osx/osxbtledeviceinquiry.mm | 13 +-- src/bluetooth/osx/osxbtledeviceinquiry_p.h | 4 +- src/bluetooth/osx/osxbtobexsession.mm | 6 +- src/bluetooth/osx/osxbtobexsession_p.h | 7 +- src/bluetooth/osx/osxbtrfcommchannel.mm | 4 +- src/bluetooth/osx/osxbtrfcommchannel_p.h | 5 +- src/bluetooth/osx/osxbtsdpinquiry.mm | 8 +- src/bluetooth/osx/osxbtsdpinquiry_p.h | 4 +- src/bluetooth/osx/osxbtservicerecord.mm | 3 +- src/bluetooth/osx/osxbtsocketlistener.mm | 8 +- src/bluetooth/osx/osxbtsocketlistener_p.h | 6 +- src/bluetooth/osx/osxbtutility_p.h | 6 +- .../qbluetoothdevicediscoveryagent_osx.mm | 3 +- src/bluetooth/qbluetoothlocaldevice_osx.mm | 3 +- src/bluetooth/qbluetoothserver_osx.mm | 3 +- .../qbluetoothservicediscoveryagent_osx.mm | 3 +- src/bluetooth/qbluetoothserviceinfo_osx.mm | 3 +- 29 files changed, 127 insertions(+), 192 deletions(-) delete mode 100644 src/bluetooth/osx/corebluetoothwrapper_p.h create mode 100644 src/bluetooth/osx/osxbluetooth_p.h diff --git a/src/bluetooth/osx/corebluetoothwrapper_p.h b/src/bluetooth/osx/corebluetoothwrapper_p.h deleted file mode 100644 index fe057681..00000000 --- a/src/bluetooth/osx/corebluetoothwrapper_p.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef COREBLUETOOTHWRAPPER_P_H -#define COREBLUETOOTHWRAPPER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifndef QT_OSX_BLUETOOTH - -#import - -#else - -#include - -// CoreBluetooth with SDK 10.9 seems to be broken: the class CBPeripheralManager is enabled on OS X 10.9, -// 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. - -#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 -#undef NS_ENUM_AVAILABLE -#define NS_ENUM_AVAILABLE(_mac, _ios) -#endif - -#import - -#ifdef CB_ERROR_WORKAROUND_REQUIRED -#undef __attribute__ -#undef CB_ERROR_WORKAROUND_REQUIRED -#endif - -#endif // QT_OSX_BLUETOOTH - -#endif // COREBLUETOOTHWRAPPER_P_H diff --git a/src/bluetooth/osx/osxbluetooth_p.h b/src/bluetooth/osx/osxbluetooth_p.h new file mode 100644 index 00000000..95c639b5 --- /dev/null +++ b/src/bluetooth/osx/osxbluetooth_p.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtBluetooth module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef OSXBLUETOOTH_P_H +#define OSXBLUETOOTH_P_H + + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#ifndef QT_OSX_BLUETOOTH + +#include + +#else + +#if QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12) + +#include +#include + +#else + +// 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: +// 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) + +// Must be included BEFORE CoreBluetooth.h: +#include + +#define CB_ERROR_WORKAROUND_REQUIRED +#undef NS_ENUM_AVAILABLE +#define NS_ENUM_AVAILABLE(_mac, _ios) + +#endif // SDK version == 10.9 + +// In SDK below 10.12 IOBluetooth.h includes CoreBluetooth.h. +#include + +#ifdef CB_ERROR_WORKAROUND_REQUIRED +#undef __attribute__ +#undef CB_ERROR_WORKAROUND_REQUIRED +#endif // WORKAROUND + +#endif // SDK + +#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 #include #include #include -// Foundation.h must be included before corebluetoothwrapper_p.h - -// a workaround for a broken 10.9 SDK. #include -#include "corebluetoothwrapper_p.h" - -#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12, __IPHONE_NA) -#include -#include -#include -#include -#include -#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 -// Import, since these headers are not protected from the multiple inclusion. -#import -#import - 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 #include @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 #include - 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 +#include "osxbluetooth_p.h" -// We have to import objc code (it does not have inclusion guards). -#import +#include #include #include 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 #include -// 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 #include -#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 #include -// Only after Foundation.h: -#include "corebluetoothwrapper_p.h" #include @@ -65,8 +65,6 @@ class ChannelDelegate; QT_END_NAMESPACE -@class IOBluetoothDevice; - @interface QT_MANGLE_NAMESPACE(OSXBTL2CAPChannel) : NSObject { 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 #include -#include "corebluetoothwrapper_p.h" - -#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12, __IPHONE_NA) -#import -#import -#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) - (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 #include @@ -56,9 +57,6 @@ #include -@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 #include #include -// 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 #include -// 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 #include -#include "corebluetoothwrapper_p.h" - QT_BEGIN_NAMESPACE namespace OSXBluetooth { @@ -135,10 +132,7 @@ QList 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 #include @@ -54,9 +55,6 @@ #include @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 #include #include #include -#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 -#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 #include -#include -@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 #include #include #include #include -// 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 #include -// 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 #include @@ -45,8 +46,6 @@ #include -// Only after Foundation.h: -#include "osx/corebluetoothwrapper_p.h" #include 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 -// Only after Foundation.h -#include "osx/corebluetoothwrapper_p.h" #include 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 @@ -47,8 +48,6 @@ #include #include -// 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 #include @@ -46,8 +47,6 @@ #include #include -// Only after Foundation.h: -#include "osx/corebluetoothwrapper_p.h" QT_BEGIN_NAMESPACE -- cgit v1.2.3