diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-08-22 13:52:51 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@digia.com> | 2014-08-25 15:03:10 +0200 |
commit | d02f13307fed0bdbdf928a6b44325e8658b7c24c (patch) | |
tree | a7b9a7beed655768d984ddaf9416c92c8a780ce8 | |
parent | 2b5027a808e4cf525926058542786167dfed24ea (diff) |
Make QBluetoothSocket's _q_writeNotify & _q_readNotify private
These two functions are really only needed by Linux style socket code.
There is no need for other platforms to implement them as dummy too.
It simplifies the code somewhat.
Change-Id: I3e0aced8d9f7b590d1c6aaa60f97bd060ee8f4b4
Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
-rw-r--r-- | src/bluetooth/qbluetoothsocket.h | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothsocket_android.cpp | 8 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothsocket_bluez.cpp | 12 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothsocket_p.cpp | 8 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothsocket_p.h | 19 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothsocket_qnx.cpp | 14 |
6 files changed, 19 insertions, 44 deletions
diff --git a/src/bluetooth/qbluetoothsocket.h b/src/bluetooth/qbluetoothsocket.h index 36883890..6540e0c9 100644 --- a/src/bluetooth/qbluetoothsocket.h +++ b/src/bluetooth/qbluetoothsocket.h @@ -152,8 +152,6 @@ protected: QBluetoothSocketPrivate *d_ptr; private: - Q_PRIVATE_SLOT(d_func(), void _q_readNotify()) - Q_PRIVATE_SLOT(d_func(), void _q_writeNotify()) friend class QLowEnergyControllerPrivate; }; diff --git a/src/bluetooth/qbluetoothsocket_android.cpp b/src/bluetooth/qbluetoothsocket_android.cpp index 88368141..c98e66dd 100644 --- a/src/bluetooth/qbluetoothsocket_android.cpp +++ b/src/bluetooth/qbluetoothsocket_android.cpp @@ -221,14 +221,6 @@ void QBluetoothSocketPrivate::connectToServiceConc(const QBluetoothAddress &addr emit q->connected(); } -void QBluetoothSocketPrivate::_q_writeNotify() -{ -} - -void QBluetoothSocketPrivate::_q_readNotify() -{ -} - void QBluetoothSocketPrivate::abort() { if (state == QBluetoothSocket::UnconnectedState) diff --git a/src/bluetooth/qbluetoothsocket_bluez.cpp b/src/bluetooth/qbluetoothsocket_bluez.cpp index 50fa0272..3be1125b 100644 --- a/src/bluetooth/qbluetoothsocket_bluez.cpp +++ b/src/bluetooth/qbluetoothsocket_bluez.cpp @@ -110,9 +110,9 @@ bool QBluetoothSocketPrivate::ensureNativeSocket(QBluetoothServiceInfo::Protocol Q_Q(QBluetoothSocket); readNotifier = new QSocketNotifier(socket, QSocketNotifier::Read); - QObject::connect(readNotifier, SIGNAL(activated(int)), q, SLOT(_q_readNotify())); + QObject::connect(readNotifier, SIGNAL(activated(int)), this, SLOT(_q_readNotify())); connectWriteNotifier = new QSocketNotifier(socket, QSocketNotifier::Write, q); - QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), q, SLOT(_q_writeNotify())); + QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), this, SLOT(_q_writeNotify())); connectWriteNotifier->setEnabled(false); readNotifier->setEnabled(false); @@ -232,8 +232,6 @@ void QBluetoothSocketPrivate::_q_writeNotify() } } -// TODO: move to private backend? - void QBluetoothSocketPrivate::_q_readNotify() { Q_Q(QBluetoothSocket); @@ -483,7 +481,7 @@ qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) if(txBuffer.size() == 0) { connectWriteNotifier->setEnabled(true); - QMetaObject::invokeMethod(q, "_q_writeNotify", Qt::QueuedConnection); + QMetaObject::invokeMethod(this, "_q_writeNotify", Qt::QueuedConnection); } char *txbuf = txBuffer.reserve(maxSize); @@ -547,9 +545,9 @@ bool QBluetoothSocketPrivate::setSocketDescriptor(int socketDescriptor, QBluetoo fcntl(socket, F_SETFL, flags | O_NONBLOCK); readNotifier = new QSocketNotifier(socket, QSocketNotifier::Read); - QObject::connect(readNotifier, SIGNAL(activated(int)), q, SLOT(_q_readNotify())); + QObject::connect(readNotifier, SIGNAL(activated(int)), this, SLOT(_q_readNotify())); connectWriteNotifier = new QSocketNotifier(socket, QSocketNotifier::Write, q); - QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), q, SLOT(_q_writeNotify())); + QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), this, SLOT(_q_writeNotify())); q->setSocketState(socketState); q->setOpenMode(openMode); diff --git a/src/bluetooth/qbluetoothsocket_p.cpp b/src/bluetooth/qbluetoothsocket_p.cpp index cf122458..85b730dd 100644 --- a/src/bluetooth/qbluetoothsocket_p.cpp +++ b/src/bluetooth/qbluetoothsocket_p.cpp @@ -61,14 +61,6 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address, Q_UNUSED(port); } -void QBluetoothSocketPrivate::_q_writeNotify() -{ -} - -void QBluetoothSocketPrivate::_q_readNotify() -{ -} - void QBluetoothSocketPrivate::abort() { } diff --git a/src/bluetooth/qbluetoothsocket_p.h b/src/bluetooth/qbluetoothsocket_p.h index 70289e79..8214d2b5 100644 --- a/src/bluetooth/qbluetoothsocket_p.h +++ b/src/bluetooth/qbluetoothsocket_p.h @@ -70,14 +70,9 @@ public: class QBluetoothSocket; class QBluetoothServiceDiscoveryAgent; -class QBluetoothSocketPrivate -#if defined(QT_QNX_BLUETOOTH) || defined(QT_ANDROID_BLUETOOTH) -: public QObject +class QBluetoothSocketPrivate : public QObject { Q_OBJECT -#else -{ -#endif Q_DECLARE_PUBLIC(QBluetoothSocket) friend class QBluetoothServerPrivate; @@ -147,12 +142,6 @@ public: // qint64 rxOffset; QString errorString; - // private slots - void _q_readNotify(); - void _q_writeNotify(); - void _q_serviceDiscovered(const QBluetoothServiceInfo &service); - void _q_discoveryFinished(); - #ifdef QT_ANDROID_BLUETOOTH QAndroidJniObject adapter; QAndroidJniObject socketObject; @@ -166,6 +155,12 @@ private slots: #endif +#if defined(QT_QNX_BLUETOOTH) || defined(QT_BLUEZ_BLUETOOTH) +private slots: + void _q_readNotify(); + void _q_writeNotify(); +#endif + protected: QBluetoothSocket *q_ptr; diff --git a/src/bluetooth/qbluetoothsocket_qnx.cpp b/src/bluetooth/qbluetoothsocket_qnx.cpp index 9151b0cd..5926d8ad 100644 --- a/src/bluetooth/qbluetoothsocket_qnx.cpp +++ b/src/bluetooth/qbluetoothsocket_qnx.cpp @@ -114,9 +114,9 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address, delete connectWriteNotifier; readNotifier = new QSocketNotifier(socket, QSocketNotifier::Read); - QObject::connect(readNotifier, SIGNAL(activated(int)), q, SLOT(_q_readNotify())); + QObject::connect(readNotifier, SIGNAL(activated(int)), this, SLOT(_q_readNotify())); connectWriteNotifier = new QSocketNotifier(socket, QSocketNotifier::Write, q); - QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), q, SLOT(_q_writeNotify())); + QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), this, SLOT(_q_writeNotify())); connecting = true; q->setOpenMode(openMode); @@ -280,7 +280,7 @@ qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) if (txBuffer.size() == 0) { connectWriteNotifier->setEnabled(true); - QMetaObject::invokeMethod(q, "_q_writeNotify", Qt::QueuedConnection); + QMetaObject::invokeMethod(this, "_q_writeNotify", Qt::QueuedConnection); } char *txbuf = txBuffer.reserve(maxSize); @@ -325,9 +325,9 @@ bool QBluetoothSocketPrivate::setSocketDescriptor(int socketDescriptor, QBluetoo socketType = socketType_; readNotifier = new QSocketNotifier(socket, QSocketNotifier::Read); - QObject::connect(readNotifier, SIGNAL(activated(int)), q, SLOT(_q_readNotify())); + QObject::connect(readNotifier, SIGNAL(activated(int)), this, SLOT(_q_readNotify())); connectWriteNotifier = new QSocketNotifier(socket, QSocketNotifier::Write, q); - QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), q, SLOT(_q_writeNotify())); + QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), this, SLOT(_q_writeNotify())); q->setSocketState(socketState); q->setOpenMode(openMode); @@ -390,9 +390,9 @@ void QBluetoothSocketPrivate::controlReply(ppsResult result) Q_Q(QBluetoothSocket); readNotifier = new QSocketNotifier(socket, QSocketNotifier::Read); - QObject::connect(readNotifier, SIGNAL(activated(int)), q, SLOT(_q_readNotify())); + QObject::connect(readNotifier, SIGNAL(activated(int)), this, SLOT(_q_readNotify())); connectWriteNotifier = new QSocketNotifier(socket, QSocketNotifier::Write, q); - QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), q, SLOT(_q_writeNotify())); + QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), this, SLOT(_q_writeNotify())); connectWriteNotifier->setEnabled(true); readNotifier->setEnabled(true); |