From 7393531856058a8a0fe440d3a64728248958ac81 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 20 May 2016 12:49:44 +0200 Subject: QtBluetooth (iOS) - fix potential linker errors Bluetooth on iOS needs some of 'default' (or 'dummy') implementations, but does not want warnings like 'Dummy backend running', as it's not really dummy. Also, having printDummyWarning calls can end-up in a linker error since we do not build dummy_helper.cpp on iOS. The solution is to ifndef all these calls/includes. Change-Id: I9c64f2bacbc6134ed30d75f85f9df0194add418d Reviewed-by: Alex Blasche --- src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp | 4 ++++ src/bluetooth/qbluetoothlocaldevice_p.cpp | 4 ++++ src/bluetooth/qbluetoothserver_p.cpp | 4 ++++ src/bluetooth/qbluetoothservicediscoveryagent_p.cpp | 4 ++++ src/bluetooth/qbluetoothserviceinfo_p.cpp | 4 ++++ src/bluetooth/qbluetoothsocket_p.cpp | 4 ++++ src/bluetooth/qlowenergycontroller_p.cpp | 4 ++++ 7 files changed, 28 insertions(+) diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp index 963eb368..81e57881 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp @@ -36,7 +36,9 @@ #include "qbluetoothaddress.h" #include "qbluetoothuuid.h" +#ifndef QT_IOS_BLUETOOTH #include "dummy/dummy_helper_p.h" +#endif #define QT_DEVICEDISCOVERY_DEBUG @@ -50,7 +52,9 @@ QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate( q_ptr(parent) { Q_UNUSED(deviceAdapter); +#ifndef QT_IOS_BLUETOOTH printDummyWarning(); +#endif } QBluetoothDeviceDiscoveryAgentPrivate::~QBluetoothDeviceDiscoveryAgentPrivate() diff --git a/src/bluetooth/qbluetoothlocaldevice_p.cpp b/src/bluetooth/qbluetoothlocaldevice_p.cpp index 20c02558..dff24509 100644 --- a/src/bluetooth/qbluetoothlocaldevice_p.cpp +++ b/src/bluetooth/qbluetoothlocaldevice_p.cpp @@ -35,7 +35,9 @@ #include "qbluetoothaddress.h" #include "qbluetoothlocaldevice_p.h" +#ifndef QT_IOS_BLUETOOTH #include "dummy/dummy_helper_p.h" +#endif QT_BEGIN_NAMESPACE @@ -43,7 +45,9 @@ QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) : QObject(parent), d_ptr(0) { +#ifndef QT_IOS_BLUETOOTH printDummyWarning(); +#endif registerQBluetoothLocalDeviceMetaType(); } diff --git a/src/bluetooth/qbluetoothserver_p.cpp b/src/bluetooth/qbluetoothserver_p.cpp index 4f9ce433..318042f9 100644 --- a/src/bluetooth/qbluetoothserver_p.cpp +++ b/src/bluetooth/qbluetoothserver_p.cpp @@ -34,14 +34,18 @@ #include "qbluetoothserver.h" #include "qbluetoothserver_p.h" #include "qbluetoothsocket.h" +#ifndef QT_IOS_BLUETOOTH #include "dummy/dummy_helper_p.h" +#endif QT_BEGIN_NAMESPACE QBluetoothServerPrivate::QBluetoothServerPrivate(QBluetoothServiceInfo::Protocol sType) : maxPendingConnections(1), serverType(sType), m_lastError(QBluetoothServer::NoError) { +#ifndef QT_IOS_BLUETOOTH printDummyWarning(); +#endif if (sType == QBluetoothServiceInfo::RfcommProtocol) socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol); else diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_p.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_p.cpp index 263e9018..e4561492 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_p.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_p.cpp @@ -33,7 +33,9 @@ #include "qbluetoothservicediscoveryagent.h" #include "qbluetoothservicediscoveryagent_p.h" +#ifndef QT_IOS_BLUETOOTH #include "dummy/dummy_helper_p.h" +#endif QT_BEGIN_NAMESPACE @@ -42,7 +44,9 @@ QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate(c deviceDiscoveryAgent(0), mode(QBluetoothServiceDiscoveryAgent::MinimalDiscovery), singleDevice(false) { +#ifndef QT_IOS_BLUETOOTH printDummyWarning(); +#endif Q_UNUSED(deviceAdapter); } diff --git a/src/bluetooth/qbluetoothserviceinfo_p.cpp b/src/bluetooth/qbluetoothserviceinfo_p.cpp index dbf3abfc..1e10b7a3 100644 --- a/src/bluetooth/qbluetoothserviceinfo_p.cpp +++ b/src/bluetooth/qbluetoothserviceinfo_p.cpp @@ -33,13 +33,17 @@ #include "qbluetoothserviceinfo.h" #include "qbluetoothserviceinfo_p.h" +#ifndef QT_IOS_BLUETOOTH #include "dummy/dummy_helper_p.h" +#endif QT_BEGIN_NAMESPACE QBluetoothServiceInfoPrivate::QBluetoothServiceInfoPrivate() { +#ifndef QT_IOS_BLUETOOTH printDummyWarning(); +#endif } QBluetoothServiceInfoPrivate::~QBluetoothServiceInfoPrivate() diff --git a/src/bluetooth/qbluetoothsocket_p.cpp b/src/bluetooth/qbluetoothsocket_p.cpp index 6b196a81..ca6275d0 100644 --- a/src/bluetooth/qbluetoothsocket_p.cpp +++ b/src/bluetooth/qbluetoothsocket_p.cpp @@ -33,7 +33,9 @@ #include "qbluetoothsocket.h" #include "qbluetoothsocket_p.h" +#ifndef QT_IOS_BLUETOOTH #include "dummy/dummy_helper_p.h" +#endif QT_BEGIN_NAMESPACE @@ -44,7 +46,9 @@ QBluetoothSocketPrivate::QBluetoothSocketPrivate() socketError(QBluetoothSocket::NoSocketError), secFlags(QBluetooth::NoSecurity) { +#ifndef QT_IOS_BLUETOOTH printDummyWarning(); +#endif } QBluetoothSocketPrivate::~QBluetoothSocketPrivate() diff --git a/src/bluetooth/qlowenergycontroller_p.cpp b/src/bluetooth/qlowenergycontroller_p.cpp index 9cbc6633..328bdb64 100644 --- a/src/bluetooth/qlowenergycontroller_p.cpp +++ b/src/bluetooth/qlowenergycontroller_p.cpp @@ -32,7 +32,9 @@ ****************************************************************************/ #include "qlowenergycontroller_p.h" +#ifndef QT_IOS_BLUETOOTH #include "dummy/dummy_helper_p.h" +#endif QT_BEGIN_NAMESPACE @@ -41,7 +43,9 @@ QLowEnergyControllerPrivate::QLowEnergyControllerPrivate() state(QLowEnergyController::UnconnectedState), error(QLowEnergyController::NoError) { +#ifndef QT_IOS_BLUETOOTH printDummyWarning(); +#endif registerQLowEnergyControllerMetaType(); } -- cgit v1.2.3