From e452269d918655c3aaf0d5759cf2143478661af5 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Fri, 20 Jul 2018 12:38:10 +0200 Subject: Rename the final interface for the QBluetoothSocketPrivate dummy At the same time we reshuffle the inclusion of qbluetoothsocket_p.h in bluetooth.pro based on usage pattern. Task-number: QTBUG-68550 Change-Id: I3ae3f61c65e71a57d238f5c67289720ff63a1b0f Reviewed-by: Lubomir I. Ivanov Reviewed-by: Oliver Wolff --- src/bluetooth/bluetooth.pro | 17 +++++----------- src/bluetooth/qbluetoothsocket.cpp | 4 ++-- src/bluetooth/qbluetoothsocket.h | 1 + src/bluetooth/qbluetoothsocket_p.cpp | 36 +++++++++++++++++----------------- src/bluetooth/qbluetoothsocket_p.h | 38 ++++++++++++++++++------------------ 5 files changed, 45 insertions(+), 51 deletions(-) diff --git a/src/bluetooth/bluetooth.pro b/src/bluetooth/bluetooth.pro index d310dd64..bff367a8 100644 --- a/src/bluetooth/bluetooth.pro +++ b/src/bluetooth/bluetooth.pro @@ -40,7 +40,6 @@ PRIVATE_HEADERS += \ qbluetoothserviceinfo_p.h\ qbluetoothdevicediscoveryagent_p.h\ qbluetoothservicediscoveryagent_p.h\ - qbluetoothsocket_p.h\ qbluetoothsocketbase_p.h \ qbluetoothserver_p.h\ qbluetoothtransferreply_p.h \ @@ -100,8 +99,6 @@ qtConfig(bluez) { qbluetoothsocket_bluez_p.h \ qbluetoothsocket_bluezdbus_p.h - PRIVATE_HEADERS -= qbluetoothsocket_p.h - SOURCES += \ qbluetoothserviceinfo_bluez.cpp \ qbluetoothdevicediscoveryagent_bluez.cpp\ @@ -110,7 +107,7 @@ qtConfig(bluez) { qbluetoothsocket_bluezdbus.cpp \ qbluetoothserver_bluez.cpp \ qbluetoothlocaldevice_bluez.cpp \ - qbluetoothtransferreply_bluez.cpp \ + qbluetoothtransferreply_bluez.cpp # old versions of Bluez do not have the required BTLE symbols @@ -157,8 +154,6 @@ qtConfig(bluez) { PRIVATE_HEADERS += qlowenergycontroller_android_p.h \ qbluetoothsocket_android_p.h - - PRIVATE_HEADERS -= qbluetoothsocket_p.h } else:osx { QT_PRIVATE = concurrent DEFINES += QT_OSX_BLUETOOTH @@ -182,8 +177,6 @@ qtConfig(bluez) { qbluetoothtransferreply_osx_p.h \ qlowenergycontroller_osx_p.h - PRIVATE_HEADERS -= qbluetoothsocket_p.h - SOURCES -= qbluetoothdevicediscoveryagent.cpp SOURCES -= qbluetoothserviceinfo.cpp SOURCES -= qbluetoothservicediscoveryagent.cpp @@ -204,7 +197,8 @@ qtConfig(bluez) { qlowenergyservice_osx.mm PRIVATE_HEADERS += \ - qlowenergycontroller_osx_p.h + qlowenergycontroller_osx_p.h \ + qbluetoothsocket_p.h include(osx/osxbt.pri) SOURCES += \ @@ -240,8 +234,6 @@ qtConfig(bluez) { PRIVATE_HEADERS += qlowenergycontroller_winrt_p.h \ qbluetoothsocket_winrt_p.h - PRIVATE_HEADERS -= qbluetoothsocket_p.h - lessThan(WINDOWS_SDK_VERSION, 14393) { DEFINES += QT_WINRT_LIMITED_SERVICEDISCOVERY DEFINES += QT_UCRTVERSION=$$WINDOWS_SDK_VERSION @@ -259,7 +251,8 @@ qtConfig(bluez) { qbluetoothserver_p.cpp \ qlowenergycontroller_p.cpp - PRIVATE_HEADERS += qlowenergycontroller_p.h + PRIVATE_HEADERS += qlowenergycontroller_p.h \ + qbluetoothsocket_p.h } winrt { diff --git a/src/bluetooth/qbluetoothsocket.cpp b/src/bluetooth/qbluetoothsocket.cpp index feb52684..9516a0c4 100644 --- a/src/bluetooth/qbluetoothsocket.cpp +++ b/src/bluetooth/qbluetoothsocket.cpp @@ -267,7 +267,7 @@ QBluetoothSocket::QBluetoothSocket(QBluetoothServiceInfo::Protocol socketType, Q #elif defined(QT_WINRT_BLUETOOTH) d_ptr = new QBluetoothSocketPrivateWinRT(); #else - d_ptr = new QBluetoothSocketPrivate(); + d_ptr = new QBluetoothSocketPrivateDummy(); #endif d_ptr->q_ptr = this; @@ -290,7 +290,7 @@ QBluetoothSocket::QBluetoothSocket(QObject *parent) #elif defined(QT_WINRT_BLUETOOTH) d_ptr = new QBluetoothSocketPrivateWinRT(); #else - d_ptr = new QBluetoothSocketPrivate(); + d_ptr = new QBluetoothSocketPrivateDummy(); #endif d_ptr->q_ptr = this; setOpenMode(QIODevice::NotOpen); diff --git a/src/bluetooth/qbluetoothsocket.h b/src/bluetooth/qbluetoothsocket.h index 7f77d2a8..cda64dff 100644 --- a/src/bluetooth/qbluetoothsocket.h +++ b/src/bluetooth/qbluetoothsocket.h @@ -74,6 +74,7 @@ class Q_BLUETOOTH_EXPORT QBluetoothSocket : public QIODevice friend class QBluetoothSocketPrivateAndroid; friend class QBluetoothSocketPrivateBluez; friend class QBluetoothSocketPrivateBluezDBus; + friend class QBluetoothSocketPrivateDummy; friend class QBluetoothSocketPrivateWinRT; public: diff --git a/src/bluetooth/qbluetoothsocket_p.cpp b/src/bluetooth/qbluetoothsocket_p.cpp index bd074763..82359ac9 100644 --- a/src/bluetooth/qbluetoothsocket_p.cpp +++ b/src/bluetooth/qbluetoothsocket_p.cpp @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE -QBluetoothSocketPrivate::QBluetoothSocketPrivate() +QBluetoothSocketPrivateDummy::QBluetoothSocketPrivateDummy() { secFlags = QBluetooth::NoSecurity; #ifndef QT_IOS_BLUETOOTH @@ -53,58 +53,58 @@ QBluetoothSocketPrivate::QBluetoothSocketPrivate() #endif } -QBluetoothSocketPrivate::~QBluetoothSocketPrivate() +QBluetoothSocketPrivateDummy::~QBluetoothSocketPrivateDummy() { } -bool QBluetoothSocketPrivate::ensureNativeSocket(QBluetoothServiceInfo::Protocol type) +bool QBluetoothSocketPrivateDummy::ensureNativeSocket(QBluetoothServiceInfo::Protocol type) { socketType = type; return false; } -void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address, quint16 port, QIODevice::OpenMode openMode) +void QBluetoothSocketPrivateDummy::connectToService(const QBluetoothAddress &address, quint16 port, QIODevice::OpenMode openMode) { Q_UNUSED(openMode); Q_UNUSED(address); Q_UNUSED(port); } -void QBluetoothSocketPrivate::abort() +void QBluetoothSocketPrivateDummy::abort() { } -QString QBluetoothSocketPrivate::localName() const +QString QBluetoothSocketPrivateDummy::localName() const { return QString(); } -QBluetoothAddress QBluetoothSocketPrivate::localAddress() const +QBluetoothAddress QBluetoothSocketPrivateDummy::localAddress() const { return QBluetoothAddress(); } -quint16 QBluetoothSocketPrivate::localPort() const +quint16 QBluetoothSocketPrivateDummy::localPort() const { return 0; } -QString QBluetoothSocketPrivate::peerName() const +QString QBluetoothSocketPrivateDummy::peerName() const { return QString(); } -QBluetoothAddress QBluetoothSocketPrivate::peerAddress() const +QBluetoothAddress QBluetoothSocketPrivateDummy::peerAddress() const { return QBluetoothAddress(); } -quint16 QBluetoothSocketPrivate::peerPort() const +quint16 QBluetoothSocketPrivateDummy::peerPort() const { return 0; } -qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) +qint64 QBluetoothSocketPrivateDummy::writeData(const char *data, qint64 maxSize) { Q_UNUSED(data); Q_UNUSED(maxSize); @@ -119,7 +119,7 @@ qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) return -1; } -qint64 QBluetoothSocketPrivate::readData(char *data, qint64 maxSize) +qint64 QBluetoothSocketPrivateDummy::readData(char *data, qint64 maxSize) { Q_UNUSED(data); Q_UNUSED(maxSize); @@ -135,11 +135,11 @@ qint64 QBluetoothSocketPrivate::readData(char *data, qint64 maxSize) return -1; } -void QBluetoothSocketPrivate::close() +void QBluetoothSocketPrivateDummy::close() { } -bool QBluetoothSocketPrivate::setSocketDescriptor(int socketDescriptor, QBluetoothServiceInfo::Protocol socketType, +bool QBluetoothSocketPrivateDummy::setSocketDescriptor(int socketDescriptor, QBluetoothServiceInfo::Protocol socketType, QBluetoothSocket::SocketState socketState, QBluetoothSocket::OpenMode openMode) { Q_UNUSED(socketDescriptor); @@ -149,17 +149,17 @@ bool QBluetoothSocketPrivate::setSocketDescriptor(int socketDescriptor, QBluetoo return false; } -qint64 QBluetoothSocketPrivate::bytesAvailable() const +qint64 QBluetoothSocketPrivateDummy::bytesAvailable() const { return 0; } -bool QBluetoothSocketPrivate::canReadLine() const +bool QBluetoothSocketPrivateDummy::canReadLine() const { return false; } -qint64 QBluetoothSocketPrivate::bytesToWrite() const +qint64 QBluetoothSocketPrivateDummy::bytesToWrite() const { return 0; } diff --git a/src/bluetooth/qbluetoothsocket_p.h b/src/bluetooth/qbluetoothsocket_p.h index 6eef56fb..f01467a8 100644 --- a/src/bluetooth/qbluetoothsocket_p.h +++ b/src/bluetooth/qbluetoothsocket_p.h @@ -57,41 +57,41 @@ QT_BEGIN_NAMESPACE -class QBluetoothSocketPrivate : public QBluetoothSocketBasePrivate +class QBluetoothSocketPrivateDummy final : public QBluetoothSocketBasePrivate { Q_OBJECT friend class QBluetoothServerPrivate; public: - QBluetoothSocketPrivate(); - ~QBluetoothSocketPrivate() override; + QBluetoothSocketPrivateDummy(); + ~QBluetoothSocketPrivateDummy(); void connectToService(const QBluetoothAddress &address, quint16 port, - QIODevice::OpenMode openMode) override; - bool ensureNativeSocket(QBluetoothServiceInfo::Protocol type) override; + QIODevice::OpenMode openMode); + bool ensureNativeSocket(QBluetoothServiceInfo::Protocol type); - QString localName() const override; - QBluetoothAddress localAddress() const override; - quint16 localPort() const override; + QString localName() const; + QBluetoothAddress localAddress() const; + quint16 localPort() const; - QString peerName() const override; - QBluetoothAddress peerAddress() const override; - quint16 peerPort() const override; + QString peerName() const; + QBluetoothAddress peerAddress() const; + quint16 peerPort() const; - void abort() override; - void close() override; + void abort(); + void close(); - qint64 writeData(const char *data, qint64 maxSize) override; - qint64 readData(char *data, qint64 maxSize) override; + qint64 writeData(const char *data, qint64 maxSize); + qint64 readData(char *data, qint64 maxSize); bool setSocketDescriptor(int socketDescriptor, QBluetoothServiceInfo::Protocol socketType, QBluetoothSocket::SocketState socketState = QBluetoothSocket::ConnectedState, - QBluetoothSocket::OpenMode openMode = QBluetoothSocket::ReadWrite) override; + QBluetoothSocket::OpenMode openMode = QBluetoothSocket::ReadWrite); - qint64 bytesAvailable() const override; - bool canReadLine() const override; - qint64 bytesToWrite() const override; + qint64 bytesAvailable() const; + bool canReadLine() const; + qint64 bytesToWrite() const; }; QT_END_NAMESPACE -- cgit v1.2.3