diff options
author | Michael Zanetti <michael.zanetti@nokia.com> | 2012-04-12 09:35:42 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-26 02:48:16 +0200 |
commit | d2ca81e42d20534ebf541d28501b076353c91a47 (patch) | |
tree | f488acde814f72606f6779f1209841738f6f4cae /src/bluetooth/qbluetoothserviceinfo_bluez.cpp | |
parent | 90002adc45f7104b71142473c193373af9bbc69d (diff) | |
download | qtconnectivity-d2ca81e42d20534ebf541d28501b076353c91a47.tar.gz |
Extend SPP profile to be used with NOKIA_BT_SERVICES
Change-Id: Ide681b442f50d7b126d93b891b58aba75832b881
Reviewed-by: Alex <alex.blasche@nokia.com>
Diffstat (limited to 'src/bluetooth/qbluetoothserviceinfo_bluez.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothserviceinfo_bluez.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/bluetooth/qbluetoothserviceinfo_bluez.cpp b/src/bluetooth/qbluetoothserviceinfo_bluez.cpp index 5591403f..9a422f56 100644 --- a/src/bluetooth/qbluetoothserviceinfo_bluez.cpp +++ b/src/bluetooth/qbluetoothserviceinfo_bluez.cpp @@ -247,8 +247,10 @@ bool QBluetoothServiceInfoPrivate::ensureSdpConnection() const bool QBluetoothServiceInfoPrivate::registerService() const { - if (!ensureSdpConnection()) + if (!ensureSdpConnection()) { + qDebug() << "SDP not connected. Cannot register"; return false; + } QString xmlServiceRecord; @@ -263,10 +265,8 @@ bool QBluetoothServiceInfoPrivate::registerService() const QMap<quint16, QVariant>::ConstIterator i = attributes.constBegin(); while (i != attributes.constEnd()) { - QString t = unsignedFormat.arg(i.key(), 4, QLatin1Char('0')); stream.writeStartElement(QLatin1String("attribute")); - stream.writeAttribute(QLatin1String("id"), - unsignedFormat.arg(i.key(), 4, 16, QLatin1Char('0'))); + stream.writeAttribute(QLatin1String("id"), unsignedFormat.arg(i.key(), 4, 16, QLatin1Char('0'))); writeAttribute(&stream, i.value()); stream.writeEndElement(); @@ -282,15 +282,26 @@ bool QBluetoothServiceInfoPrivate::registerService() const if (!registered) { QDBusPendingReply<uint> reply = service->AddRecord(xmlServiceRecord); reply.waitForFinished(); - if (reply.isError()) + if (reply.isError()) { + qDebug() << "AddRecord returned error" << reply.error(); return false; + } serviceRecord = reply.value(); } else { +#ifndef NOKIA_BT_PATCHES QDBusPendingReply<> reply = service->UpdateRecord(serviceRecord, xmlServiceRecord); +#else + QDBusPendingReply<uint> reply = service->UpdateRecord(serviceRecord, xmlServiceRecord); +#endif reply.waitForFinished(); - if (reply.isError()) + if (reply.isError()) { + qDebug() << "UpdateRecord returned error" << reply.error(); return false; + } +#ifdef NOKIA_BT_PATCHES + serviceRecord = reply.value(); +#endif } registered = true; |