diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-02-28 15:15:03 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-01 20:09:28 +0100 |
commit | 17d38319d205fd186ffbb638e53e43fde011c753 (patch) | |
tree | 7aac0462c81781547e797060e002c72f43f72537 /src/bluetooth/qbluetoothserver_android.cpp | |
parent | 6c90b603cff92834ac7f58610fc6982ec801f2fd (diff) |
Fix qrfcomm unit test
The patch also aligns the error behavior of QBluetoothServer::listen()
across the various platforms.
Task-number: QTBUG-22017
Change-Id: Ic81808c94d060ca07bd125afa842452e53efaec7
Reviewed-by: Nedim Hadzic <nedimhadzija@gmail.com>
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Diffstat (limited to 'src/bluetooth/qbluetoothserver_android.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothserver_android.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/bluetooth/qbluetoothserver_android.cpp b/src/bluetooth/qbluetoothserver_android.cpp index c7c798d3..f90c540e 100644 --- a/src/bluetooth/qbluetoothserver_android.cpp +++ b/src/bluetooth/qbluetoothserver_android.cpp @@ -127,9 +127,20 @@ void QBluetoothServer::close() bool QBluetoothServer::listen(const QBluetoothAddress &localAdapter, quint16 port) { + Q_D(QBluetoothServer); + if (serverType() != QBluetoothServiceInfo::RfcommProtocol) { + d->m_lastError = UnsupportedProtocolError; + emit error(d->m_lastError); + return false; + } + const QList<QBluetoothHostInfo> localDevices = QBluetoothLocalDevice::allDevices(); - if (!localDevices.count()) + if (!localDevices.count()) { + qCWarning(QT_BT_ANDROID) << "Device does not support Bluetooth"; + d->m_lastError = QBluetoothServer::UnknownError; + emit error(d->m_lastError); return false; //no Bluetooth device + } if (!localAdapter.isNull()) { bool found = false; @@ -146,13 +157,6 @@ bool QBluetoothServer::listen(const QBluetoothAddress &localAdapter, quint16 por } } - Q_D(QBluetoothServer); - if (serverType() != QBluetoothServiceInfo::RfcommProtocol) { - d->m_lastError = UnsupportedProtocolError; - emit error(d->m_lastError); - return false; - } - if (d->isListening()) return false; |