summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Bumberger <fbumberger@rim.com>2013-09-18 11:28:53 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-19 15:27:20 +0200
commit25222f75d0ff5da0b39c77250510bc0aab0daf73 (patch)
tree63580c8afd76791f6ec6f3617e883a90e5b6b36d
parente071e7157797caf99a8cac990fc4066fcb6589ca (diff)
QNX: Take socketType and serverType into account
Also add a serverType member function in QBluetoothServer Change-Id: I107f73b3943dc84f5c4d2afcb00e303567a67b5d Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
-rw-r--r--src/bluetooth/qbluetoothserver.cpp11
-rw-r--r--src/bluetooth/qbluetoothserver.h3
-rw-r--r--src/bluetooth/qbluetoothserver_qnx.cpp5
-rw-r--r--src/bluetooth/qbluetoothsocket.cpp20
-rw-r--r--src/bluetooth/qbluetoothsocket.h3
5 files changed, 39 insertions, 3 deletions
diff --git a/src/bluetooth/qbluetoothserver.cpp b/src/bluetooth/qbluetoothserver.cpp
index 5a5144d1..9cbec283 100644
--- a/src/bluetooth/qbluetoothserver.cpp
+++ b/src/bluetooth/qbluetoothserver.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
@@ -251,6 +252,16 @@ int QBluetoothServer::maxPendingConnections() const
Returns the Bluetooth security flags.
*/
+/*!
+ \fn QBluetooth::ServerType QBluetoothServer::serverType() const
+ Returns the server type of the QBluetoothServer.
+*/
+QBluetoothServer::ServerType QBluetoothServer::serverType() const
+{
+ Q_D(const QBluetoothServer);
+ return d->serverType;
+}
+
#include "moc_qbluetoothserver.cpp"
QT_END_NAMESPACE
diff --git a/src/bluetooth/qbluetoothserver.h b/src/bluetooth/qbluetoothserver.h
index f916f9ff..77634649 100644
--- a/src/bluetooth/qbluetoothserver.h
+++ b/src/bluetooth/qbluetoothserver.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
@@ -86,6 +87,8 @@ public:
void setSecurityFlags(QBluetooth::SecurityFlags security);
QBluetooth::SecurityFlags securityFlags() const;
+ ServerType serverType() const;
+
Q_SIGNALS:
void newConnection();
diff --git a/src/bluetooth/qbluetoothserver_qnx.cpp b/src/bluetooth/qbluetoothserver_qnx.cpp
index cc7528e0..7a222959 100644
--- a/src/bluetooth/qbluetoothserver_qnx.cpp
+++ b/src/bluetooth/qbluetoothserver_qnx.cpp
@@ -1,6 +1,6 @@
/***************************************************************************
**
-** Copyright (C) 2012 Research In Motion
+** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
@@ -137,6 +137,9 @@ void QBluetoothServer::close()
bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port)
{
Q_UNUSED(address)
+ if (serverType() == L2capServer)
+ return false;
+
Q_D(QBluetoothServer);
// listen has already been called before
if (d->socket && d->socket->state() == QBluetoothSocket::ListeningState)
diff --git a/src/bluetooth/qbluetoothsocket.cpp b/src/bluetooth/qbluetoothsocket.cpp
index 2eaabe84..0f2471f9 100644
--- a/src/bluetooth/qbluetoothsocket.cpp
+++ b/src/bluetooth/qbluetoothsocket.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
@@ -113,6 +114,8 @@ QT_BEGIN_NAMESPACE
\value HostNotFoundError Could not find the remote host.
\value ServiceNotFoundError Could not find the service UUID on remote host.
\value NetworkError Attempt to read or write from socket returned an error
+ \value UnsupportedSocketTypeError The \l {QBluetoothSocket::SocketType}{SocketType} is not
+ supported on this platform.
*/
/*!
@@ -305,6 +308,12 @@ void QBluetoothSocket::connectToService(const QBluetoothServiceInfo &service, Op
setOpenMode(openMode);
#ifdef QT_QNX_BLUETOOTH
+ if (socketType() == L2capSocket) {
+ d->socketError = QBluetoothSocket::UnsupportedSocketTypeError;
+ d->errorString = tr("Socket type not supported");
+ Q_EMIT error(d->socketError);
+ return;
+ }
d->connectToService(service.device().address(), service.serviceUuid(), openMode);
#else
if (service.protocolServiceMultiplexer() > 0) {
@@ -352,6 +361,12 @@ void QBluetoothSocket::connectToService(const QBluetoothAddress &address, const
{
#ifdef QT_QNX_BLUETOOTH
Q_D(QBluetoothSocket);
+ if (socketType() == L2capSocket) {
+ d->socketError = QBluetoothSocket::UnsupportedSocketTypeError;
+ d->errorString = tr("Socket type not supported");
+ Q_EMIT error(d->socketError)
+ return;
+ }
d->connectToService(address, uuid, openMode);
#else
QBluetoothServiceInfo service;
@@ -383,7 +398,10 @@ void QBluetoothSocket::connectToService(const QBluetoothAddress &address, quint1
Q_UNUSED(port);
Q_UNUSED(openMode);
Q_UNUSED(address);
- qWarning("Connecting to port is not supported on QNX");
+ d->socketError = QBluetoothSocket::ServiceNotFoundError;
+ d->errorString = tr("Connecting to port is not supported on QNX");
+ Q_EMIT error(d->socketError)
+ qWarning("Connecting to port is not supported");
#else
Q_D(QBluetoothSocket);
setOpenMode(openMode);
diff --git a/src/bluetooth/qbluetoothsocket.h b/src/bluetooth/qbluetoothsocket.h
index 77241ce9..c8ecbb58 100644
--- a/src/bluetooth/qbluetoothsocket.h
+++ b/src/bluetooth/qbluetoothsocket.h
@@ -87,7 +87,8 @@ public:
RemoteHostClosedError = QAbstractSocket::RemoteHostClosedError,
HostNotFoundError = QAbstractSocket::HostNotFoundError,
ServiceNotFoundError = QAbstractSocket::SocketAddressNotAvailableError,
- NetworkError = QAbstractSocket::NetworkError
+ NetworkError = QAbstractSocket::NetworkError,
+ UnsupportedSocketTypeError
};
explicit QBluetoothSocket(SocketType socketType, QObject *parent = 0); // create socket of type socketType