summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothserver_android.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bluetooth/qbluetoothserver_android.cpp')
-rw-r--r--src/bluetooth/qbluetoothserver_android.cpp20
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;