summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabian Bumberger <fbumberger@rim.com>2013-08-22 15:12:27 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-23 11:07:27 +0200
commit66aec88aeedc59149945d497fc883586adb5d092 (patch)
treecc0b1555bccbd6141a623d12d735d974b7ca93db /src
parent9bfcbdea3e440baa8ec8e152981991d0f15f94f8 (diff)
QNX: Fix compilation
Change-Id: I075b0d43867c844af05ba8ca86c237b023738da2 Reviewed-by: Wolfgang Bremer <wbremer@blackberry.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/qbluetoothserviceinfo.cpp54
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_p.h4
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_qnx.cpp19
3 files changed, 46 insertions, 31 deletions
diff --git a/src/bluetooth/qbluetoothserviceinfo.cpp b/src/bluetooth/qbluetoothserviceinfo.cpp
index 1d8534a3..1f624c2b 100644
--- a/src/bluetooth/qbluetoothserviceinfo.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo.cpp
@@ -489,14 +489,7 @@ int QBluetoothServiceInfo::protocolServiceMultiplexer() const
*/
int QBluetoothServiceInfo::serverChannel() const
{
- QBluetoothServiceInfo::Sequence parameters = protocolDescriptor(QBluetoothUuid::Rfcomm);
-
- if (parameters.isEmpty())
- return -1;
- else if (parameters.count() == 1)
- return 0;
- else
- return parameters.at(1).toUInt();
+ return d_ptr->serverChannel();
}
/*!
@@ -506,20 +499,7 @@ int QBluetoothServiceInfo::serverChannel() const
*/
QBluetoothServiceInfo::Sequence QBluetoothServiceInfo::protocolDescriptor(QBluetoothUuid::ProtocolUuid protocol) const
{
- if (!contains(QBluetoothServiceInfo::ProtocolDescriptorList))
- return QBluetoothServiceInfo::Sequence();
-
- foreach (const QVariant &v, attribute(QBluetoothServiceInfo::ProtocolDescriptorList).value<QBluetoothServiceInfo::Sequence>()) {
- QBluetoothServiceInfo::Sequence parameters = v.value<QBluetoothServiceInfo::Sequence>();
- if(parameters.empty())
- continue;
- if (parameters.at(0).userType() == qMetaTypeId<QBluetoothUuid>()) {
- if (parameters.at(0).value<QBluetoothUuid>() == protocol)
- return parameters;
- }
- }
-
- return QBluetoothServiceInfo::Sequence();
+ return d_ptr->protocolDescriptor(protocol);
}
/*!
@@ -611,4 +591,34 @@ QDebug operator<<(QDebug dbg, const QBluetoothServiceInfo &info)
return dbg;
}
+QBluetoothServiceInfo::Sequence QBluetoothServiceInfoPrivate::protocolDescriptor(QBluetoothUuid::ProtocolUuid protocol) const
+{
+ if (!attributes.contains(QBluetoothServiceInfo::ProtocolDescriptorList))
+ return QBluetoothServiceInfo::Sequence();
+
+ foreach (const QVariant &v, attributes.value(QBluetoothServiceInfo::ProtocolDescriptorList).value<QBluetoothServiceInfo::Sequence>()) {
+ QBluetoothServiceInfo::Sequence parameters = v.value<QBluetoothServiceInfo::Sequence>();
+ if (parameters.empty())
+ continue;
+ if (parameters.at(0).userType() == qMetaTypeId<QBluetoothUuid>()) {
+ if (parameters.at(0).value<QBluetoothUuid>() == protocol)
+ return parameters;
+ }
+ }
+
+ return QBluetoothServiceInfo::Sequence();
+}
+
+int QBluetoothServiceInfoPrivate::serverChannel() const
+{
+ QBluetoothServiceInfo::Sequence parameters = protocolDescriptor(QBluetoothUuid::Rfcomm);
+
+ if (parameters.isEmpty())
+ return -1;
+ else if (parameters.count() == 1)
+ return 0;
+ else
+ return parameters.at(1).toUInt();
+}
+
QT_END_NAMESPACE_BLUETOOTH
diff --git a/src/bluetooth/qbluetoothserviceinfo_p.h b/src/bluetooth/qbluetoothserviceinfo_p.h
index 2380a614..103a7617 100644
--- a/src/bluetooth/qbluetoothserviceinfo_p.h
+++ b/src/bluetooth/qbluetoothserviceinfo_p.h
@@ -44,6 +44,7 @@
#include "qbluetoothuuid.h"
#include "qbluetoothdeviceinfo.h"
+#include "qbluetoothserviceinfo.h"
#include <QMap>
#include <QVariant>
@@ -72,6 +73,9 @@ public:
void removeRegisteredAttribute(quint16 attributeId) const;
QBluetoothDeviceInfo deviceInfo;
QMap<quint16, QVariant> attributes;
+
+ QBluetoothServiceInfo::Sequence protocolDescriptor(QBluetoothUuid::ProtocolUuid protocol) const;
+ int serverChannel() const;
private:
#ifdef QT_BLUEZ_BLUETOOTH
bool ensureSdpConnection() const;
diff --git a/src/bluetooth/qbluetoothserviceinfo_qnx.cpp b/src/bluetooth/qbluetoothserviceinfo_qnx.cpp
index 63421536..4a9b5a42 100644
--- a/src/bluetooth/qbluetoothserviceinfo_qnx.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo_qnx.cpp
@@ -89,24 +89,25 @@ extern QHash<QRfcommServerPrivate*, int> __fakeServerPorts;
bool QBluetoothServiceInfoPrivate::registerService() const
{
- Q_Q(const QBluetoothServiceInfo);
- if (q->socketProtocol() != QBluetoothServiceInfo::RfcommProtocol) {
+ if (protocolDescriptor(QBluetoothUuid::Rfcomm).isEmpty()) {
qWarning() << Q_FUNC_INFO << "Only SPP services can be registered on QNX";
return false;
}
- if (q->serverChannel() == -1)
+ if (serverChannel() == -1)
return false;
- if (__fakeServerPorts.key(q->serverChannel()) != 0) {
+ if (__fakeServerPorts.key(serverChannel()) != 0) {
qBBBluetoothDebug() << "Registering server with UUID" <<
- q->serviceUuid() << " Name" << q->serviceName();
- qDebug() << "Server is" << __fakeServerPorts.key(q->serverChannel());
- if (!ppsSendControlMessage("register_server", 0x1101, q->serviceUuid(), QString(), q->serviceName(),
- __fakeServerPorts.key(q->serverChannel()), BT_SPP_SERVER_SUBTYPE))
+ attributes.value(QBluetoothServiceInfo::ServiceId).value<QBluetoothUuid>()
+ << " Name" << attributes.value(QBluetoothServiceInfo::ServiceName).toString();
+ qDebug() << "Server is" << __fakeServerPorts.key(serverChannel());
+ if (!ppsSendControlMessage("register_server", 0x1101, attributes.value(QBluetoothServiceInfo::ServiceId).value<QBluetoothUuid>(), QString(),
+ attributes.value(QBluetoothServiceInfo::ServiceName).toString(),
+ __fakeServerPorts.key(serverChannel()), BT_SPP_SERVER_SUBTYPE))
return false;
//The server needs to know the service name for the socket mount point path
- __fakeServerPorts.key(q->serverChannel())->m_serviceName = q->serviceName();
+ __fakeServerPorts.key(serverChannel())->m_serviceName = attributes.value(QBluetoothServiceInfo::ServiceName).toString();
} else {
return false;
}