From 61f2f050a750d286791e8848bcba2e990311ba29 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 11 Mar 2014 15:36:22 +0100 Subject: Fix a few TODOs around the source code and remove obsolete ones Change-Id: I01e867cb5efb231e7c85b0d106897b2f31448977 Reviewed-by: Aaron McCarthy Reviewed-by: Alex Blasche --- src/bluetooth/qbluetoothlocaldevice.cpp | 14 +++++++++----- src/bluetooth/qbluetoothservicediscoveryagent_android.cpp | 1 - src/bluetooth/qbluetoothsocket_android.cpp | 1 - src/bluetooth/qbluetoothsocket_bluez.cpp | 3 ++- src/bluetooth/qbluetoothsocket_p.cpp | 4 ++-- src/bluetooth/qbluetoothsocket_qnx.cpp | 3 ++- src/bluetooth/qbluetoothuuid.cpp | 1 - 7 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src/bluetooth') diff --git a/src/bluetooth/qbluetoothlocaldevice.cpp b/src/bluetooth/qbluetoothlocaldevice.cpp index e299ab71..14140846 100644 --- a/src/bluetooth/qbluetoothlocaldevice.cpp +++ b/src/bluetooth/qbluetoothlocaldevice.cpp @@ -139,9 +139,11 @@ bool QBluetoothLocalDevice::isValid() const \fn void QBluetoothLocalDevice::setHostMode(QBluetoothLocalDevice::HostMode mode) Sets the host mode of this local Bluetooth device to \a mode. - NOTE: Due to security policies of platforms, this method may behave different on different platforms. For example - the system can ask the user for confirmation before turning Bluetooth on or off. Not all host modes may be - supported on all platforms. Please refer to the platform specific Bluetooth documentation for details. + + \note Due to varying security policies on the supported platforms, this method may have + differing behaviors on the various platforms. For example the system may ask the user for + confirmation before turning Bluetooth on or off and not all host modes may be supported. + Please refer to the platform specific Bluetooth documentation for details. */ /*! @@ -172,8 +174,10 @@ bool QBluetoothLocalDevice::isValid() const \fn QBluetoothLocalDevice::powerOn() Powers on the device after returning it to the hostMode() state, if it was powered off. - NOTE: Due to security policies of platforms, this method may behave different on different platforms. For example - the system can ask the user for confirmation before turning Bluetooth on or off. + + \note Due to varying security policies on the supported platforms, this method may have + differing behaviors on the various platforms. For example + the system may ask the user for confirmation before turning Bluetooth on or off. Please refer to the platform specific Bluetooth documentation for details. */ diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp index 7b081e04..2e55d40e 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp @@ -443,7 +443,6 @@ void QBluetoothServiceDiscoveryAgentPrivate::populateDiscoveredServices(const QB serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId); serviceInfo.setServiceName(QBluetoothServiceDiscoveryAgent::tr("Serial Port Profile")); - //TODO Remove line below - work around serviceInfo.setServiceUuid(uuids.at(i)); } else if (customUuids.contains(i)) { //custom uuid but no serial port diff --git a/src/bluetooth/qbluetoothsocket_android.cpp b/src/bluetooth/qbluetoothsocket_android.cpp index 769a5e68..a894fed3 100644 --- a/src/bluetooth/qbluetoothsocket_android.cpp +++ b/src/bluetooth/qbluetoothsocket_android.cpp @@ -324,7 +324,6 @@ quint16 QBluetoothSocketPrivate::peerPort() const qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) { //TODO implement buffered behavior (so far only unbuffered) - //TODO check that readData and writeData return -1 on error (on all platforms) Q_Q(QBluetoothSocket); if (state != QBluetoothSocket::ConnectedState || !outputStream.isValid()) { qCWarning(QT_BT_ANDROID) << "Socket::writeData: " << state << outputStream.isValid(); diff --git a/src/bluetooth/qbluetoothsocket_bluez.cpp b/src/bluetooth/qbluetoothsocket_bluez.cpp index 825c6cd7..6aad6603 100644 --- a/src/bluetooth/qbluetoothsocket_bluez.cpp +++ b/src/bluetooth/qbluetoothsocket_bluez.cpp @@ -453,6 +453,7 @@ qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) if (::write(socket, data, maxSize) != maxSize) { errorString = QBluetoothSocket::tr("Network Error"); q->setSocketError(QBluetoothSocket::NetworkError); + return -1; } emit q->bytesWritten(maxSize); @@ -462,7 +463,7 @@ qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) else { if(!connectWriteNotifier) - return 0; + return -1; if(txBuffer.size() == 0) { connectWriteNotifier->setEnabled(true); diff --git a/src/bluetooth/qbluetoothsocket_p.cpp b/src/bluetooth/qbluetoothsocket_p.cpp index d64e7ecf..6e78be9e 100644 --- a/src/bluetooth/qbluetoothsocket_p.cpp +++ b/src/bluetooth/qbluetoothsocket_p.cpp @@ -123,7 +123,7 @@ qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) q->setSocketError(QBluetoothSocket::OperationError); return -1; } - return 0; + return -1; } qint64 QBluetoothSocketPrivate::readData(char *data, qint64 maxSize) @@ -139,7 +139,7 @@ qint64 QBluetoothSocketPrivate::readData(char *data, qint64 maxSize) return -1; } - return 0; + return -1; } void QBluetoothSocketPrivate::close() diff --git a/src/bluetooth/qbluetoothsocket_qnx.cpp b/src/bluetooth/qbluetoothsocket_qnx.cpp index f60ba97a..4e277e28 100644 --- a/src/bluetooth/qbluetoothsocket_qnx.cpp +++ b/src/bluetooth/qbluetoothsocket_qnx.cpp @@ -226,6 +226,7 @@ qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) errorString = QBluetoothSocket::tr("Network Error"); q->setSocketError(QBluetoothSocket::NetworkError); qCWarning(QT_BT_QNX) << Q_FUNC_INFO << "Socket error"; + return -1; } Q_EMIT q->bytesWritten(maxSize); @@ -233,7 +234,7 @@ qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize) return maxSize; } else { if (!connectWriteNotifier) - return 0; + return -1; if (txBuffer.size() == 0) { connectWriteNotifier->setEnabled(true); diff --git a/src/bluetooth/qbluetoothuuid.cpp b/src/bluetooth/qbluetoothuuid.cpp index 27215656..85d48d49 100644 --- a/src/bluetooth/qbluetoothuuid.cpp +++ b/src/bluetooth/qbluetoothuuid.cpp @@ -49,7 +49,6 @@ QT_BEGIN_NAMESPACE // Bluetooth base UUID 00000000-0000-1000-8000-00805F9B34FB -// TODO: make more efficient Q_GLOBAL_STATIC_WITH_ARGS(QUuid, baseUuid, ("{00000000-0000-1000-8000-00805F9B34FB}")) /*! -- cgit v1.2.3