summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothserviceinfo.cpp
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/bluetooth/qbluetoothserviceinfo.cpp
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/bluetooth/qbluetoothserviceinfo.cpp')
-rw-r--r--src/bluetooth/qbluetoothserviceinfo.cpp54
1 files changed, 32 insertions, 22 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